Description
Trying to read the outlines failed for the attached document.
import java.io.IOException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination; import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem; import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode; public class TestPDDestination { public static void main(String[] args) throws IOException { PDDocument doc = PDDocument.load("Speisepläne.pdf"); traverse(doc.getDocumentCatalog().getDocumentOutline()); doc.close(); } static void traverse(PDOutlineNode node) throws IOException { if (node instanceof PDOutlineItem) { PDDestination dst = ((PDOutlineItem) node).getDestination(); /** * throws java.lang.ClassCastException: org.apache.pdfbox.cos.COSFloat cannot be cast to org.apache.pdfbox.cos.COSName, * but should be something like a PDPageXYZDestination! */ System.out.println(dst); } for (PDOutlineItem child = node.getFirstChild(); child != null; child = child.getNextSibling()) { traverse(child); } } }
Attachments
Attachments
Issue Links
- relates to
-
PDFBOX-2651 Preflight doesn't check for valid destination syntax
- Closed