Hello List,
after I set a PDPage to 180 rotation and save the PDDocument, I can
load it in PDFReader but it displays with no rotation.
PDFDebugger tells me the rotation is 180 so it would appear that
PDFReader ignores this value.

This is also the case with PrintPDF, no 180 rotation when I print it.

In Adbobe Acrobat Reader the page is shown correctly rotated 180 degrees.

Oddly if I make the rotation 90 degrees then PDFReader does then
correctly show a 90 degree rotated page.

Ultimately I want to be able to iterate the pages and set even pages
to 180 rotation so that when the PDF is sent to a duplex printer the
the reverse sides all print at 180 to the front. So far I cannot even
get this to work with a single page.
Does anyone know what the problem may be ?

...

            PDDocument document = PDDocument.load(pdfFile);
            List pages = document.getDocumentCatalog().getAllPages();
            for (int i = 0; i < pages.size(); i++) {
                PDPage page = (PDPage) pages.get(i);
                if ((i + 1) % 2 == 0) {
                    page.setRotation(180);  /// !!! 90 works fine but
not 180 !!!!!!  - it is stored in the PDF but PDFBox does not respect
it when printing or viewing
                }

            }
            File f = new File(pdfFile);
            String newFile = f.getParent() + File.separator + "out.pdf";
            document.save(newFile);
            document.close();

...


Regards,
Patrick

Reply via email to