My Technical Notes

Monday, 19 June 2017

Extracting pages from PDF as PNGs

Extraction of pages from a PDF file can be done using GhostScript's command line program `gswin64c.exe`. The following command extracts all pages from `thePDF.pdf` into a series of PNG files named `page-001.png`, `page-002.png` etc:

gswin64c.exe -sDEVICE=pngalpha -o page-%03d.png -r600 thePDF.pdf

The `-r` parameter is the resolution in pixels per inch. In the above example, it is set to `600`, but to only test the command set it to a low value like `100`.

No comments: