image - Save pdf to jpeg using c# -


i need convert pdf file jpeg using c#. , solution (library) have free.

i have searched lot of information seems don't nothing clear.

i tried itextsharp , pdfbox (but this, pdf2image java, think) no success.

i tried extract images pdf individually, have error of invalid parameters when try extract images... seems have strange encoding.

anyone can recommend me library save pdf jpeg? examples appreciated too.

thanks!


solution: how convert pdf image using c#

  1. go to: http://www.codeproject.com/kb/cs/ghostscriptusewithcsharp.aspx
  2. download de library
  3. follow steps in web
  4. add code application, (very simple):

        //transform pdf jpg     pdftoimage.pdfconvert pp = new pdfconvert();     pp.outputformat = "jpeg"; //format     pp.jpegquality = 100; //100% quality     pp.resolutionx = 300; //dpi     pp.resolutiony = 300;     pp.firstpagetoconvert = 1; //pages want     pp.lastpagetoconvert = 1;     pp.convert(path_pdf+ "report.pdf", path_image + "name.jpg");   

the library pdfiumviewer might helpful here. available nuget.

  1. create new winforms app. add nuget "pdfiumviewer" it.
  2. this add 2 native dll's named "pdfium.dll" in folders x86 , x64 project. set "copy output directory" "copy always".
  3. try out following code (change paths suit setup).

        try     {         using (var document = pdfiumviewer.pdfdocument.load(@"input.pdf"))         {             var image = document.render(0, 300, 300, true);             image.save(@"output.png", imageformat.png);         }     }     catch (exception ex)     {         // handle exception here;     } 

    edit 2: changed code show page index 0 based pointed out in comment s.c. below

edit 1: updated solution have tried pdfsharp?

this link might helpful


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -