diff options
author | Jay Berkenbilt <ejb@ql.org> | 2023-01-28 19:41:58 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2023-01-28 19:42:19 +0100 |
commit | 1308c450903dcae15e37f06339a5c6bff73bab2c (patch) | |
tree | 5da52c7c1d219d3fbe0e85811c462b581eeb2c41 /libqpdf/QPDF.cc | |
parent | fe11f13d63f9545c47b4f59efa4335f2c3ecf4d9 (diff) | |
download | qpdf-1308c450903dcae15e37f06339a5c6bff73bab2c.tar.zst |
Implement --remove-restrictions (fixes #833)
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r-- | libqpdf/QPDF.cc | 11 |
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)); + } +} |