How to call PDF to Image Converter Command Line from C# source code and convert first one page only?

Hi,

I am using the trial version PDF2Image.

string appPath = Path.GetDirectoryName(Application.ExecutablePath);
string str = strImageOutptFolder + strOutPutFileName + strFileCreatedDateTime + ".jpg";
Process proc = new Process();
int i = 0;
proc.StartInfo.FileName = appPath + @"\pdf2img.exe";
// string strpa = "-f 1";
string strArguments = "";
strArguments += " " + txtFileName.Text + " " + str + " -f " + i + " ";
proc.StartInfo.Arguments = @strArguments;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = false;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();

I have written the code in C# for Convert PDF2Image the first page of PDF but it is converting entire page. Please suggest how to use this code for Convert PDF2Imgage only first page not entire page.

Please provide the solution. After successfully testing I will go for purchase option.

Customer
===========================================================
Hi,

Please check the below mention link.

http://www.verydoc.com/pdf-to-image.html

PDF to Image Converter Command Line (Windows)
1 Server License

I am using the trial version PDF2Image.
string appPath = Path.GetDirectoryName(Application.ExecutablePath);
string str = strImageOutptFolder + strOutPutFileName + strFileCreatedDateTime + ".jpg";
Process proc = new Process();
int i = 0;
proc.StartInfo.FileName = appPath + @"\pdf2img.exe";
// string strpa = "-f 1";
string strArguments = "";
strArguments += " " + txtFileName.Text + " " + str + " -f " + i + " ";
proc.StartInfo.Arguments = @strArguments;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = false;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();

I have written the code in C# for Convert PDF2Image the first page of PDF but it is converting entire page. Please suggest how to use this code for Convert PDF2Imgage only first page not entire page.

Customer
===========================================================

Please use "-f 1 -l 1" to convert just first page only, for example,

pdf2img.exe -f 1 -l 1 D:\test.pdf D:\out.jpg

the C# code should be,
-----------------------------------------
string appPath = Path.GetDirectoryName(Application.ExecutablePath);
string str = strImageOutptFolder + strOutPutFileName + strFileCreatedDateTime + ".jpg";
Process proc = new Process();
int i = 0;
proc.StartInfo.FileName = appPath + @"\pdf2img.exe";
// string strpa = "-f 1";
string strArguments = "";
strArguments += " " + txtFileName.Text + " " + str + " -f " + i + " -l " + i + " ";
proc.StartInfo.Arguments = @strArguments;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = false;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
-----------------------------------------

VeryPDF

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in PDF to Image Converter and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!