tukusejssirs
tukusejssirs

Reputation: 864

Export only one page from a PDF file to PNG

How do I export only one page from a PDF file (e.g., page 28) to PNG?

I use this command to export all pages of PDF to PNG:

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m \
   -r400 -sOutputFile=out_%02d.png input.pdf

I have searched the man gs and the Net for any option in gs to do this, but I cannot find anything.

Upvotes: 0

Views: 393

Answers (1)

HABJAN
HABJAN

Reputation: 9328

In order to export specific page(s) from the pdf you need to use -dFirstPage and -dLastPage switches. You can read more about this switches here: How to use Ghostscript

Your command will look something like:

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -r400 -dFirstPage=28 -dLastPage=28 -sOutputFile=out.png input.pdf

Upvotes: 4

Related Questions