getParent method of class PDField doesn't consider both  parent keys "P" and 
"Parent".
--------------------------------------------------------------------------------------

                 Key: PDFBOX-952
                 URL: https://issues.apache.org/jira/browse/PDFBOX-952
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel
    Affects Versions: 1.4.0
         Environment: Irrelevant for this issue.
            Reporter: Robert McHugh
             Fix For: 1.5.0


The getParent method should lookup a parent using both valid parent keys: "P" 
and "Parent".  The method findFieldType of this class already performs it's 
lookup using both keys.

Additionally method getParent of the class PDField has a return type of 
PDField.  While this is appropriate for nested fields this doesn't work for 
PDPages.  I have an AcroForm I'm working with that sets a Page object to be the 
parent of an AcroForm Field.  It does this specifically by setting the "P" key 
to the object reference for a particular page (e.g. << /P 102 0 R/FT/Btn >> 
with "102 0 R" being the aforementioned object reference).

As a result of this design decision there is no way of getting a field's parent 
page from the getField method.  We are required to get the backing 
COSDictionary, call getDictionaryObject("P") and create a PDPage Object from 
scratch.  This is workable, but not optimal.  We'd prefer avoiding the COS data 
types wherever possible.

Thanks,

Robert McHugh



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to