pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Lehmkühler" <andr...@lehmi.de>
Subject Re: Re: Get page number for bookmark
Date Tue, 14 Jul 2009 06:49:09 GMT
Hi Adam,

> .... 
> I'm not sure how to contribute it back to the project other than posting 
> to this list.  As I understand it JIRA is for bugs, and this is not a bug, 
> it's a feature addition.  I've tested this code with a few PDFs from 
> various sources and it's working fine.  I removed the templates so it's 
> compatible with Java 1.4.  Hopefully this code will be accepted and get 
> put in the HEAD tag so it can help other people.
JIRA isn't limited to bugs, it is some sort of a tracker system for every kind of task concerning
the development of software. Of course there are issues filed for improvements too.
Please create an issue on jira and choose "Improvement" as type. Attach your code to it if
possible as diff against the current trunk. Please don't forget to grant the license to the
ASF by activating the checkbox in the bottom of the attachment formular.

Thanks a lot for the contribution,

Andreas Lehmkühler

> If there are any questions as to the logic which aren't answered in the 
> Adobe Specification for PDF, let me know and I'll explain.
> 
> --Adam
> 
> 
> 
> 
> Adam Nichols/UR/CER/XLDynamics
> 06/02/2009 11:24
> 
> To
> pdfbox-dev@incubator.apache.org
> cc
> 
> Subject
> Re: Get page number for bookmark
> 
> 
> 
> 
> 
> toArray returns an array of PDPage objects.  Since the PDPage objects do 
> not contain the page ID (as far as  can tell), this will not suffice. 
> Likewise iterator() and listIterator() both iterate over collections of 
> PDPages.  What I need is a list of object IDs for the pages; I don't want 
> the actual data in the pages.
> 
> --Adam
> 
> 
> 
> 
> Andreas Lehmkühler <andreas@lehmi.de> 
> 05/31/2009 10:25
> Please respond to
> pdfbox-dev@incubator.apache.org
> 
> 
> To
> pdfbox-dev@incubator.apache.org
> cc
> 
> Subject
> Re: Get page number for bookmark
> 
> 
> 
> 
> 
> 
> Hi Adam,
> 
> did you ever try to use one of the following methods:
> 
> COSArrayList.iterator
> COSArrayList.listIterator
> COSArrayList.toArray
> 
> All of them should return the data you're looking for.
> 
> Andreas Lehmkühler
> 
> Adam Nichols schrieb:
> > I propose the following function is added to COSArrayList.
> > 
> >     public COSArray toList() 
> >     {
> >         COSArray copy = new COSArray();
> >         for(int i=0; i < array.size(); ++i)
> >             copy.add(array.get(i));
> >         return copy;
> >     }
> > 
> > This returns a copy of the array to ensure the callers can't modify the 
> > internal array variable.  Callers already have access to this 
> information 
> > as it is the same data as is returned by toString() just in a more 
> useful 
> > format.  If it's OK to give the callers the ability to modify array 
> > directly, a reference could simply be returned.
> > 
> > I needed this because I got the "indirect reference to a page object" 
> from 
> > the target listed in a GoTo action and needed the page number.  By using 
> 
> > the method above I was able to get the page references in the catalog 
> and 
> > thus was able to determine the page number based on the page object id I 
> 
> > had.
> > 
> 
> 
> 

--- original Nachricht Ende ----


Mime
View raw message