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

Yan updated PDFBOX-3343:
------------------------
    Attachment: doc1.pdf

public void addOutline(Iterable<PDOutlineItem> items, PDOutlineItem rootitem) 
throws Exception
                {
                        for (PDOutlineItem item : items)
                        {
                                System.err.println("Root: "+ 
rootitem.getTitle()+" item: "+item.getTitle());
                                PDPage dest = null;
                                try { dest = item.findDestinationPage(fromdoc); 
}
                                        finally { /*System.err.println("Can't 
find Destination Page");*/ }
                                
                                int i_dest = intree.indexOf(dest) + 
this.nowpages;
                                String destname = item.getTitle();
                                PDPage toinsert = 
outcome.getPages().get(i_dest);
                                PDOutlineItem outtoinsert = new PDOutlineItem();
                                outtoinsert.setDestination(toinsert);
                                outtoinsert.setTitle(destname);
                                rootitem.addLast(outtoinsert);
                                if (item.hasChildren())
                                        addOutline(item.children(), item);
                        }
                }

this code outputs:
Root: fst header item: Fst subheader
Root: fst header item: fst header 2
Root: fst header item: Fst subheader
Root: fst header item: fst header 2
Root: fst header item: Fst subheader
Root: fst header item: fst header 2
Root: fst header item: Fst subheader
Root: fst header item: fst header 2
....

> PDOutlineItem getNextSibling() is recursive
> -------------------------------------------
>
>                 Key: PDFBOX-3343
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3343
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.1
>         Environment: Linux, openjdk-7
>            Reporter: Yan
>            Priority: Minor
>         Attachments: doc1.pdf
>
>
> Method getNextSibling from 
> org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem
>  is recursive: it returns first outline item, if it's object is the last 
> outline item.
> For example we have this otline:
> h1
> h2
> h3
> h3.getNextSibling() will return h1, but should return null



--
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