Export PDF to JPG(s) in C#

Jason picture Jason · Jan 9, 2012 · Viewed 25.2k times · Source

I need to save a one page pdf document as an image for a thumbnail on a website.

I've been messing around with PDFSharp and have had no luck.

I have tried this: http://www.pdfsharp.net/wiki/ExportImages-sample.ashx?AspxAutoDetectCookieSupport=1 but all it does is extract the embedded images in the PDF file which is not the desired result.

Ideas on how to do this? Anyone know a good library that can handle this?

Edit: Please let me know why this is such a bad question. If anyone has a good solution to this it would be a great resource for many other people. Especially since google searches come up empty.

Answer

Jason picture Jason · Jan 9, 2012

Take a look at Ghostscript. You can render PDF to images with it.

http://www.mattephraim.com/blog/2009/01/06/a-simple-c-wrapper-for-ghostscript/