aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2024-01-09 19:25:04 +0100
committerJay Berkenbilt <ejb@ql.org>2024-01-10 22:44:46 +0100
commit9c723aeb56351e20203f0c0058e5f718f44dee22 (patch)
treeb726038f3a8ce4fb3a7a10d988dc40f8dfe37626 /libqpdf
parent34f013c1be56abac1104812938eb0af568df99e1 (diff)
downloadqpdf-9c723aeb56351e20203f0c0058e5f718f44dee22.tar.zst
Allow --file with --overlay and --underlay
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFJob_json.cc6
-rw-r--r--libqpdf/qpdf/auto_job_help.hh2
-rw-r--r--libqpdf/qpdf/auto_job_init.hh1
-rw-r--r--libqpdf/qpdf/auto_job_json_decl.hh1
-rw-r--r--libqpdf/qpdf/auto_job_json_init.hh2
-rw-r--r--libqpdf/qpdf/auto_job_schema.hh4
6 files changed, 12 insertions, 4 deletions
diff --git a/libqpdf/QPDFJob_json.cc b/libqpdf/QPDFJob_json.cc
index 5565ea93..797ee81d 100644
--- a/libqpdf/QPDFJob_json.cc
+++ b/libqpdf/QPDFJob_json.cc
@@ -487,6 +487,12 @@ Handlers::endPages()
}
void
+Handlers::setupPagesFile()
+{
+ addParameter([this](char const* p) { c_pages->file(p); });
+}
+
+void
Handlers::setupPagesPassword()
{
addParameter([this](char const* p) { c_pages->password(p); });
diff --git a/libqpdf/qpdf/auto_job_help.hh b/libqpdf/qpdf/auto_job_help.hh
index a3572aed..903bdd56 100644
--- a/libqpdf/qpdf/auto_job_help.hh
+++ b/libqpdf/qpdf/auto_job_help.hh
@@ -695,7 +695,7 @@ underlaid on the primary output. Overlaid pages are drawn on top of
the destination page and may obscure the page. Underlaid pages are
drawn below the destination page. Usage:
-{--overlay|--underlay} file
+{--overlay|--underlay} [--file=]file
[--password=password]
[--to=page-range]
[--from=[page-range]]
diff --git a/libqpdf/qpdf/auto_job_init.hh b/libqpdf/qpdf/auto_job_init.hh
index 401406db..ac42ea6a 100644
--- a/libqpdf/qpdf/auto_job_init.hh
+++ b/libqpdf/qpdf/auto_job_init.hh
@@ -166,6 +166,7 @@ this->ap.addChoices("modify-other", [this](std::string const& x){c_enc->modifyOt
this->ap.addChoices("modify", [this](std::string const& x){c_enc->modify(x);}, true, modify128_choices);
this->ap.registerOptionTable("underlay/overlay", b(&ArgParser::argEndUnderlayOverlay));
this->ap.addPositional(p(&ArgParser::argUOPositional));
+this->ap.addRequiredParameter("file", [this](std::string const& x){c_uo->file(x);}, "file");
this->ap.addRequiredParameter("to", [this](std::string const& x){c_uo->to(x);}, "page-range");
this->ap.addRequiredParameter("from", [this](std::string const& x){c_uo->from(x);}, "page-range");
this->ap.addRequiredParameter("repeat", [this](std::string const& x){c_uo->repeat(x);}, "page-range");
diff --git a/libqpdf/qpdf/auto_job_json_decl.hh b/libqpdf/qpdf/auto_job_json_decl.hh
index b2ae4c1e..d7cb9595 100644
--- a/libqpdf/qpdf/auto_job_json_decl.hh
+++ b/libqpdf/qpdf/auto_job_json_decl.hh
@@ -41,6 +41,7 @@ void beginPagesArray(JSON);
void endPagesArray();
void beginPages(JSON);
void endPages();
+void setupPagesFile();
void setupPagesPassword();
void beginSetPageLabelsArray(JSON);
void endSetPageLabelsArray();
diff --git a/libqpdf/qpdf/auto_job_json_init.hh b/libqpdf/qpdf/auto_job_json_init.hh
index fb4d93b9..aaa1fb64 100644
--- a/libqpdf/qpdf/auto_job_json_init.hh
+++ b/libqpdf/qpdf/auto_job_json_init.hh
@@ -402,7 +402,7 @@ pushKey("pages");
beginArray(bindJSON(&Handlers::beginPagesArray), bindBare(&Handlers::endPagesArray)); // .pages[]
beginDict(bindJSON(&Handlers::beginPages), bindBare(&Handlers::endPages)); // .pages
pushKey("file");
-addParameter([this](std::string const& p) { c_pages->file(p); });
+setupPagesFile();
popHandler(); // key: file
pushKey("password");
setupPagesPassword();
diff --git a/libqpdf/qpdf/auto_job_schema.hh b/libqpdf/qpdf/auto_job_schema.hh
index bb4b04ea..507a54a4 100644
--- a/libqpdf/qpdf/auto_job_schema.hh
+++ b/libqpdf/qpdf/auto_job_schema.hh
@@ -152,14 +152,14 @@ static constexpr char const* JOB_SCHEMA_DATA = R"({
"number pages for the entire document"
],
"overlay": {
- "file": "source file for overlay",
+ "file": "source for pages",
"password": "password for encrypted file",
"from": "source pages for underlay/overlay",
"repeat": "overlay/underlay pages to repeat",
"to": "destination pages for underlay/overlay"
},
"underlay": {
- "file": "source file for underlay",
+ "file": "source for pages",
"password": "password for encrypted file",
"from": "source pages for underlay/overlay",
"repeat": "overlay/underlay pages to repeat",