[poppler] 2 commits - poppler/Form.cc poppler/Form.h qt5/src
Albert Astals Cid
aacid at kemper.freedesktop.org
Mon Dec 19 21:54:10 UTC 2016
poppler/Form.cc | 16 ++++++++++++++++
poppler/Form.h | 2 ++
qt5/src/poppler-form.cc | 9 ++++++++-
qt5/src/poppler-form.h | 10 ++++++++--
4 files changed, 34 insertions(+), 3 deletions(-)
New commits:
commit c301f6c675784a65fb2ebdf99ded5d5d3f8defdd
Author: Albert Astals Cid <aacid at kde.org>
Date: Mon Dec 19 22:53:47 2016 +0100
qt5: Add Poppler::FormField::setName
diff --git a/qt5/src/poppler-form.cc b/qt5/src/poppler-form.cc
index ba3dafd..91f0f34 100644
--- a/qt5/src/poppler-form.cc
+++ b/qt5/src/poppler-form.cc
@@ -1,6 +1,6 @@
/* poppler-form.h: qt interface to poppler
* Copyright (C) 2007-2008, 2011, Pino Toscano <pino at kde.org>
- * Copyright (C) 2008, 2011, 2012, 2015 Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2008, 2011, 2012, 2015, 2016 Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2011 Carlos Garcia Campos <carlosgc at gnome.org>
* Copyright (C) 2012, Adam Reichold <adamreichold at myopera.com>
*
@@ -111,6 +111,13 @@ QString FormField::name() const
return name;
}
+void FormField::setName(const QString &name) const
+{
+ GooString * goo = QStringToGooString( name );
+ m_formData->fm->setPartialName(*goo);
+ delete goo;
+}
+
QString FormField::fullyQualifiedName() const
{
QString name;
diff --git a/qt5/src/poppler-form.h b/qt5/src/poppler-form.h
index 3481ce7..6a94181 100644
--- a/qt5/src/poppler-form.h
+++ b/qt5/src/poppler-form.h
@@ -1,6 +1,6 @@
/* poppler-form.h: qt interface to poppler
* Copyright (C) 2007-2008, Pino Toscano <pino at kde.org>
- * Copyright (C) 2008, 2011, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2008, 2011, 2016, Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2012, Adam Reichold <adamreichold at myopera.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -74,9 +74,15 @@ namespace Poppler {
int id() const;
/**
- The internal name of the field.
+ The internal name (T) of the field.
*/
QString name() const;
+
+ /**
+ Sets the internal name (T) of the field.
+ \since 0.51
+ */
+ void setName(const QString &name) const;
/**
The internal fully qualified name of the field.
commit 86c99de95cd16199e0f9f1fb82999c27d54c5b76
Author: Albert Astals Cid <aacid at kde.org>
Date: Mon Dec 19 22:53:10 2016 +0100
Add Form[Field|Widget]::setPartialName
Useful to repair/tweak pdf files
diff --git a/poppler/Form.cc b/poppler/Form.cc
index dd62aaf..8f8d14c 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -147,6 +147,11 @@ GooString *FormWidget::getPartialName() const {
return field->getPartialName();
}
+void FormWidget::setPartialName(const GooString &name)
+{
+ field->setPartialName(name);
+}
+
GooString *FormWidget::getAlternateUiName() const {
return field->getAlternateUiName();
}
@@ -611,6 +616,17 @@ FormField::FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *par
obj1.free();
}
+void FormField::setPartialName(const GooString &name)
+{
+ delete partialName;
+ partialName = name.copy();
+
+ Object obj1;
+ obj1.initString(name.copy());
+ obj.getDict()->set("T", &obj1);
+ xref->setModifiedObject(&obj, ref);
+}
+
FormField::~FormField()
{
if (!terminal) {
diff --git a/poppler/Form.h b/poppler/Form.h
index 4628dbf..5265133 100644
--- a/poppler/Form.h
+++ b/poppler/Form.h
@@ -98,6 +98,7 @@ public:
double getFontSize() const;
GooString *getPartialName() const;
+ void setPartialName(const GooString &name);
GooString *getAlternateUiName() const;
GooString *getMappingName() const;
GooString *getFullyQualifiedName();
@@ -279,6 +280,7 @@ public:
VariableTextQuadding getTextQuadding() const { return quadding; }
GooString *getPartialName() const { return partialName; }
+ void setPartialName(const GooString &name);
GooString *getAlternateUiName() const { return alternateUiName; }
GooString *getMappingName() const { return mappingName; }
GooString *getFullyQualifiedName();
More information about the poppler
mailing list