Here I will explain how to convert PDF file to JPEG image File using C#.Net.
Add this namespace on your form
- using System.Diagnostics;
Add gswin64.exe in your root folder.
- strring FileName = "type here file name for ex. 1.pdf"
- string PathAndFileName = "type here file path with file name for ex. d:\abc\1.pdf"
-
- string cmd = "\"" + System.Windows.Forms.Application.StartupPath + "\\gswin64.exe \"";
- string argu = " -dNOPAUSE -dBATCH -dSAFER -sDEVICE=jpeg -djpegq=500
-r500 -dNumRenderingThreads=8 -sOutputFile=" + "\"" +
System.Windows.Forms.Application.StartupPath + "\\" + FileName + "%d.jpg" + "\" " + " \""
+ PathAndFileName + "\""; -
- System.Diagnostics.Process proc = new System.Diagnostics.Process();
- proc.StartInfo.FileName = cmd;
- proc.StartInfo.Arguments = argu;
- proc.StartInfo.CreateNoWindow = true;
- proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
- proc.Start();
- proc.WaitForExit();