aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgenerate_auto_job8
-rw-r--r--include/qpdf/auto_job_c_main.hh8
-rw-r--r--job.sums8
-rw-r--r--libqpdf/QPDFJob_argv.cc177
-rw-r--r--libqpdf/QPDFJob_config.cc209
-rw-r--r--libqpdf/qpdf/auto_job_decl.hh8
-rw-r--r--libqpdf/qpdf/auto_job_init.hh16
-rw-r--r--qpdf/qpdf.testcov4
8 files changed, 220 insertions, 218 deletions
diff --git a/generate_auto_job b/generate_auto_job
index b4a45bad..2d9689df 100755
--- a/generate_auto_job
+++ b/generate_auto_job
@@ -41,24 +41,16 @@ not_yet = set([
'annotate',
'assemble',
'cleartext-metadata',
- 'decode-level',
'extract',
'force-R5',
'force-V4',
'form',
'from',
- 'job-json-file',
'modify',
'modify-other',
- 'object-streams',
- 'password-file',
- 'password-mode',
'print',
- 'remove-unreferenced-resources',
'repeat',
'rotate',
- 'show-object',
- 'stream-data',
'to',
'use-aes',
])
diff --git a/include/qpdf/auto_job_c_main.hh b/include/qpdf/auto_job_c_main.hh
index a9ebc17c..09b1ed83 100644
--- a/include/qpdf/auto_job_c_main.hh
+++ b/include/qpdf/auto_job_c_main.hh
@@ -54,6 +54,7 @@ QPDF_DLL Config& copyEncryption(char const* parameter);
QPDF_DLL Config& encryptionFilePassword(char const* parameter);
QPDF_DLL Config& forceVersion(char const* parameter);
QPDF_DLL Config& iiMinBytes(char const* parameter);
+QPDF_DLL Config& jobJsonFile(char const* parameter);
QPDF_DLL Config& jsonObject(char const* parameter);
QPDF_DLL Config& keepFilesOpenThreshold(char const* parameter);
QPDF_DLL Config& linearizePass1(char const* parameter);
@@ -62,10 +63,17 @@ QPDF_DLL Config& oiMinArea(char const* parameter);
QPDF_DLL Config& oiMinHeight(char const* parameter);
QPDF_DLL Config& oiMinWidth(char const* parameter);
QPDF_DLL Config& password(char const* parameter);
+QPDF_DLL Config& passwordFile(char const* parameter);
QPDF_DLL Config& removeAttachment(char const* parameter);
QPDF_DLL Config& showAttachment(char const* parameter);
+QPDF_DLL Config& showObject(char const* parameter);
QPDF_DLL Config& compressStreams(char const* parameter);
+QPDF_DLL Config& decodeLevel(char const* parameter);
QPDF_DLL Config& flattenAnnotations(char const* parameter);
QPDF_DLL Config& jsonKey(char const* parameter);
QPDF_DLL Config& keepFilesOpen(char const* parameter);
QPDF_DLL Config& normalizeContent(char const* parameter);
+QPDF_DLL Config& objectStreams(char const* parameter);
+QPDF_DLL Config& passwordMode(char const* parameter);
+QPDF_DLL Config& removeUnreferencedResources(char const* parameter);
+QPDF_DLL Config& streamData(char const* parameter);
diff --git a/job.sums b/job.sums
index 4eaaeb76..8ccba12d 100644
--- a/job.sums
+++ b/job.sums
@@ -1,13 +1,13 @@
# Generated by generate_auto_job
-generate_auto_job 66e43cdb4ae166d020be19fcc6f8e9f0445c4de6a5395ff5aff511b89763c4e1
+generate_auto_job d41f3092545906dcd9a82f88ff41939bf695a36ecaebfe8559c66bd92b7416fb
include/qpdf/auto_job_c_att.hh ecc3f8f711b486b491e811176362a90c022eb225ff12157df3a10ca021be87b1
include/qpdf/auto_job_c_copy_att.hh caffae3d1faf2cd92a07ba77da638cce31da3e074a047918834195c0f3ed508a
-include/qpdf/auto_job_c_main.hh 5fdd9c85aa295a3caec467b9607fe82c874cd3aaeb7806b9d18074f7b96fd085
+include/qpdf/auto_job_c_main.hh 1e060e9dd2029d21b29fed03e3a1e62164050b43684bd7434cc9e9707f73150d
include/qpdf/auto_job_c_pages.hh 79ee6e52a36fedfd0e6ca60bd926bc25a3e975ab6fa984a7e798a48791e8ba86
job.yml 4cd60df0caa74b68cc39352910a8381c3411248bc3edef69f9d16d75e807f451
-libqpdf/qpdf/auto_job_decl.hh 38f7462e34fea7d46d5e5519ac1742be6e57ea6f66c47b37d5425f3a2b9ca536
+libqpdf/qpdf/auto_job_decl.hh f9f2a605fb8b5fed9b74c4cd07c07c3cdee60e2628d082250810c8074d5acd83
libqpdf/qpdf/auto_job_help.hh 383eea80e2c185ef5295fc126246457a7ceeffea759fdb90bb2e6727532ea538
-libqpdf/qpdf/auto_job_init.hh b49d839078d84398142f8f14bdae8a71f44fbff13cdf7b350b84ef2410aaa6a3
+libqpdf/qpdf/auto_job_init.hh b776c87e61d56842f23cb46fb6d4e44f5740e64854844bcc454fd812f7b4f8d5
libqpdf/qpdf/auto_job_schema.hh 6e6d72e99dacd02c22d9ac70f4dc78a935f879d2a16c89f07f2bdfa936cc2ae3
manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d
manual/cli.rst 68122ff8179c10df3fe6d577adde4973c346f7866ba9a511bab5a6e6f292a6f1
diff --git a/libqpdf/QPDFJob_argv.cc b/libqpdf/QPDFJob_argv.cc
index 063f77d8..a11eca9f 100644
--- a/libqpdf/QPDFJob_argv.cc
+++ b/libqpdf/QPDFJob_argv.cc
@@ -188,33 +188,6 @@ ArgParser::argShowCrypto()
}
void
-ArgParser::argPasswordFile(char* parameter)
-{
- std::list<std::string> lines;
- if (strcmp(parameter, "-") == 0)
- {
- QTC::TC("qpdf", "qpdf password stdin");
- lines = QUtil::read_lines_from_file(std::cin);
- }
- else
- {
- QTC::TC("qpdf", "qpdf password file");
- lines = QUtil::read_lines_from_file(parameter);
- }
- if (lines.size() >= 1)
- {
- o.password = QUtil::make_shared_cstr(lines.front());
-
- if (lines.size() > 1)
- {
- std::cerr << this->ap.getProgname()
- << ": WARNING: all but the first line of"
- << " the password file are ignored" << std::endl;
- }
- }
-}
-
-void
ArgParser::argEncrypt()
{
this->accumulated_args.clear();
@@ -273,31 +246,6 @@ ArgParser::argEncPositional(char* arg)
}
void
-ArgParser::argPasswordMode(char* parameter)
-{
- if (strcmp(parameter, "bytes") == 0)
- {
- o.password_mode = QPDFJob::pm_bytes;
- }
- else if (strcmp(parameter, "hex-bytes") == 0)
- {
- o.password_mode = QPDFJob::pm_hex_bytes;
- }
- else if (strcmp(parameter, "unicode") == 0)
- {
- o.password_mode = QPDFJob::pm_unicode;
- }
- else if (strcmp(parameter, "auto") == 0)
- {
- o.password_mode = QPDFJob::pm_auto;
- }
- else
- {
- usage("invalid password-mode option");
- }
-}
-
-void
ArgParser::argEnc256AllowInsecure()
{
o.allow_insecure = true;
@@ -454,112 +402,6 @@ ArgParser::argCopyAttachmentsFrom()
}
void
-ArgParser::argStreamData(char* parameter)
-{
- o.stream_data_set = true;
- if (strcmp(parameter, "compress") == 0)
- {
- o.stream_data_mode = qpdf_s_compress;
- }
- else if (strcmp(parameter, "preserve") == 0)
- {
- o.stream_data_mode = qpdf_s_preserve;
- }
- else if (strcmp(parameter, "uncompress") == 0)
- {
- o.stream_data_mode = qpdf_s_uncompress;
- }
- else
- {
- // If this happens, it means streamDataChoices in
- // ArgParser::initOptionTable is wrong.
- usage("invalid stream-data option");
- }
-}
-
-void
-ArgParser::argDecodeLevel(char* parameter)
-{
- o.decode_level_set = true;
- if (strcmp(parameter, "none") == 0)
- {
- o.decode_level = qpdf_dl_none;
- }
- else if (strcmp(parameter, "generalized") == 0)
- {
- o.decode_level = qpdf_dl_generalized;
- }
- else if (strcmp(parameter, "specialized") == 0)
- {
- o.decode_level = qpdf_dl_specialized;
- }
- else if (strcmp(parameter, "all") == 0)
- {
- o.decode_level = qpdf_dl_all;
- }
- else
- {
- // If this happens, it means decodeLevelChoices in
- // ArgParser::initOptionTable is wrong.
- usage("invalid option");
- }
-}
-
-void
-ArgParser::argObjectStreams(char* parameter)
-{
- o.object_stream_set = true;
- if (strcmp(parameter, "disable") == 0)
- {
- o.object_stream_mode = qpdf_o_disable;
- }
- else if (strcmp(parameter, "preserve") == 0)
- {
- o.object_stream_mode = qpdf_o_preserve;
- }
- else if (strcmp(parameter, "generate") == 0)
- {
- o.object_stream_mode = qpdf_o_generate;
- }
- else
- {
- // If this happens, it means objectStreamsChoices in
- // ArgParser::initOptionTable is wrong.
- usage("invalid object stream mode");
- }
-}
-
-void
-ArgParser::argRemoveUnreferencedResources(char* parameter)
-{
- if (strcmp(parameter, "auto") == 0)
- {
- o.remove_unreferenced_page_resources = QPDFJob::re_auto;
- }
- else if (strcmp(parameter, "yes") == 0)
- {
- o.remove_unreferenced_page_resources = QPDFJob::re_yes;
- }
- else if (strcmp(parameter, "no") == 0)
- {
- o.remove_unreferenced_page_resources = QPDFJob::re_no;
- }
- else
- {
- // If this happens, it means remove_unref_choices in
- // ArgParser::initOptionTable is wrong.
- usage("invalid value for --remove-unreferenced-page-resources");
- }
-}
-
-void
-ArgParser::argShowObject(char* parameter)
-{
- QPDFJob::parse_object_id(parameter, o.show_trailer, o.show_obj, o.show_gen);
- o.require_outfile = false;
-}
-
-void
ArgParser::argEnc40Print(char* parameter)
{
o.r2_print = (strcmp(parameter, "y") == 0);
@@ -817,25 +659,6 @@ ArgParser::argEndCopyAttachment()
}
void
-ArgParser::argJobJsonFile(char* parameter)
-{
- PointerHolder<char> file_buf;
- size_t size;
- QUtil::read_file_into_memory(parameter, file_buf, size);
- try
- {
- o.initializeFromJson(std::string(file_buf.getPointer(), size));
- }
- catch (std::exception& e)
- {
- throw std::runtime_error(
- "error with job-json file " + std::string(parameter) + " " +
- e.what() + "\nRun " + this->ap.getProgname() +
- "--job-json-help for information on the file format.");
- }
-}
-
-void
ArgParser::argJobJsonHelp()
{
std::cout << JOB_SCHEMA_DATA << std::endl;
diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc
index c4961fd3..2110f005 100644
--- a/libqpdf/QPDFJob_config.cc
+++ b/libqpdf/QPDFJob_config.cc
@@ -1,7 +1,13 @@
#include <qpdf/QPDFJob.hh>
#include <qpdf/QUtil.hh>
+#include <qpdf/QTC.hh>
#include <cstring>
+static void usage(std::string const& msg)
+{
+ throw QPDFJob::ConfigError(msg);
+}
+
QPDFJob::Config&
QPDFJob::Config::allowWeakCrypto()
{
@@ -497,6 +503,191 @@ QPDFJob::Config::withImages()
return *this;
}
+QPDFJob::Config&
+QPDFJob::Config::passwordFile(char const* parameter)
+{
+ std::list<std::string> lines;
+ if (strcmp(parameter, "-") == 0)
+ {
+ QTC::TC("qpdf", "QPDFJob_config password stdin");
+ lines = QUtil::read_lines_from_file(std::cin);
+ }
+ else
+ {
+ QTC::TC("qpdf", "QPDFJob_config password file");
+ lines = QUtil::read_lines_from_file(parameter);
+ }
+ if (lines.size() >= 1)
+ {
+ o.password = QUtil::make_shared_cstr(lines.front());
+
+ if (lines.size() > 1)
+ {
+ std::cerr << this->o.m->message_prefix
+ << ": WARNING: all but the first line of"
+ << " the password file are ignored" << std::endl;
+ }
+ }
+ return *this;
+}
+
+QPDFJob::Config&
+QPDFJob::Config::passwordMode(char const* parameter)
+{
+ if (strcmp(parameter, "bytes") == 0)
+ {
+ o.password_mode = QPDFJob::pm_bytes;
+ }
+ else if (strcmp(parameter, "hex-bytes") == 0)
+ {
+ o.password_mode = QPDFJob::pm_hex_bytes;
+ }
+ else if (strcmp(parameter, "unicode") == 0)
+ {
+ o.password_mode = QPDFJob::pm_unicode;
+ }
+ else if (strcmp(parameter, "auto") == 0)
+ {
+ o.password_mode = QPDFJob::pm_auto;
+ }
+ else
+ {
+ usage("invalid password-mode option");
+ }
+ return *this;
+}
+
+QPDFJob::Config&
+QPDFJob::Config::streamData(char const* parameter)
+{
+ o.stream_data_set = true;
+ if (strcmp(parameter, "compress") == 0)
+ {
+ o.stream_data_mode = qpdf_s_compress;
+ }
+ else if (strcmp(parameter, "preserve") == 0)
+ {
+ o.stream_data_mode = qpdf_s_preserve;
+ }
+ else if (strcmp(parameter, "uncompress") == 0)
+ {
+ o.stream_data_mode = qpdf_s_uncompress;
+ }
+ else
+ {
+ // If this happens, it means streamDataChoices in
+ // ArgParser::initOptionTable is wrong.
+ usage("invalid stream-data option");
+ }
+ return *this;
+}
+
+QPDFJob::Config&
+QPDFJob::Config::decodeLevel(char const* parameter)
+{
+ o.decode_level_set = true;
+ if (strcmp(parameter, "none") == 0)
+ {
+ o.decode_level = qpdf_dl_none;
+ }
+ else if (strcmp(parameter, "generalized") == 0)
+ {
+ o.decode_level = qpdf_dl_generalized;
+ }
+ else if (strcmp(parameter, "specialized") == 0)
+ {
+ o.decode_level = qpdf_dl_specialized;
+ }
+ else if (strcmp(parameter, "all") == 0)
+ {
+ o.decode_level = qpdf_dl_all;
+ }
+ else
+ {
+ // If this happens, it means decodeLevelChoices in
+ // ArgParser::initOptionTable is wrong.
+ usage("invalid option");
+ }
+ return *this;
+}
+
+QPDFJob::Config&
+QPDFJob::Config::objectStreams(char const* parameter)
+{
+ o.object_stream_set = true;
+ if (strcmp(parameter, "disable") == 0)
+ {
+ o.object_stream_mode = qpdf_o_disable;
+ }
+ else if (strcmp(parameter, "preserve") == 0)
+ {
+ o.object_stream_mode = qpdf_o_preserve;
+ }
+ else if (strcmp(parameter, "generate") == 0)
+ {
+ o.object_stream_mode = qpdf_o_generate;
+ }
+ else
+ {
+ // If this happens, it means objectStreamsChoices in
+ // ArgParser::initOptionTable is wrong.
+ usage("invalid object stream mode");
+ }
+ return *this;
+}
+
+QPDFJob::Config&
+QPDFJob::Config::removeUnreferencedResources(char const* parameter)
+{
+ if (strcmp(parameter, "auto") == 0)
+ {
+ o.remove_unreferenced_page_resources = QPDFJob::re_auto;
+ }
+ else if (strcmp(parameter, "yes") == 0)
+ {
+ o.remove_unreferenced_page_resources = QPDFJob::re_yes;
+ }
+ else if (strcmp(parameter, "no") == 0)
+ {
+ o.remove_unreferenced_page_resources = QPDFJob::re_no;
+ }
+ else
+ {
+ // If this happens, it means remove_unref_choices in
+ // ArgParser::initOptionTable is wrong.
+ usage("invalid value for --remove-unreferenced-page-resources");
+ }
+ return *this;
+}
+
+QPDFJob::Config&
+QPDFJob::Config::showObject(char const* parameter)
+{
+ QPDFJob::parse_object_id(parameter, o.show_trailer, o.show_obj, o.show_gen);
+ o.require_outfile = false;
+ return *this;
+}
+
+QPDFJob::Config&
+QPDFJob::Config::jobJsonFile(char const* parameter)
+{
+ PointerHolder<char> file_buf;
+ size_t size;
+ QUtil::read_file_into_memory(parameter, file_buf, size);
+ try
+ {
+ o.initializeFromJson(std::string(file_buf.getPointer(), size));
+ }
+ catch (std::exception& e)
+ {
+ throw std::runtime_error(
+ "error with job-json file " + std::string(parameter) + " " +
+ e.what() + "\nRun " + this->o.m->message_prefix +
+ "--job-json-help for information on the file format.");
+ }
+ return *this;
+}
+
std::shared_ptr<QPDFJob::CopyAttConfig>
QPDFJob::Config::copyAttachmentsFrom()
{
@@ -534,7 +725,7 @@ QPDFJob::CopyAttConfig::end()
{
if (this->caf.path.empty())
{
- throw QPDFJob::ConfigError("copy attachments: no path specified");
+ usage("copy attachments: no path specified");
}
this->config.o.attachments_to_copy.push_back(this->caf);
return this->config;
@@ -577,8 +768,7 @@ QPDFJob::AttConfig::creationdate(char const* parameter)
{
if (! QUtil::pdf_time_to_qpdf_time(parameter))
{
- throw QPDFJob::ConfigError(
- std::string(parameter) + " is not a valid PDF timestamp");
+ usage(std::string(parameter) + " is not a valid PDF timestamp");
}
this->att.creationdate = parameter;
return *this;
@@ -589,8 +779,7 @@ QPDFJob::AttConfig::moddate(char const* parameter)
{
if (! QUtil::pdf_time_to_qpdf_time(parameter))
{
- throw QPDFJob::ConfigError(
- std::string(parameter) + " is not a valid PDF timestamp");
+ usage(std::string(parameter) + " is not a valid PDF timestamp");
}
this->att.moddate = parameter;
return *this;
@@ -601,8 +790,7 @@ QPDFJob::AttConfig::mimetype(char const* parameter)
{
if (strchr(parameter, '/') == nullptr)
{
- throw QPDFJob::ConfigError(
- "mime type should be specified as type/subtype");
+ usage("mime type should be specified as type/subtype");
}
this->att.mimetype = parameter;
return *this;
@@ -629,13 +817,12 @@ QPDFJob::AttConfig::end()
QUtil::get_current_qpdf_time());
if (this->att.path.empty())
{
- throw QPDFJob::ConfigError("add attachment: no path specified");
+ usage("add attachment: no path specified");
}
std::string last_element = QUtil::path_basename(this->att.path);
if (last_element.empty())
{
- throw QPDFJob::ConfigError(
- "path for --add-attachment may not be empty");
+ usage("path for --add-attachment may not be empty");
}
if (this->att.filename.empty())
{
@@ -674,7 +861,7 @@ QPDFJob::PagesConfig::end()
{
if (this->config.o.page_specs.empty())
{
- throw QPDFJob::ConfigError("--pages: no page specifications given");
+ usage("--pages: no page specifications given");
}
return this->config;
}
diff --git a/libqpdf/qpdf/auto_job_decl.hh b/libqpdf/qpdf/auto_job_decl.hh
index 98e1d6e3..d65df1d9 100644
--- a/libqpdf/qpdf/auto_job_decl.hh
+++ b/libqpdf/qpdf/auto_job_decl.hh
@@ -24,15 +24,7 @@ void argEncrypt();
void argOverlay();
void argPages();
void argUnderlay();
-void argJobJsonFile(char *);
-void argPasswordFile(char *);
void argRotate(char *);
-void argShowObject(char *);
-void argDecodeLevel(char *);
-void argObjectStreams(char *);
-void argPasswordMode(char *);
-void argRemoveUnreferencedResources(char *);
-void argStreamData(char *);
void argPagesPositional(char*);
void argPagesPassword(char *);
void argEndPages();
diff --git a/libqpdf/qpdf/auto_job_init.hh b/libqpdf/qpdf/auto_job_init.hh
index d6bb63f3..bdf9cb0e 100644
--- a/libqpdf/qpdf/auto_job_init.hh
+++ b/libqpdf/qpdf/auto_job_init.hh
@@ -86,7 +86,7 @@ this->ap.addRequiredParameter("copy-encryption", [this](char *x){c_main->copyEnc
this->ap.addRequiredParameter("encryption-file-password", [this](char *x){c_main->encryptionFilePassword(x);}, "password");
this->ap.addRequiredParameter("force-version", [this](char *x){c_main->forceVersion(x);}, "version");
this->ap.addRequiredParameter("ii-min-bytes", [this](char *x){c_main->iiMinBytes(x);}, "minimum");
-this->ap.addRequiredParameter("job-json-file", p(&ArgParser::argJobJsonFile), "file");
+this->ap.addRequiredParameter("job-json-file", [this](char *x){c_main->jobJsonFile(x);}, "file");
this->ap.addRequiredParameter("json-object", [this](char *x){c_main->jsonObject(x);}, "trailer");
this->ap.addRequiredParameter("keep-files-open-threshold", [this](char *x){c_main->keepFilesOpenThreshold(x);}, "count");
this->ap.addRequiredParameter("linearize-pass1", [this](char *x){c_main->linearizePass1(x);}, "filename");
@@ -95,21 +95,21 @@ this->ap.addRequiredParameter("oi-min-area", [this](char *x){c_main->oiMinArea(x
this->ap.addRequiredParameter("oi-min-height", [this](char *x){c_main->oiMinHeight(x);}, "minimum");
this->ap.addRequiredParameter("oi-min-width", [this](char *x){c_main->oiMinWidth(x);}, "minimum");
this->ap.addRequiredParameter("password", [this](char *x){c_main->password(x);}, "password");
-this->ap.addRequiredParameter("password-file", p(&ArgParser::argPasswordFile), "password");
+this->ap.addRequiredParameter("password-file", [this](char *x){c_main->passwordFile(x);}, "password");
this->ap.addRequiredParameter("remove-attachment", [this](char *x){c_main->removeAttachment(x);}, "attachment");
this->ap.addRequiredParameter("rotate", p(&ArgParser::argRotate), "[+|-]angle");
this->ap.addRequiredParameter("show-attachment", [this](char *x){c_main->showAttachment(x);}, "attachment");
-this->ap.addRequiredParameter("show-object", p(&ArgParser::argShowObject), "trailer");
+this->ap.addRequiredParameter("show-object", [this](char *x){c_main->showObject(x);}, "trailer");
this->ap.addChoices("compress-streams", [this](char *x){c_main->compressStreams(x);}, true, yn_choices);
-this->ap.addChoices("decode-level", p(&ArgParser::argDecodeLevel), true, decode_level_choices);
+this->ap.addChoices("decode-level", [this](char *x){c_main->decodeLevel(x);}, true, decode_level_choices);
this->ap.addChoices("flatten-annotations", [this](char *x){c_main->flattenAnnotations(x);}, true, flatten_choices);
this->ap.addChoices("json-key", [this](char *x){c_main->jsonKey(x);}, true, json_key_choices);
this->ap.addChoices("keep-files-open", [this](char *x){c_main->keepFilesOpen(x);}, true, yn_choices);
this->ap.addChoices("normalize-content", [this](char *x){c_main->normalizeContent(x);}, true, yn_choices);
-this->ap.addChoices("object-streams", p(&ArgParser::argObjectStreams), true, object_streams_choices);
-this->ap.addChoices("password-mode", p(&ArgParser::argPasswordMode), true, password_mode_choices);
-this->ap.addChoices("remove-unreferenced-resources", p(&ArgParser::argRemoveUnreferencedResources), true, remove_unref_choices);
-this->ap.addChoices("stream-data", p(&ArgParser::argStreamData), true, stream_data_choices);
+this->ap.addChoices("object-streams", [this](char *x){c_main->objectStreams(x);}, true, object_streams_choices);
+this->ap.addChoices("password-mode", [this](char *x){c_main->passwordMode(x);}, true, password_mode_choices);
+this->ap.addChoices("remove-unreferenced-resources", [this](char *x){c_main->removeUnreferencedResources(x);}, true, remove_unref_choices);
+this->ap.addChoices("stream-data", [this](char *x){c_main->streamData(x);}, true, stream_data_choices);
this->ap.registerOptionTable("pages", b(&ArgParser::argEndPages));
this->ap.addPositional(p(&ArgParser::argPagesPositional));
this->ap.addRequiredParameter("password", p(&ArgParser::argPagesPassword), "password");
diff --git a/qpdf/qpdf.testcov b/qpdf/qpdf.testcov
index 4b273c0a..f3936bd4 100644
--- a/qpdf/qpdf.testcov
+++ b/qpdf/qpdf.testcov
@@ -567,8 +567,6 @@ NNTree erased last item in tree 0
NNTree remove limits from root 0
QPDFPageObjectHelper unresolved names 0
QPDFPageObjectHelper resolving unresolved 0
-qpdf password stdin 0
-qpdf password file 0
QPDFFileSpecObjectHelper empty compat_name 0
QPDFFileSpecObjectHelper non-empty compat_name 0
QPDFPageObjectHelper flatten inherit rotate 0
@@ -630,3 +628,5 @@ qpdf check encrypted not encrypted 0
qpdf check password password incorrect 0
qpdf check password password correct 0
qpdf check password not encrypted 0
+QPDFJob_config password file 0
+QPDFJob_config password stdin 0