While preparing a scan of ladder manual I ran into a strange issue with a PDF produced by my Xerox® WorkCentre® 3225 MFP. Firefox was rendering the first page of the document normally but contents of the rest of the pages was shrunk in one direction.

A page like this Example correct rendering

Was rendered as Example bad rendering

Interestingly other PDF viewers I checked (xpdf, chrome) were rendering the whole document correctly.

I fixed this with Ghostscript:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf -f input.pdf

While doing this one can also apply rotation and merge multiple files in one:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -dAutoRotatePages=/None -sOutputFile=output.pdf -c "<</Orientation 3>> setpagedevice" -f input1.pdf -f input2.pdf

As it turned out rotation of a PDF document can be rather nuanced.

I eventually used the command found on linuxquestions.org.