PDFBox 2.0.4 - Blank page (200+ inches height) with Adobe Reader 2015

234 views Asked by At

I have a very big screenshot (48.69 x 1220.93 cm) which I’m converting to PDF using PDFBox 2.0.4.

It works well when I open the generated PDF using the Mac Preview app, but not with Adobe Reader version 2015. It shows only a long blank page and says the dimensions are 19.17 x 200 inches. I’m aware that early versions of the PDF spec had a limit of 200 inches height. So I've tried setting the pdf version to 1.7 but it didn’t work:

org.apache.pdfbox.pdmodel.PDDocument#setVersion
org.apache.pdfbox.cos.COSDocument#setVersion

Both Adobe and Preview say the version of the pdf is 1.7. I can normally open smaller pdfs using adobe.

1

There are 1 answers

0
mkl On

As @Tilman already said in his comment,

The media box is 1380 x 34609. 1 unit = 1/72 inch

Unfortunately this is beyond the size a specification conforming pdf reader has to support:

The minimum page size should be 3 by 3 units in default user space; the maximum should be 14,400 by 14,400 units. In versions of PDF earlier than 1.6, the size of the default user space unit was fixed at 1 ⁄ 72 inch, yielding a minimum of approximately 0.04 by 0.04 inch and a maximum of 200 by 200 inches. Beginning with PDF 1.6, the size of the unit may be set on a page-by-page basis; the default remains at 1/ 72 inch.

(Table C.1 – Architectural limits - ISO 32000-1)

To support a document page as large as desired here, one should use a larger default user space unit, e.g. 3/72".