User:Clpo13/QPDF
Some notes on modifying PDF files with QPDF.
Rotating pages with QPDF[edit]
qpdf --rotate=90:1 input.pdf output.pdf
Rotates the specified page(s) in the PDF by the specified number of degrees (0, 90, 180, 270). The page (the number after the colon) can be omitted to rotate all pages or the pages can be given in a list or range, such as '1,3,5' or '2-5'. The option --replace-input
can be used instead of specifying an output file; in this case, the input file will be overwritten.
Removing pages with QPDF[edit]
qpdf --pages . 2-z -- input.pdf output.pdf
The z
in the page range indicates the last page, so this copies all pages except page 1 to the output file. The option --replace-input
can be used as above.
Combining PDFs with QPDF[edit]
qpdf --empty --pages a.pdf 1-z b.pdf 1-z -- c.pdf
As above, z
indicates the last page. This command appends all pages from b.pdf to a.pdf to create c.pdf. The range 1-z
can be optionally omitted (if missing, the range is assumed to be 1-z
). The option --collate
can be added to collate the pages (first page from a.pdf, first page from b.pdf, second page from a.pdf, second page from b.pdf, and so on).
See http://qpdf.sourceforge.net/files/qpdf-manual.html#ref.page-selection for more about page selection.
Fixing PDF display errors[edit]
qpdf a.pdf b.pdf
Sometimes, MediaWiki fails to properly display thumbnails for a PDF. That can possibly be fixed by simply copying the PDF with QPDF without making any explicit changes, as QPDF will optimize the file automatically. It might also help to add the --linearize
option, which will web-optimize the file.