diff --git a/generate_auto_job b/generate_auto_job index 4adac176..7c86a22c 100755 --- a/generate_auto_job +++ b/generate_auto_job @@ -68,7 +68,6 @@ not_yet = set([ 'modify', 'modify-other', 'object-streams', - 'password', 'password-file', 'password-mode', 'print', diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh index a4be63e9..388d5536 100644 --- a/include/qpdf/QPDFJob.hh +++ b/include/qpdf/QPDFJob.hh @@ -178,6 +178,7 @@ class QPDFJob QPDF_DLL Config& oiMinHeight(char const* parameter); QPDF_DLL Config& oiMinWidth(char const* parameter); QPDF_DLL Config& optimizeImages(); + QPDF_DLL Config& password(char const* parameter); QPDF_DLL Config& passwordIsHexKey(); QPDF_DLL Config& preserveUnreferenced(); QPDF_DLL Config& preserveUnreferencedResources(); diff --git a/job.sums b/job.sums index eddd8750..02ae8bf4 100644 --- a/job.sums +++ b/job.sums @@ -1,9 +1,9 @@ # Generated by generate_auto_job -generate_auto_job 8e2c467c47a66caef46497d96be461e7373e22124abe1bde3ef353bd99452609 +generate_auto_job e18ae51cee2838fe44c37237a344fb48abe7a6d3f9cfa745d2f1dbc9c294e7b7 job.yml 55d272cca0657e1f96ca92f5253edb6c6e24e6ea19e37690446d2111adc13f91 -libqpdf/qpdf/auto_job_decl.hh ff9bbeec974f6a7e6ed2ba205e3d7f81fbe4f6224860a9ba37c30b817b951a90 +libqpdf/qpdf/auto_job_decl.hh e9844137bf53345f2c6973378b314a2510ebce83ac8ceb378588cd6afdd87c06 libqpdf/qpdf/auto_job_help.hh 383eea80e2c185ef5295fc126246457a7ceeffea759fdb90bb2e6727532ea538 -libqpdf/qpdf/auto_job_init.hh 45e3d28708c7506a681477a7865fa39dcd10e93819875a8d5664d6629f6e5245 +libqpdf/qpdf/auto_job_init.hh e65119793c329630aa243ff20907443f8eaf54c29d02737a598f29bba64b0bf5 libqpdf/qpdf/auto_job_schema.hh c91a4e182e088797b70dda94af03ca32d360f3564890132da2a8bdc3c4432423 manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d manual/cli.rst 68122ff8179c10df3fe6d577adde4973c346f7866ba9a511bab5a6e6f292a6f1 diff --git a/libqpdf/QPDFJob_argv.cc b/libqpdf/QPDFJob_argv.cc index 9a78018e..af7ce13f 100644 --- a/libqpdf/QPDFJob_argv.cc +++ b/libqpdf/QPDFJob_argv.cc @@ -185,12 +185,6 @@ ArgParser::argShowCrypto() } } -void -ArgParser::argPassword(char* parameter) -{ - o.password = QUtil::make_shared_cstr(parameter); -} - void ArgParser::argPasswordFile(char* parameter) { @@ -894,13 +888,6 @@ ArgParser::argCopyAttPositional(char* arg) c_copy_att->filename(arg); } -void -ArgParser::argCopyAttPassword(char* parameter) -{ - // QXXXQ @TRIVIAL - c_copy_att->password(parameter); -} - void ArgParser::argEndCopyAttachment() { diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc index 923d9302..34f15b9f 100644 --- a/libqpdf/QPDFJob_config.cc +++ b/libqpdf/QPDFJob_config.cc @@ -298,6 +298,13 @@ QPDFJob::Config::optimizeImages() return *this; } +QPDFJob::Config& +QPDFJob::Config::password(char const* parameter) +{ + o.password = QUtil::make_shared_cstr(parameter); + return *this; +} + QPDFJob::Config& QPDFJob::Config::passwordIsHexKey() { @@ -527,6 +534,8 @@ QPDFJob::CopyAttConfig::end() { if (this->caf.path.empty()) { + // QXXXQ usage, json, and config exceptions need to be unified + // in some fashion. throw std::runtime_error("copy attachments: no path specified"); } this->config.o.attachments_to_copy.push_back(this->caf); diff --git a/libqpdf/qpdf/auto_job_decl.hh b/libqpdf/qpdf/auto_job_decl.hh index 8718c3e4..1ea25372 100644 --- a/libqpdf/qpdf/auto_job_decl.hh +++ b/libqpdf/qpdf/auto_job_decl.hh @@ -25,7 +25,6 @@ void argOverlay(); void argPages(); void argUnderlay(); void argJobJsonFile(char *); -void argPassword(char *); void argPasswordFile(char *); void argRotate(char *); void argShowObject(char *); @@ -75,5 +74,4 @@ void argAttMimetype(char *); void argAttDescription(char *); void argEndAttachment(); void argCopyAttPositional(char*); -void argCopyAttPassword(char *); void argEndCopyAttachment(); diff --git a/libqpdf/qpdf/auto_job_init.hh b/libqpdf/qpdf/auto_job_init.hh index cba6347d..7ceff2ae 100644 --- a/libqpdf/qpdf/auto_job_init.hh +++ b/libqpdf/qpdf/auto_job_init.hh @@ -94,7 +94,7 @@ this->ap.addRequiredParameter("min-version", [this](char *x){c_main->minVersion( this->ap.addRequiredParameter("oi-min-area", [this](char *x){c_main->oiMinArea(x);}, "minimum"); 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", p(&ArgParser::argPassword), "password"); +this->ap.addRequiredParameter("password", [this](char *x){c_main->password(x);}, "password"); this->ap.addRequiredParameter("password-file", p(&ArgParser::argPasswordFile), "password"); this->ap.addRequiredParameter("remove-attachment", [this](char *x){c_main->removeAttachment(x);}, "attachment"); this->ap.addRequiredParameter("rotate", p(&ArgParser::argRotate), "[+|-]angle"); @@ -153,7 +153,7 @@ this->ap.addRequiredParameter("description", p(&ArgParser::argAttDescription), " this->ap.registerOptionTable("copy attachment", b(&ArgParser::argEndCopyAttachment)); this->ap.addPositional(p(&ArgParser::argCopyAttPositional)); this->ap.addRequiredParameter("prefix", [this](char *x){c_copy_att->prefix(x);}, "prefix"); -this->ap.addRequiredParameter("password", p(&ArgParser::argCopyAttPassword), "password"); +this->ap.addRequiredParameter("password", [this](char *x){c_copy_att->password(x);}, "password"); this->ap.selectOptionTable("256-bit encryption"); this->ap.copyFromOtherTable("cleartext-metadata", "128-bit encryption"); this->ap.copyFromOtherTable("accessibility", "128-bit encryption");