aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2023-01-28 19:41:58 +0100
committerJay Berkenbilt <ejb@ql.org>2023-01-28 19:42:19 +0100
commit1308c450903dcae15e37f06339a5c6bff73bab2c (patch)
tree5da52c7c1d219d3fbe0e85811c462b581eeb2c41 /libqpdf/QPDF.cc
parentfe11f13d63f9545c47b4f59efa4335f2c3ecf4d9 (diff)
downloadqpdf-1308c450903dcae15e37f06339a5c6bff73bab2c.tar.zst
Implement --remove-restrictions (fixes #833)
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r--libqpdf/QPDF.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index 812fb127..583a028c 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -2777,3 +2777,14 @@ QPDF::everPushedInheritedAttributesToPages() const
{
return this->m->ever_pushed_inherited_attributes_to_pages;
}
+
+void
+QPDF::removeSecurityRestrictions()
+{
+ auto root = getRoot();
+ root.removeKey("/Perms");
+ auto acroform = root.getKey("/AcroForm");
+ if (acroform.isDictionary() && acroform.hasKey("/SigFlags")) {
+ acroform.replaceKey("/SigFlags", QPDFObjectHandle::newInteger(0));
+ }
+}