title: Convert PDF to JPG / Images without using a specific C# Library
body: <p>is there a free <strong>C# library</strong> (<strong>.dll</strong>) to convert <strong>PDF</strong> to <strong>images</strong> ? </p>
  
  <p>I tried this one : </p>
  
  <blockquote>
    <p><a href="https://code.google.com/p/lib-pdf/">https://code.google.com/p/lib-pdf/</a></p>
  </blockquote>
  
  <p>But it doesn't work, I got this error : </p>
  
  <pre><code>  Could not load file or assembly 'libpdf.DLL' or one of its dependencies. The specified    module could not be found.
  </code></pre>
  
  <p>iTextSharp doesn't implement a function like that either..</p>
  
  <p>EDIT: </p>
  
  <p>I didn't use ghost scrpit because you had to install it before on the computer</p>
  
  <p>But now I found a solution : if you load manualy the dll it works </p>
  
  <blockquote>
    <p><a href="http://ghostscriptnet.codeplex.com/discussions/465418">http://ghostscriptnet.codeplex.com/discussions/465418</a></p>
  </blockquote>
  
  <pre><code>    public void PDFToImage(string file, string outputPath, int dpi)
      {
          string path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
  
          Ghostscript.NET.Rasterizer.GhostscriptRasterizer rasterizer = null;
          Ghostscript.NET.GhostscriptVersionInfo vesion = new Ghostscript.NET.GhostscriptVersionInfo(new Version(0, 0, 0), path + @"\gsdll32.dll", string.Empty, Ghostscript.NET.GhostscriptLicense.GPL);
  
          using (rasterizer = new Ghostscript.NET.Rasterizer.GhostscriptRasterizer())
          {
              rasterizer.Open(file, vesion, false);
  
              for (int i = 1; i &lt;= rasterizer.PageCount; i++)
              {
                  string pageFilePath = Path.Combine(outputPath, Path.GetFileNameWithoutExtension(file) + "-p" + i.ToString() + ".jpg");
  
                  Image img = rasterizer.GetPage(dpi, dpi, i);
                  img.Save(pageFilePath, ImageFormat.Jpeg);
              }
  
             rasterizer.Close();
         }
     }
  </code></pre>