I have this PDF file created by scanning. When viewing it in any PDF viewer, the page's width is greater than the height.
But it seems like all the PDF applications I have tried mistake the width as the height and the height as the width for this PDF file (see below.)
Why?
Is the PDF file broken?
How can I "repair" the PDF file so that the PDF applications don't mix its width and height?
The following command shows the width is smaller than the height in points:
$ pdfinfo test.pdf Creator: Xerox WorkCentre 7830 Producer: Xerox WorkCentre 7830 CreationDate: Tue Dec 23 00:22:47 2014 Tagged: no Form: none Pages: 1 Encrypted: no Page size: 612 x 1008 pts Page rot: 90 File size: 81820 bytes Optimized: no PDF version: 1.4
The following command shows the width is smaller than the height in pixels:
$ pdfimages -list test.pdf page num type width height color comp bpc enc interp object ID --------------------------------------------------------------------- 1 0 image 864 1400 rgb 3 8 jpeg no 6 0 1 1 mask 1236 895 - 1 1 jbig2 no 8 0 1 2 mask 737 891 - 1 1 jbig2 no 10 0 1 3 mask 247 381 - 1 1 jbig2 no 11 0 1 4 mask 44 298 - 1 1 jbig2 no 12 0 1 5 mask 429 9 - 1 1 jbig2 no 13 0 1 6 mask 22 258 - 1 1 jbig2 no 14 0 1 7 mask 130 142 - 1 1 jbig2 no 15 0
I am trying to crop away the left and right margins of the PDF file, using the script
pdfcrop.sh
here which seems based ongs
andpdftk
. My measurements of the left and right margins are 116 pts and 20 pts.The usage of the script says:
echo " -t \"<left> [<top> [<right> <bottom>]]\"" echo " trims outer page edges by the given amounts. Unit is bp. A single number" echo " is used for all trims, two numbers \"<left> <top>\" are applied to the" echo " right and bottom trims alike."
but
pdfcrop.sh -t "116 0 20 0" test.pdf trimmed.pdf
will crop the top by 116 pts and the bottom by 20 pts, while the following does the correct thing by crop the left by 116 pts and the right by 20 pts.
pdfcrop.sh -t "0 116 0 20" test.pdf trimmed.pdf