From 1308c450903dcae15e37f06339a5c6bff73bab2c Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 28 Jan 2023 13:41:58 -0500 Subject: Implement --remove-restrictions (fixes #833) --- libqpdf/QPDF.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libqpdf/QPDF.cc') 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)); + } +} -- cgit v1.2.3-54-g00ecf