[poppler] poppler/Form.cc poppler/Form.h

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Mar 1 23:52:38 UTC 2017


 poppler/Form.cc |   19 +++++++++++++++++++
 poppler/Form.h  |    4 ++++
 2 files changed, 23 insertions(+)

New commits:
commit 0ae3d40a79c25feb5cb9bce6fc8cc48c30bfd1b6
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Mar 2 00:52:21 2017 +0100

    Parse AcroForm CO (calculateOrder)

diff --git a/poppler/Form.cc b/poppler/Form.cc
index b73f52d..ced3140 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -1640,6 +1640,25 @@ Form::Form(PDFDoc *docA, Object* acroFormA)
   }
   obj1.free ();
 
+  acroForm->dictLookup("CO", &obj1);
+  if (obj1.isArray()) {
+    Array *array = obj1.getArray();
+    calculateOrder.reserve(array->getLength());
+    for(int i=0; i<array->getLength(); i++) {
+      Object oref;
+      array->getNF(i, &oref);
+      if (!oref.isRef()) {
+        error(errSyntaxWarning, -1, "Direct object in CO");
+        oref.free();
+        continue;
+      }
+      calculateOrder.push_back(oref.getRef());
+
+      oref.free();
+    }
+  }
+  obj1.free ();
+
 #ifdef DEBUG_FORMS
   for (int i = 0; i < numFields; i++)
     rootFields[i]->printTree();
diff --git a/poppler/Form.h b/poppler/Form.h
index 5265133..8696d2f 100644
--- a/poppler/Form.h
+++ b/poppler/Form.h
@@ -540,6 +540,9 @@ public:
   FormWidget* findWidgetByRef (Ref aref);
 
   void postWidgetsLoad();
+
+  const std::vector<Ref> &getCalculateOrder() const { return calculateOrder; }
+
 private:
   FormField** rootFields;
   int numFields;
@@ -550,6 +553,7 @@ private:
   GBool needAppearances;
   GfxResources *defaultResources;
   Object resDict;
+  std::vector<Ref> calculateOrder;
 
   // Variable Text
   GooString *defaultAppearance;


More information about the poppler mailing list