You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2014/10/11 01:59:50 UTC

[jira] [Updated] (PDFBOX-1859) ClassCastException for unknown destination type

     [ https://issues.apache.org/jira/browse/PDFBOX-1859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Hewson updated PDFBOX-1859:
--------------------------------
    Fix Version/s: 2.0.0

> 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
>             Fix For: 2.0.0
>
>         Attachments: Speisepläne.pdf
>
>
> Trying to read the outlines failed for the attached document.
> {code}
> 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);
> 		}
> 	}
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)