QPDFJob: convert password in two tables

This commit is contained in:
Jay Berkenbilt 2022-01-25 11:14:43 -05:00
parent 21c897aad0
commit bf255ccc89
7 changed files with 15 additions and 21 deletions

View File

@ -68,7 +68,6 @@ not_yet = set([
'modify',
'modify-other',
'object-streams',
'password',
'password-file',
'password-mode',
'print',

View File

@ -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();

View File

@ -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

View File

@ -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()
{

View File

@ -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);

View File

@ -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();

View File

@ -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");