I have a large set PDF documents, many of which will be multiple pages.
I am using Ghostscript [GS] to generate a JPG thumbnail image for each PDF.
I only want one JPG per PDF, which should be an image of the first page only
It seems that GS allows me to do one of the following, only:
- create an image which contains ALL pages of the PDF, or
- create multiple images per PDF by including the characters "%d" within the output filename, where each image represents one page of the PDF
The problem with option 1 is that I only want page 1 The problem with option 2 is that I only want one file (multiple files will be generated if the PDF is multiple pages)
Given that option 2 is the closest solution to my requirements, I am writing a script to generate multiple JPGs per PDF, and then rename the first and delete the others, hence ending up with just the one file with the name that I want.
I cannot see an option in the GS help page, but can I avoid this slightly convoluted process and more easily instruct GS only to generate 1 JPG for page 1 of each PDF?
-dFirstPage=1 -dLastPage=1or-sPageList=1(see Parameter switches (-d and -s)). You could get excellent results with less hassle usingpdftocairoorpdftoppminstead ofgs(install packagepoppler-utilson Debian), I've been there... Both tools are able to output JPEG files and the options are straightforward, e.g.pdftocairo -jpeg -singlefile -f 1 -l 1 -scale-to-x 200 -scale-to-y -1 input.pdf thumbto generatethumb.jpgof page 1 with a width of 200px and proportional height.