PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Convert PDF pages to JPGs
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1173
Page 1 of 1

Author:  Jacob [ Sat May 08, 2010 9:02 am ]
Post subject:  Convert PDF pages to JPGs

I know that this type of question have been asked before, but I havent been able to find a clear answer and alot of the posts are 4 years old.

I would like to convert a PDF to multiple JPG images, 1 image for each page in the PDF.

I have read that you need to use Ghostscript, but the UseGhostscript sample I downloaded says I need the dll file gsdll32 and I cant find it anywhere on the ghostscript site.
I even downloaded the exe installer and installed it, but still it didnt work. I dont wanna have to install ghostscript on the server where I wanna run this so I am looking for a way to do this conversion and have the dll added as an assembly.

I was hoping someone could shed some light on how I get this funktionality? I was hoping it was somthing PDFsharp could do, since it can extract images from a PDF and convert a PDF into multiple PDF documents.

Edit:
I have now gotten the UseGhostscript sample code to work, but when I move it to my own project which doesnt run Windows Forms, but is a web application, then I get a BadImageFormatException exception.

All I do is:
GS gs = new GS();

System.Drawing.Image image = gs.PdfToPng(filename, 4, 96);

But I get an error in ghostscript at:
result = Api.gsapi_new_instance(ref GS.instance, IntPtr.Zero);

Author:  Jacob [ Sat May 08, 2010 10:12 am ]
Post subject:  Re: Convert PDF pages to JPGs

For people looking for the this functionality I found this wrapper for Ghostscript which works perfectly :lol:
http://www.mattephraim.com/blog/2009/07/08/introducing-ghostscriptsharp/

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/