pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hewson <j...@jahewson.com>
Subject Re: How to extract the object id from a form field?
Date Thu, 20 Aug 2015 22:26:32 GMT

> On 19 Aug 2015, at 12:36, Tilman Hausherr <THausherr@t-online.de> wrote:
> 
> Am 19.08.2015 um 21:16 schrieb Roberto Nibali:
>> 
>> At least for simple geometric shapes, like rectangles, this should be feasible, no?
Anyway, after constantly getting "null" from the getCOSObject().getItem(COSName.KIDS) and
nothing out of getChildren() from a given PDField, I kind of gave up.
> 
> That should work higher up elements.... You have to start at /Acroform and work with
the intermediate elements (non terminal fields). The 2.0 PDFDebugger shows you what elements
are indirect objects. And then go down until you "hit" one of your PDField objects.
> 
> It is tricky because the PDFBox code tries to hide the indirect objects from the ordinary
user most of the time, and the COSBase objects don't know from what indirect objects they
come.

I added a method a while ago to solve exactly this problem:

	COSDocument#getKey(COSBase)

Will return the COSObjectKey which correspond a given indirect object. It does this by examining
every indirect object until it finds the one it’s after.

— John

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


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


Mime
View raw message