All the answers which involve ImageMagick tools (mogrify
, convert
) will first force your (potentially) vector-based PDF through a mincer that creates (possibly very large) pixel data from your slides. Converting that back to PDF will not restore you steak... uhmmm vector PDF, but it will just wrap the pixel data into a PDF shell.
There is an alternative: Use Ghostscript together with a little PostScript code snippet to transform vector-based PDF to vector-based PDF.
Ghostscript's solution
Use -dAutoRotatePages=/None
(or =/All
or =/PageByPage
). Here we require =/None
in order to tell Ghostscript should not try to auto-rotate the page(s) so that the text is "readable".
Here are the two complete, working commands to mirror PDF pages for A4-sized documents:
Horizontal mirroring (left <=> right):
gs \
-o mirrored-horizonal.pdf \
-sDEVICE=pdfwrite \
-dAutoRotatePages=/None \
-c "<</Install{595 0 translate -1 1 scale}>>setpagedevice" \
-f input.pdf
Vertical mirroring (top <=> bottom):
gs \
-o mirrored-vertical.pdf \
-sDEVICE=pdfwrite \
-dAutoRotatePages=/None \
-c "<</Install{0 842 translate 1 -1 scale}>>setpagedevice" \
-f input.pdf
Width and translate
Assuming that the width of the PDF page is 8.5 inches, aka 612 points, hence the 612 0 translate
part in my PostScript code snippet.
If your page width is different from 612 points, you have to adapt that part accordingly.
A4 portrait or A5 landscape media: 595 0 translate
.
Google doc presentation, 16/9 are 254 × 143mm aka 10" × 5.63 : 720 0 translate
.