[poppler] poppler/Annot.cc poppler/Annot.h poppler/Page.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 29 00:23:37 UTC 2020


 poppler/Annot.cc |    5 +++--
 poppler/Annot.h  |    2 ++
 poppler/Page.cc  |    4 +++-
 3 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 2706eca3ad3af99fa6551b9d6fcdc69eb0a0aa4e
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Oct 28 22:30:00 2020 +0100

    More work on rendering of standalone Annot Widgets
    
    Issue #806

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 9459e1aa..11231d91 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -4974,9 +4974,10 @@ void AnnotWidget::draw(Gfx *gfx, bool printing)
     // Only construct the appearance stream when
     // - annot doesn't have an AP or
     // - NeedAppearances is true
-    if (field) {
-        if (appearance.isNull() || (form && form->getNeedAppearances()))
+    if (field && form) {
+        if (appearance.isNull() || form->getNeedAppearances()) {
             generateFieldAppearance(&addDingbatsResource);
+        }
     }
 
     // draw the appearance stream
diff --git a/poppler/Annot.h b/poppler/Annot.h
index 68274118..efa3a658 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -1420,6 +1420,8 @@ public:
 
     bool setFormAdditionalAction(FormAdditionalActionsType type, const GooString &js);
 
+    void setField(FormField *f) { field = f; };
+
 private:
     void initialize(PDFDoc *docA, Dict *dict);
 
diff --git a/poppler/Page.cc b/poppler/Page.cc
index 82233c21..0aa05442 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -386,7 +386,9 @@ void Page::loadStandaloneFields(Annots *annotations, Form *form)
         std::set<int> parents;
         FormField *field = Form::createFieldFromDict(annot->getAnnotObj().copy(), annot->getDoc(), r, nullptr, &parents);
 
-        if (field && field->getType() == formButton && field->getNumWidgets() == 1) {
+        if (field && field->getNumWidgets() == 1) {
+
+            static_cast<AnnotWidget *>(annot)->setField(field);
 
             field->setStandAlone(true);
             FormWidget *formWidget = field->getWidget(0);


More information about the poppler mailing list