Forum How do I...?

Output pages in reverse

litza
We want to generate documents that will be read right to left, so when sending to the printing service the pages need to be ordered from last to first. The only system I can find that will do this is PDFlib (http://www.pdflib.com/fileadmin/pdflib/pdf/support/PDFlib-in-PHP-HowTo.pdf), but it feels like expensive overkill to generate the document in Prince only to process it a second time in PDFLib!

Is there any way to output pages in reverse? (Any free solutions outside of Prince would be welcome as well.)

Thank you!
mikeday
There isn't any way to do this in Prince yet, so it will require an external tool for the time being.
mikkelricky
You should check out pdftk [http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/].

Using pdftk you can reverse pages in a pdf (in.pdf) with this command

pdftk in.pdf cat end-1 output reversed.pdf


See http://www.pdflabs.com/docs/pdftk-cli-examples/ for more examples of the cool features of pdftk.

Best regards,
Mikkel
webchickbot
Hello —

Does this feature work in Prince XML 12.1 or is an external tool like pdftk still necessary?

Thank you!
mikeday
An external tool is still required to reverse the pages, although Prince will now check the "direction" property on the root element to specify the preferred reading order in the PDF, eg. for right-to-left scripts like Arabic.
webchickbot
Thank you - I have been researching state-of-the-art on this topic and was pretty certain that was the case. PrinceXML is a great tool!