Forum Bugs

Landscape metadata seems to be broken

Immoware24 GmbH
Hello together.

After upgrading to version 10 there is a problem in our generated PDFs.
We genereate them dynamically and the pages can be either in landscape or in portrait mode. So the rotation and orientation is heterogeneous.
So far, so good. In the PDF viewer applications and the printer it seems working without problems.

We implemented an API to a postal delivery service that only takes portrait orientate pages.
So we used https://pdfbox.apache.org/ to detect landscape pages in the PDF document and bring them into portrait orientation.
Until version 9 it worked as a charme. But now it seems that the metadata of each page is not set properly. The page looks good but the detection failes.

We noticed that the prince logo was on the upper left side of the page, not as usual on the upper right side.

As we checked the change log, we noticed the new "prince-rotate-body" css property and applied it. After that, the logo was on the upper right side. But the detection still fails.

Any hints on what we forgot to implement additionally? Is it a bug in the prince application?

Any help is hardly appreciated. Thanks in advance.

Kind regards

René Thiemann
from immoware24 GmbH Germany
mikeday
We realised that the old way of doing landscape pages was causing problems for some customers, so the new prince-rotate-body property allows the page itself to stay portrait, while just the content in the page body is rotated to landscape.

When you say the postal delivery service only takes portrait pages, does that mean the page itself must be portrait or the content on the page must be portrait as well? Or am I confused? :)
Immoware24 GmbH
The page must be portrait. The content does not matter. It is just printed at the delivery service and sent as a usual letter. So the customer can rotate the sheet of paper to get the information on the landscape page.
Immoware24 GmbH
The problem is, that the printer service and the rotation detection application say that the rotation is 0. So the printed document is in portrait format and the content is in landscape format.
I attach a file, you can see the result in page three.
  1. empfangen.pdf2.1 MB
    see page three
Immoware24 GmbH
Here is another attachment, created with version 9 I installed. The rotation is detected correctly and printed correctly.
  1. Brief-2016-04-15.pdf2.0 MB
mikeday
Would you be able to attach the PDF files produced by Prince for these documents, that have not been processed by the printer service yet?
Immoware24 GmbH
sure :)
  1. generated.pdf114.2 kB
mikeday
That's funny, this file also looks as if it has been post-processed by some other tool, it doesn't quite match the output syntax normally produced by Prince.

Also, which properties did you apply to @page here, is it "size: landscape" or prince-rotate-body?
Immoware24 GmbH
yes.
in fact the resulting and attached pdf was originally two documents that were just merged.

with version 9: no problem.
with version 10: problem.

i attached a non-changed pdf file that fails on the delivery service.

the CSS:
@page landscape {
size: A4 landscape;
prince-rotate-body: landscape;
margin: 40pt 50pt 40pt 60pt;
}

@page portrait {
size: A4;
margin: 40pt 40pt 40pt 60pt;
}

.pdf_page_landscape {
page: landscape;
}

.pdf_page_portrait {
page: portrait;
}
  1. single.pdf66.6 kB
mikeday
Thank you. In the attached single.pdf it appears that all the pages are using "size: A4 landscape", so the prince-rotate-body property is having no effect.

What if you change it to:

@page landscape {
    size: A4;
    prince-rotate-body: landscape
}

Then the page itself should be portrait but the content of the page will be landscape.