[ 
https://issues.apache.org/jira/browse/PDFBOX-5637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17753901#comment-17753901
 ] 

Andreas Lehmkühler commented on PDFBOX-5637:
--------------------------------------------

Looks good to me as a first step. There is one point I'd like to improve. There 
is an optional field cache. We should use it instead of getFieldTree if the 
cache is enabled.

How about using the following to get the fields?
{code}
### Eclipse Workspace Patch 1.0
#P pdfbox
Index: src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java
===================================================================
--- src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java    
(Revision 1911474)
+++ src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java    
(Arbeitskopie)
@@ -699,13 +699,13 @@
             return Collections.emptyList();
         }
 
-        PDFieldTree fieldTree = getFieldTree();
+        Iterable<PDField> fields = isCachingFields() ? fieldCache.values() : 
getFieldTree();
 
         List<PDField> actuals = new ArrayList<>();
         for (int i = 0; i < co.size(); i++)
         {
             COSBase item = co.getObject(i);
-            for (PDField field : fieldTree)
+            for (PDField field : fields)
             {
                 if (field.getCOSObject() == item)
                 {
{code}

> Add getter and setter for the CO array under PDAcroForm
> -------------------------------------------------------
>
>                 Key: PDFBOX-5637
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5637
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: AcroForm
>    Affects Versions: 2.0.29
>            Reporter: Gilad Denneboom
>            Priority: Minor
>             Fix For: 2.0.30, 3.0.0 PDFBox
>
>         Attachments: calc order test.pdf
>
>
> The CO-array is a part of the AcroForm object, which defines the order in 
> which fields are calculated (see Table 218 in the PDF ISO specs). It contains 
> (indirect) references to the calculated fields.
> It would be nice to have a direct getter and setter for it under PDAcroForm. 
> Also, if the references could be automatically converted to point to the 
> actual PDField objects, that would be great.
> In order to do that, the values from this array need to be compared to those 
> returned by the getCOSObject method of the PDField objects returned by the 
> getFields methods of PDAcroForm.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to