You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2015/02/04 22:07:35 UTC

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

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

Tilman Hausherr resolved PDFBOX-1859.
-------------------------------------
       Resolution: Fixed
    Fix Version/s:     (was: 2.0.0)
                   1.8.9

You can get a snapshot within a few hours here:
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox/1.8.9-SNAPSHOT/

Sorry for the long wait.

> 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, 1.8.8, 1.8.9
>            Reporter: Hendrik Lescak
>            Assignee: Tilman Hausherr
>             Fix For: 1.8.9
>
>         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)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org