summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/qpdf/QPDFJob.hh1
-rw-r--r--include/qpdf/auto_job_c_main.hh1
-rw-r--r--job.sums14
-rw-r--r--job.yml2
-rw-r--r--libqpdf/QPDFJob_config.cc7
-rw-r--r--libqpdf/qpdf/auto_job_help.hh39
-rw-r--r--libqpdf/qpdf/auto_job_init.hh1
-rw-r--r--libqpdf/qpdf/auto_job_json_init.hh3
-rw-r--r--libqpdf/qpdf/auto_job_schema.hh1
-rw-r--r--manual/cli.rst17
10 files changed, 61 insertions, 25 deletions
diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh
index c5cc70b9..01307573 100644
--- a/include/qpdf/QPDFJob.hh
+++ b/include/qpdf/QPDFJob.hh
@@ -604,6 +604,7 @@ class QPDFJob
std::shared_ptr<char> password;
bool linearize{false};
bool decrypt{false};
+ bool remove_restrictions{false};
int split_pages{0};
bool progress{false};
std::function<void(int)> progress_handler{nullptr};
diff --git a/include/qpdf/auto_job_c_main.hh b/include/qpdf/auto_job_c_main.hh
index 6551e37d..6c661404 100644
--- a/include/qpdf/auto_job_c_main.hh
+++ b/include/qpdf/auto_job_c_main.hh
@@ -35,6 +35,7 @@ QPDF_DLL Config* recompressFlate();
QPDF_DLL Config* removePageLabels();
QPDF_DLL Config* reportMemoryUsage();
QPDF_DLL Config* requiresPassword();
+QPDF_DLL Config* removeRestrictions();
QPDF_DLL Config* showEncryption();
QPDF_DLL Config* showEncryptionKey();
QPDF_DLL Config* showLinearization();
diff --git a/job.sums b/job.sums
index b1a5cfe4..d9a383e1 100644
--- a/job.sums
+++ b/job.sums
@@ -3,15 +3,15 @@ generate_auto_job 9abe2ec994fb98526f5e3c0c199ce2e61a868463cb522a5bc6e9730b655341
include/qpdf/auto_job_c_att.hh 4c2b171ea00531db54720bf49a43f8b34481586ae7fb6cbf225099ee42bc5bb4
include/qpdf/auto_job_c_copy_att.hh 50609012bff14fd82f0649185940d617d05d530cdc522185c7f3920a561ccb42
include/qpdf/auto_job_c_enc.hh 28446f3c32153a52afa239ea40503e6cc8ac2c026813526a349e0cd4ae17ddd5
-include/qpdf/auto_job_c_main.hh a591693e831d08155da78cbbb13bac46cc3f5dd04de1d10b5810cbd3491bf8a0
+include/qpdf/auto_job_c_main.hh dbfc221d1533120d1aa9c361d8d2483dea5fcb1c0fd95144d98d305e64ed32a6
include/qpdf/auto_job_c_pages.hh b3cc0f21029f6d89efa043dcdbfa183cb59325b6506001c18911614fe8e568ec
include/qpdf/auto_job_c_uo.hh ae21b69a1efa9333050f4833d465f6daff87e5b38e5106e49bbef5d4132e4ed1
-job.yml 70a670b843284707c54108382cc17ab5c633aacc9a264bc0886a5410bea040e3
+job.yml 1f5db325600a763692034835117ac6b1a4b6aba8e73faa13a004ddc086834545
libqpdf/qpdf/auto_job_decl.hh 7844eba58edffb9494b19e8eca6fd59a24d6e152ca606c3b07da569f753df2da
-libqpdf/qpdf/auto_job_help.hh 68bcc56ae2b1a63d47af60f817c39f097756b6d36c733c8efdfbb808bce750c9
-libqpdf/qpdf/auto_job_init.hh da9b10925f3527acdc7cd0217abd2684a721a562f16f2fc0da62339aef3c3629
+libqpdf/qpdf/auto_job_help.hh d4650c0d8ea4310ef2ee890a9cd1543ce55c9b6b1c6462e0398955fe68d0d407
+libqpdf/qpdf/auto_job_init.hh e6c09e94c92bd17e9c728b11437e3c98266c93c42c3efbce050c8d288e6b3473
libqpdf/qpdf/auto_job_json_decl.hh 06caa46eaf71db8a50c046f91866baa8087745a9474319fb7c86d92634cc8297
-libqpdf/qpdf/auto_job_json_init.hh 8eec1d4acdf3e40cea46155cbf23a60d226ae6e9493ab18265b95dca790ed66d
-libqpdf/qpdf/auto_job_schema.hh a960022725ac4a59db531a3e2bc3964e40113b47348864e9229eb0f3fecfbdc0
+libqpdf/qpdf/auto_job_json_init.hh 85ac7e5c66f14c767419823eac84bdea4bd72d690bfe12b533321e5708e644b7
+libqpdf/qpdf/auto_job_schema.hh 5e0f5cb7d462716fe52548b2ae1a8eb6f3c900016e915140eea37f78cee45b2b
manual/_ext/qpdf.py 6add6321666031d55ed4aedf7c00e5662bba856dfcd66ccb526563bffefbb580
-manual/cli.rst 84a7290811712d00b243cbcd603bed31e253731eb1b6d6d5c2fafea79bfe299c
+manual/cli.rst 255db0c62765b39de9a71d3d755479235f5bbce32f2902ec5e0e201f265e322d
diff --git a/job.yml b/job.yml
index ac95ec1f..fb754b44 100644
--- a/job.yml
+++ b/job.yml
@@ -129,6 +129,7 @@ options:
- replace-input
- report-memory-usage
- requires-password
+ - remove-restrictions
- show-encryption
- show-encryption-key
- show-linearization
@@ -313,6 +314,7 @@ json:
progress:
split-pages:
json-output:
+ remove-restrictions:
encrypt:
_user-password: "user password"
_owner-password: "owner password"
diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc
index 66a4acb1..3a6bcdf4 100644
--- a/libqpdf/QPDFJob_config.cc
+++ b/libqpdf/QPDFJob_config.cc
@@ -518,6 +518,13 @@ QPDFJob::Config::requiresPassword()
}
QPDFJob::Config*
+QPDFJob::Config::removeRestrictions()
+{
+ o.m->remove_restrictions = true;
+ return this;
+}
+
+QPDFJob::Config*
QPDFJob::Config::showAttachment(std::string const& parameter)
{
o.m->attachment_to_show = parameter;
diff --git a/libqpdf/qpdf/auto_job_help.hh b/libqpdf/qpdf/auto_job_help.hh
index 10f3777c..71e49f3c 100644
--- a/libqpdf/qpdf/auto_job_help.hh
+++ b/libqpdf/qpdf/auto_job_help.hh
@@ -156,6 +156,11 @@ ap.addOptionHelp("--decrypt", "transformation", "remove encryption from input fi
encrypted. Normally qpdf preserves whatever encryption was
present on the input file. This option overrides that behavior.
)");
+ap.addOptionHelp("--remove-restrictions", "transformation", "remove security restrictions from input file", R"(Remove restrictions associated with digitally signed PDF files.
+This may be combined with --decrypt to allow free editing of
+previously signed/encrypted files. This option invalidates the
+signature but leaves its visual appearance intact.
+)");
ap.addOptionHelp("--copy-encryption", "transformation", "copy another file's encryption details", R"(--copy-encryption=file
Copy encryption details from the specified file instead of
@@ -167,6 +172,9 @@ ap.addOptionHelp("--encryption-file-password", "transformation", "supply passwor
If the file named in --copy-encryption requires a password, use
this option to supply the password.
)");
+}
+static void add_help_3(QPDFArgParser& ap)
+{
ap.addOptionHelp("--qdf", "transformation", "enable viewing PDF code in a text editor", R"(Create a PDF file suitable for viewing in a text editor and even
editing. This is for editing the PDF code, not the page contents.
All streams that can be uncompressed are uncompressed, and
@@ -175,9 +183,6 @@ companion tool "fix-qdf" can be used to repair hand-edited QDF
files. QDF is a feature specific to the qpdf tool. Please see
the "QDF Mode" chapter in the manual.
)");
-}
-static void add_help_3(QPDFArgParser& ap)
-{
ap.addOptionHelp("--no-original-object-ids", "transformation", "omit original object IDs in qdf", R"(Omit comments in a QDF file indicating the object ID an object
had in the original file.
)");
@@ -292,12 +297,12 @@ resulting set of pages, where :odd starts with the first page and
:even starts with the second page. These are odd and even pages
from the resulting set, not based on the original page numbers.
)");
-ap.addHelpTopic("modification", "change parts of the PDF", R"(Modification options make systematic changes to certain parts of
-the PDF, causing the PDF to render differently from the original.
-)");
}
static void add_help_4(QPDFArgParser& ap)
{
+ap.addHelpTopic("modification", "change parts of the PDF", R"(Modification options make systematic changes to certain parts of
+the PDF, causing the PDF to render differently from the original.
+)");
ap.addOptionHelp("--pages", "modification", "begin page selection", R"(--pages file [--password=password] [page-range] [...] --
Run qpdf --help=page-selection for details.
@@ -460,14 +465,14 @@ and filling in form fields. For 128-bit and 256-bit encryption,
this also enables editing, creating, and deleting form fields
unless --modify-other=n or --modify=none is also specified.
)");
+}
+static void add_help_5(QPDFArgParser& ap)
+{
ap.addOptionHelp("--assemble", "encryption", "restrict document assembly", R"(--assemble=[y|n]
Enable/disable document assembly (rotation and reordering of
pages). This option is not available with 40-bit encryption.
)");
-}
-static void add_help_5(QPDFArgParser& ap)
-{
ap.addOptionHelp("--extract", "encryption", "restrict text/graphic extraction", R"(--extract=[y|n]
Enable/disable text/graphic extraction for purposes other than
@@ -638,14 +643,14 @@ The --copy-attachments-from flag and its options may be repeated
to copy attachments from multiple files. Run
qpdf --help=copy-attachments for details.
)");
+}
+static void add_help_6(QPDFArgParser& ap)
+{
ap.addOptionHelp("--remove-attachment", "attachments", "remove an embedded file", R"(--remove-attachment=key
Remove an embedded file using its key. Get the key with
--list-attachments.
)");
-}
-static void add_help_6(QPDFArgParser& ap)
-{
ap.addHelpTopic("pdf-dates", "PDF date format", R"(When a date is required, the date should conform to the PDF date
format specification, which is "D:yyyymmddhhmmssz" where "z" is
either literally upper case "Z" for UTC or a timezone offset in
@@ -750,11 +755,11 @@ underlying encryption key to be displayed.
ap.addOptionHelp("--check-linearization", "inspection", "check linearization tables", R"(Check to see whether a file is linearized and, if so, whether
the linearization hint tables are correct.
)");
-ap.addOptionHelp("--show-linearization", "inspection", "show linearization hint tables", R"(Check and display all data in the linearization hint tables.
-)");
}
static void add_help_7(QPDFArgParser& ap)
{
+ap.addOptionHelp("--show-linearization", "inspection", "show linearization hint tables", R"(Check and display all data in the linearization hint tables.
+)");
ap.addOptionHelp("--show-xref", "inspection", "show cross reference data", R"(Show the contents of the cross-reference table or stream (object
locations in the file) in a human-readable form. This is
especially useful for files with cross-reference streams, which
@@ -853,15 +858,15 @@ ap.addOptionHelp("--json-input", "json", "input file is qpdf JSON", R"(Treat the
"qpdf JSON Format" section of the manual for information about
how to use this option.
)");
+}
+static void add_help_8(QPDFArgParser& ap)
+{
ap.addOptionHelp("--update-from-json", "json", "update a PDF from qpdf JSON", R"(--update-from-json=qpdf-json-file
Update a PDF file from a JSON file. Please see the "qpdf JSON"
chapter of the manual for information about how to use this
option.
)");
-}
-static void add_help_8(QPDFArgParser& ap)
-{
ap.addHelpTopic("testing", "options for testing or debugging", R"(The options below are useful when writing automated test code that
includes files created by qpdf or when testing qpdf itself.
)");
diff --git a/libqpdf/qpdf/auto_job_init.hh b/libqpdf/qpdf/auto_job_init.hh
index 574efc90..177f2105 100644
--- a/libqpdf/qpdf/auto_job_init.hh
+++ b/libqpdf/qpdf/auto_job_init.hh
@@ -71,6 +71,7 @@ this->ap.addBare("remove-page-labels", [this](){c_main->removePageLabels();});
this->ap.addBare("replace-input", b(&ArgParser::argReplaceInput));
this->ap.addBare("report-memory-usage", [this](){c_main->reportMemoryUsage();});
this->ap.addBare("requires-password", [this](){c_main->requiresPassword();});
+this->ap.addBare("remove-restrictions", [this](){c_main->removeRestrictions();});
this->ap.addBare("show-encryption", [this](){c_main->showEncryption();});
this->ap.addBare("show-encryption-key", [this](){c_main->showEncryptionKey();});
this->ap.addBare("show-linearization", [this](){c_main->showLinearization();});
diff --git a/libqpdf/qpdf/auto_job_json_init.hh b/libqpdf/qpdf/auto_job_json_init.hh
index c3c848e2..8f642d7c 100644
--- a/libqpdf/qpdf/auto_job_json_init.hh
+++ b/libqpdf/qpdf/auto_job_json_init.hh
@@ -109,6 +109,9 @@ popHandler(); // key: splitPages
pushKey("jsonOutput");
addChoices(json_output_choices, false, [this](std::string const& p) { c_main->jsonOutput(p); });
popHandler(); // key: jsonOutput
+pushKey("removeRestrictions");
+addBare([this]() { c_main->removeRestrictions(); });
+popHandler(); // key: removeRestrictions
pushKey("encrypt");
beginDict(bindJSON(&Handlers::beginEncrypt), bindBare(&Handlers::endEncrypt)); // .encrypt
pushKey("userPassword");
diff --git a/libqpdf/qpdf/auto_job_schema.hh b/libqpdf/qpdf/auto_job_schema.hh
index edb0a135..fbc13d8c 100644
--- a/libqpdf/qpdf/auto_job_schema.hh
+++ b/libqpdf/qpdf/auto_job_schema.hh
@@ -29,6 +29,7 @@ static constexpr char const* JOB_SCHEMA_DATA = R"({
"progress": "show progress when writing",
"splitPages": "write pages to separate files",
"jsonOutput": "apply defaults for JSON serialization",
+ "removeRestrictions": "remove security restrictions from input file",
"encrypt": {
"userPassword": "user password",
"ownerPassword": "owner password",
diff --git a/manual/cli.rst b/manual/cli.rst
index 49ae90f8..6fab24d5 100644
--- a/manual/cli.rst
+++ b/manual/cli.rst
@@ -736,7 +736,22 @@ Related Options
whatever encryption was present on the input file. This
functionality is not intended to be used for bypassing copyright
restrictions or other restrictions placed on files by their
- producers. See also :qpdf:ref:`--copy-encryption`.
+ producers. See also :qpdf:ref:`--copy-encryption` and
+ :qpdf:ref:`--remove-restrictions`.
+
+.. qpdf:option:: --remove-restrictions
+
+ .. help: remove security restrictions from input file
+
+ Remove restrictions associated with digitally signed PDF files.
+ This may be combined with --decrypt to allow free editing of
+ previously signed/encrypted files. This option invalidates the
+ signature but leaves its visual appearance intact.
+
+ Remove security restrictions associated with digitally signed PDF
+ files. This may be combined with :qpdf:option:--decrypt: to allow
+ free editing of previously signed/encrypted files. This option
+ invalidates the signature but leaves its visual appearance intact.
.. qpdf:option:: --copy-encryption=file