You could use Ghostscript to rescale your PDF pages. This is what I used yesterday to scale a A4 sized PDF to A6, at the same time selecting only pages 22-27 for the output:
gswin32c.exe ^
-o A6-output.pdf ^
-sDEVICE=pdfwrite ^
-dPDFFitPage ^
-g2975x4210 ^
-dFirstPage=22 ^
-dLastPage=27 ^
-dPDFSETTINGS=/prepress ^
c:/path/to/input.pdf
Above command example is for Windows. On Linux replace the .exe by just gs
, and the ^
by \
.
-g2975x4210
gives the output size in pixels. To understand that value, you need to know that my input A4 size is 595 x 842, my desired A6 paper size is 297.5 x 421 points.
A point is a unit for measuring PostScript or PDF dimensions. There are 72 points to one inch. And Ghostscript's output device uses 720 dpi (dot per inch) resolution by default. Hence my "funny" page size given as -g2975x4210
.
To directly convert to PNG, I should have used:
gswin32c.exe ^
-o input_page_%03d_A6.png ^
-sDEVICE=pngalpha ^
-dPDFFitPage ^
-g297x421 ^
-dFirstPage=22 ^
-dLastPage=27 ^
c:/path/to/input.pdf
This gives me one PNG file per PDF page.
Note that I needed to change the -g
param because the default resolution for Ghostscript's image output devices is 72dpi. Of course I could have changed that by giving the resolution as, say -r200x200
, but then I'd have to re-calculate the -r...
value too. And I simply was too lazy to do that....