The CO-array (no spelling-mistake) is a part of the AcroForm object, which
defines the order in which fields are calculated (see Table 218 in the PDF
ISO specs). But it only contains (indirect) references to the fields.

However, your tip put me on the right path and I was able to get the actual
PDField objects by comparing the values in this array to the
values returned by the getCOSObject method of the PDFields under PDAcroForm.

It would actually be nice to have a direct getter and setter for it under
PDAcroForm... Maybe in future versions?

On Sat, Jul 15, 2023 at 10:50 AM Tilman Hausherr <thaush...@t-online.de>
wrote:

> I don't know what you mean with "CO array", I thought this was a typo
> because your image does not have a "CO" array.
>
> Re "but they seem to be quite oblique" - please try to run .getObject()
> on them.
>
> PDField.createField() does not create a new field, it just creates the
> PD-Object from a COSDictionary.
>
> Tilman
>
>
> On 15.07.2023 10:43, Gilad Denneboom wrote:
> > The CO array contains COSObjects, yes, but they seem to be quite oblique,
> > with nothing more than a reference number.
> > Are you saying I can use the COSObject itself to find the field? If so,
> how?
> > Note I'm not trying to create new fields, just locate the existing ones
> > referenced in this array.
> >
> > On Sat, Jul 15, 2023 at 4:15 AM Tilman Hausherr <thaush...@t-online.de>
> > wrote:
> >
> >> How did you get the indirect number in the first place?
> >>
> >> Normally this would be a COSObject and you can dereference that one by
> >> calling getObject() and here it would be a COSDictionary. You can pass
> >> this to PDField.createField().
> >>
> >> Tilman
> >>
> >> On 14.07.2023 20:54, Gilad Denneboom wrote:
> >>> Hi all,
> >>>
> >>> I'm trying to see if there's a way to get a field's name using PDFBox
> >> based
> >>> on the Indirect Reference number to it.
> >>> Namely, the numbers that are used in the CO array of the AcroForm
> >> object. I
> >>> can see those numbers in the PDF Debugger app next to the field name
> (see
> >>> screenshot: https://i.imgur.com/gCHvVRx.png), but I looked everywhere
> in
> >>> the properties of the PDField and PDAnnotationWidget and can't find
> them
> >>> there. Any pointers will be much appreciated!
> >>>
> >>> Regards, Gilad.
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
> >> For additional commands, e-mail: users-h...@pdfbox.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
> For additional commands, e-mail: users-h...@pdfbox.apache.org
>
>

Reply via email to