Convert PDF file to images using C#

Using C#, I need to convert each page of a PDF file into separate images and display the images.

Is it possible to do this without using a 3rd party DLL?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You can also use a c# code that is easly downloadable from Code Project
that use Ghostscript

Method 2

Not a huge job, as it has already been done 🙂

you’ll need ghostscript installed (mainly gsdll32.dll), and the c# wrapper from

It’s one .cs file. For some reason you’ll have to email him for the file, it is not posted.

To convert you’ll just a few lines, for example:

    string cl2 = @"-dSAFER -dNoVerifyXref -dQUIET -dNOPROMPT"
      + " -dBATCH -dNOPAUSE -sDEVICE=jpeg -r72 -dFirstPage=1 "
      +  "-dLastPage=1 -dUseCropBox -sOutputFile=" + SourceFile 
      + " " + TargetFile;

        Made4Print.GhostScript gs = 
            new Made4Print.GhostScript(@"[path-to-gs-installation]");
        gs.CallGSDll(cl2.Split(' '));
        //exception handler

this saves 1st page as jpeg @ 72 dpi

Method 3

I used PDF4NET from O2 a few times in the past and was pretty satisfied

Method 4

I have done with this ghost script to convert PDF to Image.hope this one is helpful

“-dNOPAUSE -dBATCH -dSAFER -sDEVICE=tifflzw -dTextAlphaBits=1 -dPDFFitPage -sOutputFile=”C:UserscisDesktopasp634667352520620000.tif” “C:UserscisDesktopasp.pdf””

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x