3

There are plenty of tools that can rotate a PDF. Is there a tool that can mirror it, too?

I am not looking for a solution that first converts to a bitmap, then mirrors and then converts the bitmap to PDF, but for a tool that can do the mirroring with no loss of quality. So in PostScript terms I am looking for 1 -1 scale 0 -height transform.

  • In case you can't find a tool: Use mutool to decompress streams in pdf file, open in editor, insert q 1 0 0 -1 0 0 cm (push state, modify transformation matrix) before and Q (pop state) after what you want to mirror (use anything to automate). Not sure if you'll need a translation, too. – dirkt Jan 14 '18 at 16:00
2

You can try pstops from package psutils. Convert the pdf to PostScript using GhostScript's ps2pdf first, then apply H for a horizontal flip.

pdf2ps in.pdf in.ps
pstops H in.ps out.ps

The PostScript output looks correct in gv, but when I converted it back to pdf with pdf2ps, it got flipped vertically too.

enter image description here

0

Based on @meuh's answer I have built:

https://gitlab.com/ole.tange/tangetools/blob/master/mirrorpdf/mirrorpdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.