[ 
https://issues.apache.org/jira/browse/PDFBOX-1859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14305947#comment-14305947
 ] 

Tilman Hausherr edited comment on PDFBOX-1859 at 2/4/15 9:05 PM:
-----------------------------------------------------------------

Your PDF is malformed:
{code}
<</Count 1/Dest[null 0.0 0.0 1.0]/First 41 0 R/Last 41 0 R/Parent 4 0 R/Prev 5 
0 R/Title(XXXX Wed Jun 15 2011 10-08-06.720.pdf)>>
{code}
The second parameter of /Dest should be a "name", e,g, "/FitR". PDFBox is now 
throwing an IOException, hopefully this will allow you a clean error handling.

{code}
org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDPageXYZDestination@5e899a54
Exception in thread "main" java.io.IOException: Error: can't convert to 
Destination COSArray{[org.apache.pdfbox.cos.COSNull@1bf33149, COSFloat{0.0}, 
COSFloat{0.0}, COSFloat{1.0}]}
        at 
org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination.create(PDDestination.java:99)
        at 
org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem.getDestination(PDOutlineItem.java:181)
        at testpdfbox18.TestPDDestination.traverse(TestPDDestination.java:21)
        at testpdfbox18.TestPDDestination.traverse(TestPDDestination.java:29)
        at testpdfbox18.TestPDDestination.main(TestPDDestination.java:15)
{code}

I already fixed the same bug in 2.0 a few days ago as part of quality 
improvements in preflight, so this fix applies to 1.8 only.


was (Author: tilman):
Your PDF is malformed:
{code}
<</Count 1/Dest[null 0.0 0.0 1.0]/First 41 0 R/Last 41 0 R/Parent 4 0 R/Prev 5 
0 R/Title(XXXX Wed Jun 15 2011 10-08-06.720.pdf)>>
{code}
The second parameter of /Dest should be a "name", e,g, "/FitR". PDFBox is now 
throwing an IOException, hopefully this will allow you a clean error handling.

I already fixed the same bug in 2.0 a few days ago as part of quality 
improvements in preflight, so this fix applies to 1.8 only.

> 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
>            Assignee: Tilman Hausherr
>             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)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to