[
https://issues.apache.org/jira/browse/PDFBOX-1859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Hendrik Lescak updated PDFBOX-1859:
-----------------------------------
Attachment: Speisepläne.pdf
> ClassCastException for unknown destination type
> -----------------------------------------------
>
> Key: PDFBOX-1859
> URL: https://issues.apache.org/jira/browse/PDFBOX-1859
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 1.8.3, 2.0.0
> Reporter: Hendrik Lescak
> Attachments: Speisepläne.pdf
>
>
> Trying to read the outlines failed for the attached document.
> {code:java}
> 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;
> /**
> * @author <a href="mailto:[email protected]">André
> Kischkel</a>
> * @since 22.01.2014
> * @version $Revision$
> */
> 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);
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)