Using the process laid out in testLayerImport() of http://java2s.com/Open-Source/Java/PDF/PDFBox-1.4.0/org/apache/pdfbox/util/TestLayerUtility.java.htm , a PDF document is generated that can be viewed in both Adobe Reader X (10.1.3) and SumatraPDF.
But when opening some of the tools in Reader X, an error box gets displayed. It warns about a potentially corrupt file and potentially incorrect display
For example, opening the resulting PDF, pressing F4 to view the layer utils will trigger this behavior.
I used page 1 from
- (1): http://www.enterasys.com/company/literature/a4-ds.pdf
- (2): http://www.tex.ac.uk/tex-archive/info/symbols/comprehensive/symbols-a4.pdf
respectively, to create a PDF with page 1 of (1) overlayed with page 1 of (2).
These are just random Google results. The error was triggered with more concrete files of my own as well
Since the PDF displays fine on initial load, it wouldn't be so bad if it wasn't exactly the layering I was after (overlaying, toggling display of individual layers)
I tried different variations:
- created a new document and importPage() from (1)
- did not create a new document but used (1) directly
- a few permutations of adding page/saving/re-loading or not
Alternatively - is there a way to add a layer/OCG without creating an XObject form off it?