How to convert PDF File in to JPEG image using C#.Net

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