2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

QPDFJob: incorporate change to JSONHandler for dict start function

This commit is contained in:
Jay Berkenbilt 2022-01-30 08:04:45 -05:00
parent ce3406e93f
commit e01bbccb40
7 changed files with 124 additions and 115 deletions

View File

@ -516,11 +516,11 @@ class Main:
def build_schema(j, s, flag, path):
if flag:
identifier = self.to_identifier(path, '', False)
self.json_decls.append(f'void begin{identifier}();')
self.json_decls.append(f'void begin{identifier}(JSON);')
self.json_decls.append(f'void end{identifier}();')
self.json_init.append(
f'beginDict("{flag}",'
f' bindBare(&Handlers::begin{identifier}),'
f' bindJSON(&Handlers::begin{identifier}),'
f' bindBare(&Handlers::end{identifier})); // {path}')
for k, v in j.items():
is_trivial = False

View File

@ -1,17 +1,17 @@
# Generated by generate_auto_job
generate_auto_job 53b2b81e8cb38f1bfa0053f351f37fe9e9437eb2cef808ff0c01cfc56ca20946
generate_auto_job e4a071599697cc0f4d985367735ac6ed6110575e2cbfa01406d048780466d546
include/qpdf/auto_job_c_att.hh 7ad43bb374c1370ef32ebdcdcb7b73a61d281f7f4e3f12755585872ab30fb60e
include/qpdf/auto_job_c_copy_att.hh 32275d03cdc69b703dd7e02ba0bbe15756e714e9ad185484773a6178dc09e1ee
include/qpdf/auto_job_c_enc.hh 72e138c7b96ed5aacdce78c1dec04b1c20d361faec4f8faf52f64c1d6be99265
include/qpdf/auto_job_c_main.hh 516adb23cc7e44e614e436880be870d0574e4ebbc706cd855a1360000eed31bb
include/qpdf/auto_job_c_pages.hh 931840b329a36ca0e41401190e04537b47f2867671a6643bfd8da74014202671
include/qpdf/auto_job_c_uo.hh 0585b7de459fa479d9e51a45fa92de0ff6dee748efc9ec1cedd0dde6cee1ad50
job.yml d9be74c397e1f272ac6a81981a528c332f8bd7b98d58ae6ba6f60875391567e8
job.yml 7433861fa281197aa275d624a334aa324ec63839c5e56a24448ab64d0b75587c
libqpdf/qpdf/auto_job_decl.hh 9f79396ec459f191be4c5fe34cf88c265cf47355a1a945fa39169d1c94cf04f6
libqpdf/qpdf/auto_job_help.hh 23c79f1d2c02bda28f64aace17f69487205c797e7ae2234892cbbabab49d6d47
libqpdf/qpdf/auto_job_init.hh 8e9e31b6099a662497339b27f6e2d7f779f35011e88a834bee8811c33405a0fe
libqpdf/qpdf/auto_job_json_decl.hh d729213332b92ee0da89d1cad0318ab96aec443f37d208fbbc8d56e9d1398ac2
libqpdf/qpdf/auto_job_json_init.hh a28c2c2b83d1c0036d3d07172dffb1eac1b75ce3d6a615a87111e9f3bd3dad58
libqpdf/qpdf/auto_job_schema.hh 9962f09f3260c01d4165a6ddf2814a0621395dcb5d80a3d310f580a1b7d3baba
libqpdf/qpdf/auto_job_json_decl.hh d315f920a32d7a5a2272807e6813d463c3e1877a9d735e44e8417b5f1461b87a
libqpdf/qpdf/auto_job_json_init.hh 08e6ee8a509bc592e3aa6f7a1d3a6d18cdf4803e6220147855caf675e0a299ce
libqpdf/qpdf/auto_job_schema.hh 6ec5b9dd3b4709b49fb3b928c4d9cde8b35ad938a0945f81c9a3da6c3bf9a3c1
manual/_ext/qpdf.py e9ac9d6c70642a3d29281ee5ad92ae2422dee8be9306fb8a0bc9dba0ed5e28f3
manual/cli.rst 79140e023faa0cb77afe0b1dc512dd120ee5617f4db82f842596e4f239f93882

21
job.yml
View File

@ -249,16 +249,20 @@ json:
# QPDFJob looks like. If a key starts with underscore or has a value
# that is a string, it does not map to a command-line argument. If
# value is null, its properties and help come from other information
# known by generate_auto_job. This information is used to construct
# a "schema" (as in JSON.hh) for the json input to QPDFJob. The
# leading underscore is removed.
# known by generate_auto_job. Otherwise, it has to match a
# command-line option. This information is used to construct a
# "schema" (as in JSON.hh) for the json input to QPDFJob. The
# leading underscore is removed. *NOTE*: all keys are converted to
# camelCase for the schema and must be appear that way in the
# user-supplied json. This makes it more convenient to populate JSON
# objects in some languages.
_input:
_fileName: "input filename"
_filename: "input filename"
main.password:
password-file:
empty:
_output:
_fileName: "output filename"
_filename: "output filename"
_replace-input: "set to true to replace input"
_options:
qdf:
@ -283,15 +287,14 @@ json:
progress:
split-pages:
encrypt:
key-length: "key length: 48, 128, 256"
user-password: "user password"
owner-password: "owner password"
_40-bit:
_40bit:
Enc40.annotate:
Enc40.extract:
Enc40.modify:
Enc40.print:
_128-bit:
_128bit:
Enc128.accessibility:
Enc128.annotate:
Enc128.assemble:
@ -303,7 +306,7 @@ json:
Enc128.print:
force-V4:
use-aes:
_256-bit:
_256bit:
Enc256.accessibility:
Enc256.annotate:
Enc256.assemble:

View File

@ -1,6 +1,7 @@
#include <qpdf/QPDFJob.hh>
#include <qpdf/JSONHandler.hh>
#include <qpdf/QPDFUsage.hh>
#include <qpdf/QUtil.hh>
#include <memory>
#include <stdexcept>
@ -25,6 +26,7 @@ namespace
typedef std::function<void()> bare_handler_t;
typedef std::function<void(char const*)> param_handler_t;
typedef std::function<void(JSON)> json_handler_t;
typedef std::function<void(std::string const& key)> setup_handler_t;
void addBare(std::string const& key, bare_handler_t);
@ -33,11 +35,12 @@ namespace
param_handler_t);
void doSetup(std::string const& key, setup_handler_t);
void beginDict(std::string const& key,
bare_handler_t start_fn,
json_handler_t start_fn,
bare_handler_t end_fn);
void endDict();
bare_handler_t bindBare(void (Handlers::*f)());
json_handler_t bindJSON(void (Handlers::*f)(JSON));
setup_handler_t bindSetup(void (Handlers::*f)(std::string const&));
std::list<std::shared_ptr<JSONHandler>> json_handlers;
@ -70,6 +73,12 @@ Handlers::bindBare(void (Handlers::*f)())
return std::bind(std::mem_fn(f), this);
}
Handlers::json_handler_t
Handlers::bindJSON(void (Handlers::*f)(JSON))
{
return std::bind(std::mem_fn(f), this, std::placeholders::_1);
}
Handlers::setup_handler_t
Handlers::bindSetup(void (Handlers::*f)(std::string const&))
{
@ -82,7 +91,7 @@ Handlers::initHandlers()
this->json_handlers.push_back(std::make_shared<JSONHandler>());
this->jh = this->json_handlers.back().get();
jh->addDictHandlers(
[](std::string const&){},
[](std::string const&, JSON){},
[this](std::string const&){c_main->checkConfiguration();});
# include <qpdf/auto_job_json_init.hh>
@ -172,12 +181,12 @@ Handlers::doSetup(std::string const& key, setup_handler_t fn)
void
Handlers::beginDict(std::string const& key,
bare_handler_t start_fn,
json_handler_t start_fn,
bare_handler_t end_fn)
{
auto new_jh = std::make_shared<JSONHandler>();
new_jh->addDictHandlers(
[start_fn](std::string const&){ start_fn(); },
[start_fn](std::string const&, JSON j){ start_fn(j); },
[end_fn](std::string const&){ end_fn(); });
this->jh->addDictKeyHandler(key, new_jh);
this->json_handlers.push_back(new_jh);
@ -198,7 +207,7 @@ Handlers::handle(JSON& j)
}
void
Handlers::beginInput()
Handlers::beginInput(JSON)
{
// nothing needed
}
@ -210,7 +219,7 @@ Handlers::endInput()
}
void
Handlers::setupInputFileName(std::string const& key)
Handlers::setupInputFilename(std::string const& key)
{
addParameter(key, [this](char const* p) {
c_main->inputFile(p);
@ -232,7 +241,7 @@ Handlers::setupInputEmpty(std::string const& key)
}
void
Handlers::beginOutput()
Handlers::beginOutput(JSON)
{
// nothing needed
}
@ -244,7 +253,7 @@ Handlers::endOutput()
}
void
Handlers::setupOutputFileName(std::string const& key)
Handlers::setupOutputFilename(std::string const& key)
{
addParameter(key, [this](char const* p) {
c_main->outputFile(p);
@ -260,7 +269,7 @@ Handlers::setupOutputReplaceInput(std::string const& key)
}
void
Handlers::beginOutputOptions()
Handlers::beginOutputOptions(JSON)
{
// nothing needed
}
@ -272,9 +281,15 @@ Handlers::endOutputOptions()
}
void
Handlers::beginOutputOptionsEncrypt()
Handlers::beginOutputOptionsEncrypt(JSON)
{
// QXXXQ
// if (this->keylen_seen == 0)
// {
// usage("exactly one of 40bit, 128bit, or 256bit must be given;"
// " an empty dictionary may be supplied for one of them"
// " to set the key length without imposing any restrictions");
// }
}
void
@ -283,62 +298,56 @@ Handlers::endOutputOptionsEncrypt()
// QXXXQ
}
void
Handlers::setupOutputOptionsEncryptKeyLength(std::string const& key)
{
// QXXXQ
}
void
Handlers::setupOutputOptionsEncryptUserPassword(std::string const& key)
{
// QXXXQ
// Key handled in beginOutputOptionsEncrypt
}
void
Handlers::setupOutputOptionsEncryptOwnerPassword(std::string const& key)
{
// QXXXQ
// Key handled in beginOutputOptionsEncrypt
}
void
Handlers::beginOutputOptionsEncrypt40Bit()
Handlers::beginOutputOptionsEncrypt40bit(JSON)
{
// QXXXQ
// nothing needed
}
void
Handlers::endOutputOptionsEncrypt40Bit()
Handlers::endOutputOptionsEncrypt40bit()
{
// QXXXQ
// nothing needed
}
void
Handlers::beginOutputOptionsEncrypt128Bit()
Handlers::beginOutputOptionsEncrypt128bit(JSON)
{
// QXXXQ
// nothing needed
}
void
Handlers::endOutputOptionsEncrypt128Bit()
Handlers::endOutputOptionsEncrypt128bit()
{
// QXXXQ
// nothing needed
}
void
Handlers::beginOutputOptionsEncrypt256Bit()
Handlers::beginOutputOptionsEncrypt256bit(JSON)
{
// QXXXQ
// nothing needed
}
void
Handlers::endOutputOptionsEncrypt256Bit()
Handlers::endOutputOptionsEncrypt256bit()
{
// QXXXQ
// nothing needed
}
void
Handlers::beginOptions()
Handlers::beginOptions(JSON)
{
// nothing needed
}
@ -350,7 +359,7 @@ Handlers::endOptions()
}
void
Handlers::beginInspect()
Handlers::beginInspect(JSON)
{
// nothing needed
}
@ -362,7 +371,7 @@ Handlers::endInspect()
}
void
Handlers::beginTransform()
Handlers::beginTransform(JSON)
{
// nothing needed
}
@ -374,7 +383,7 @@ Handlers::endTransform()
}
void
Handlers::beginModify()
Handlers::beginModify(JSON)
{
// nothing needed
}
@ -386,7 +395,7 @@ Handlers::endModify()
}
void
Handlers::beginModifyAddAttachment()
Handlers::beginModifyAddAttachment(JSON)
{
// QXXXQ
}
@ -400,11 +409,11 @@ Handlers::endModifyAddAttachment()
void
Handlers::setupModifyAddAttachmentPath(std::string const& key)
{
// QXXXQ
// QXXXQ setup
}
void
Handlers::beginModifyCopyAttachmentsFrom()
Handlers::beginModifyCopyAttachmentsFrom(JSON)
{
// QXXXQ
}
@ -418,17 +427,17 @@ Handlers::endModifyCopyAttachmentsFrom()
void
Handlers::setupModifyCopyAttachmentsFromPath(std::string const& key)
{
// QXXXQ
// QXXXQ setup
}
void
Handlers::setupModifyCopyAttachmentsFromPassword(std::string const& key)
{
// QXXXQ
// QXXXQ setup
}
void
Handlers::beginModifyPages()
Handlers::beginModifyPages(JSON)
{
// QXXXQ
}
@ -442,23 +451,23 @@ Handlers::endModifyPages()
void
Handlers::setupModifyPagesFile(std::string const& key)
{
// QXXXQ
// QXXXQ setup
}
void
Handlers::setupModifyPagesPassword(std::string const& key)
{
// QXXXQ
// QXXXQ setup
}
void
Handlers::setupModifyPagesRange(std::string const& key)
{
// QXXXQ
// QXXXQ setup
}
void
Handlers::beginModifyOverlay()
Handlers::beginModifyOverlay(JSON)
{
// QXXXQ
}
@ -472,17 +481,17 @@ Handlers::endModifyOverlay()
void
Handlers::setupModifyOverlayFile(std::string const& key)
{
// QXXXQ
// QXXXQ setup
}
void
Handlers::setupModifyOverlayPassword(std::string const& key)
{
// QXXXQ
// QXXXQ setup
}
void
Handlers::beginModifyUnderlay()
Handlers::beginModifyUnderlay(JSON)
{
// QXXXQ
}
@ -496,13 +505,13 @@ Handlers::endModifyUnderlay()
void
Handlers::setupModifyUnderlayFile(std::string const& key)
{
// QXXXQ
// QXXXQ setup
}
void
Handlers::setupModifyUnderlayPassword(std::string const& key)
{
// QXXXQ
// QXXXQ setup
}
void

View File

@ -3,53 +3,52 @@
// Edits will be automatically overwritten if the build is
// run in maintainer mode.
//
void beginInput();
void beginInput(JSON);
void endInput();
void setupInputFileName(std::string const&);
void setupInputFilename(std::string const&);
void setupInputPassword(std::string const&);
void setupInputEmpty(std::string const&);
void beginOutput();
void beginOutput(JSON);
void endOutput();
void setupOutputFileName(std::string const&);
void setupOutputFilename(std::string const&);
void setupOutputReplaceInput(std::string const&);
void beginOutputOptions();
void beginOutputOptions(JSON);
void endOutputOptions();
void beginOutputOptionsEncrypt();
void beginOutputOptionsEncrypt(JSON);
void endOutputOptionsEncrypt();
void setupOutputOptionsEncryptKeyLength(std::string const&);
void setupOutputOptionsEncryptUserPassword(std::string const&);
void setupOutputOptionsEncryptOwnerPassword(std::string const&);
void beginOutputOptionsEncrypt40Bit();
void endOutputOptionsEncrypt40Bit();
void beginOutputOptionsEncrypt128Bit();
void endOutputOptionsEncrypt128Bit();
void beginOutputOptionsEncrypt256Bit();
void endOutputOptionsEncrypt256Bit();
void beginOptions();
void beginOutputOptionsEncrypt40bit(JSON);
void endOutputOptionsEncrypt40bit();
void beginOutputOptionsEncrypt128bit(JSON);
void endOutputOptionsEncrypt128bit();
void beginOutputOptionsEncrypt256bit(JSON);
void endOutputOptionsEncrypt256bit();
void beginOptions(JSON);
void endOptions();
void beginInspect();
void beginInspect(JSON);
void endInspect();
void beginTransform();
void beginTransform(JSON);
void endTransform();
void beginModify();
void beginModify(JSON);
void endModify();
void beginModifyAddAttachment();
void beginModifyAddAttachment(JSON);
void endModifyAddAttachment();
void setupModifyAddAttachmentPath(std::string const&);
void beginModifyCopyAttachmentsFrom();
void beginModifyCopyAttachmentsFrom(JSON);
void endModifyCopyAttachmentsFrom();
void setupModifyCopyAttachmentsFromPath(std::string const&);
void setupModifyCopyAttachmentsFromPassword(std::string const&);
void beginModifyPages();
void beginModifyPages(JSON);
void endModifyPages();
void setupModifyPagesFile(std::string const&);
void setupModifyPagesPassword(std::string const&);
void setupModifyPagesRange(std::string const&);
void beginModifyOverlay();
void beginModifyOverlay(JSON);
void endModifyOverlay();
void setupModifyOverlayFile(std::string const&);
void setupModifyOverlayPassword(std::string const&);
void beginModifyUnderlay();
void beginModifyUnderlay(JSON);
void endModifyUnderlay();
void setupModifyUnderlayFile(std::string const&);
void setupModifyUnderlayPassword(std::string const&);

View File

@ -14,16 +14,16 @@ static char const* json_key_choices[] = {"acroform", "attachments", "encrypt", "
static char const* print128_choices[] = {"full", "low", "none", 0};
static char const* modify128_choices[] = {"all", "annotate", "form", "assembly", "none", 0};
beginDict("input", bindBare(&Handlers::beginInput), bindBare(&Handlers::endInput)); // .input
doSetup("fileName", bindSetup(&Handlers::setupInputFileName));
beginDict("input", bindJSON(&Handlers::beginInput), bindBare(&Handlers::endInput)); // .input
doSetup("filename", bindSetup(&Handlers::setupInputFilename));
doSetup("password", bindSetup(&Handlers::setupInputPassword));
addParameter("passwordFile", [this](char const* p) { c_main->passwordFile(p); });
doSetup("empty", bindSetup(&Handlers::setupInputEmpty));
endDict(); // .input
beginDict("output", bindBare(&Handlers::beginOutput), bindBare(&Handlers::endOutput)); // .output
doSetup("fileName", bindSetup(&Handlers::setupOutputFileName));
beginDict("output", bindJSON(&Handlers::beginOutput), bindBare(&Handlers::endOutput)); // .output
doSetup("filename", bindSetup(&Handlers::setupOutputFilename));
doSetup("replaceInput", bindSetup(&Handlers::setupOutputReplaceInput));
beginDict("options", bindBare(&Handlers::beginOutputOptions), bindBare(&Handlers::endOutputOptions)); // .output.options
beginDict("options", bindJSON(&Handlers::beginOutputOptions), bindBare(&Handlers::endOutputOptions)); // .output.options
addBare("qdf", [this]() { c_main->qdf(); });
addBare("preserveUnreferenced", [this]() { c_main->preserveUnreferenced(); });
addBare("newlineBeforeEndstream", [this]() { c_main->newlineBeforeEndstream(); });
@ -45,17 +45,16 @@ addParameter("minVersion", [this](char const* p) { c_main->minVersion(p); });
addParameter("forceVersion", [this](char const* p) { c_main->forceVersion(p); });
addBare("progress", [this]() { c_main->progress(); });
addParameter("splitPages", [this](char const* p) { c_main->splitPages(p); });
beginDict("encrypt", bindBare(&Handlers::beginOutputOptionsEncrypt), bindBare(&Handlers::endOutputOptionsEncrypt)); // .output.options.encrypt
doSetup("keyLength", bindSetup(&Handlers::setupOutputOptionsEncryptKeyLength));
beginDict("encrypt", bindJSON(&Handlers::beginOutputOptionsEncrypt), bindBare(&Handlers::endOutputOptionsEncrypt)); // .output.options.encrypt
doSetup("userPassword", bindSetup(&Handlers::setupOutputOptionsEncryptUserPassword));
doSetup("ownerPassword", bindSetup(&Handlers::setupOutputOptionsEncryptOwnerPassword));
beginDict("40Bit", bindBare(&Handlers::beginOutputOptionsEncrypt40Bit), bindBare(&Handlers::endOutputOptionsEncrypt40Bit)); // .output.options.encrypt.40Bit
beginDict("40bit", bindJSON(&Handlers::beginOutputOptionsEncrypt40bit), bindBare(&Handlers::endOutputOptionsEncrypt40bit)); // .output.options.encrypt.40bit
addChoices("annotate", yn_choices, [this](char const* p) { c_enc->annotate(p); });
addChoices("extract", yn_choices, [this](char const* p) { c_enc->extract(p); });
addChoices("modify", modify128_choices, [this](char const* p) { c_enc->modify(p); });
addChoices("print", print128_choices, [this](char const* p) { c_enc->print(p); });
endDict(); // .output.options.encrypt.40Bit
beginDict("128Bit", bindBare(&Handlers::beginOutputOptionsEncrypt128Bit), bindBare(&Handlers::endOutputOptionsEncrypt128Bit)); // .output.options.encrypt.128Bit
endDict(); // .output.options.encrypt.40bit
beginDict("128bit", bindJSON(&Handlers::beginOutputOptionsEncrypt128bit), bindBare(&Handlers::endOutputOptionsEncrypt128bit)); // .output.options.encrypt.128bit
addChoices("accessibility", yn_choices, [this](char const* p) { c_enc->accessibility(p); });
addChoices("annotate", yn_choices, [this](char const* p) { c_enc->annotate(p); });
addChoices("assemble", yn_choices, [this](char const* p) { c_enc->assemble(p); });
@ -67,8 +66,8 @@ addChoices("modify", modify128_choices, [this](char const* p) { c_enc->modify(p)
addChoices("print", print128_choices, [this](char const* p) { c_enc->print(p); });
addBare("forceV4", [this]() { c_enc->forceV4(); });
addChoices("useAes", yn_choices, [this](char const* p) { c_enc->useAes(p); });
endDict(); // .output.options.encrypt.128Bit
beginDict("256Bit", bindBare(&Handlers::beginOutputOptionsEncrypt256Bit), bindBare(&Handlers::endOutputOptionsEncrypt256Bit)); // .output.options.encrypt.256Bit
endDict(); // .output.options.encrypt.128bit
beginDict("256bit", bindJSON(&Handlers::beginOutputOptionsEncrypt256bit), bindBare(&Handlers::endOutputOptionsEncrypt256bit)); // .output.options.encrypt.256bit
addChoices("accessibility", yn_choices, [this](char const* p) { c_enc->accessibility(p); });
addChoices("annotate", yn_choices, [this](char const* p) { c_enc->annotate(p); });
addChoices("assemble", yn_choices, [this](char const* p) { c_enc->assemble(p); });
@ -80,11 +79,11 @@ addChoices("modify", modify128_choices, [this](char const* p) { c_enc->modify(p)
addChoices("print", print128_choices, [this](char const* p) { c_enc->print(p); });
addBare("allowInsecure", [this]() { c_enc->allowInsecure(); });
addBare("forceR5", [this]() { c_enc->forceR5(); });
endDict(); // .output.options.encrypt.256Bit
endDict(); // .output.options.encrypt.256bit
endDict(); // .output.options.encrypt
endDict(); // .output.options
endDict(); // .output
beginDict("options", bindBare(&Handlers::beginOptions), bindBare(&Handlers::endOptions)); // .options
beginDict("options", bindJSON(&Handlers::beginOptions), bindBare(&Handlers::endOptions)); // .options
addBare("allowWeakCrypto", [this]() { c_main->allowWeakCrypto(); });
addBare("deterministicId", [this]() { c_main->deterministicId(); });
addChoices("keepFilesOpen", yn_choices, [this](char const* p) { c_main->keepFilesOpen(p); });
@ -98,7 +97,7 @@ addChoices("passwordMode", password_mode_choices, [this](char const* p) { c_main
addBare("suppressPasswordRecovery", [this]() { c_main->suppressPasswordRecovery(); });
addBare("suppressRecovery", [this]() { c_main->suppressRecovery(); });
endDict(); // .options
beginDict("inspect", bindBare(&Handlers::beginInspect), bindBare(&Handlers::endInspect)); // .inspect
beginDict("inspect", bindJSON(&Handlers::beginInspect), bindBare(&Handlers::endInspect)); // .inspect
addBare("check", [this]() { c_main->check(); });
addBare("checkLinearization", [this]() { c_main->checkLinearization(); });
addBare("filteredStreamData", [this]() { c_main->filteredStreamData(); });
@ -119,15 +118,15 @@ addBare("json", [this]() { c_main->json(); });
addChoices("jsonKey", json_key_choices, [this](char const* p) { c_main->jsonKey(p); });
addParameter("jsonObject", [this](char const* p) { c_main->jsonObject(p); });
endDict(); // .inspect
beginDict("transform", bindBare(&Handlers::beginTransform), bindBare(&Handlers::endTransform)); // .transform
beginDict("transform", bindJSON(&Handlers::beginTransform), bindBare(&Handlers::endTransform)); // .transform
addBare("coalesceContents", [this]() { c_main->coalesceContents(); });
addParameter("compressionLevel", [this](char const* p) { c_main->compressionLevel(p); });
addBare("externalizeInlineImages", [this]() { c_main->externalizeInlineImages(); });
addParameter("iiMinBytes", [this](char const* p) { c_main->iiMinBytes(p); });
addChoices("removeUnreferencedResources", remove_unref_choices, [this](char const* p) { c_main->removeUnreferencedResources(p); });
endDict(); // .transform
beginDict("modify", bindBare(&Handlers::beginModify), bindBare(&Handlers::endModify)); // .modify
beginDict("addAttachment", bindBare(&Handlers::beginModifyAddAttachment), bindBare(&Handlers::endModifyAddAttachment)); // .modify.addAttachment
beginDict("modify", bindJSON(&Handlers::beginModify), bindBare(&Handlers::endModify)); // .modify
beginDict("addAttachment", bindJSON(&Handlers::beginModifyAddAttachment), bindBare(&Handlers::endModifyAddAttachment)); // .modify.addAttachment
doSetup("path", bindSetup(&Handlers::setupModifyAddAttachmentPath));
addParameter("creationdate", [this](char const* p) { c_att->creationdate(p); });
addParameter("description", [this](char const* p) { c_att->description(p); });
@ -138,7 +137,7 @@ addParameter("moddate", [this](char const* p) { c_att->moddate(p); });
addBare("replace", [this]() { c_att->replace(); });
endDict(); // .modify.addAttachment
addParameter("removeAttachment", [this](char const* p) { c_main->removeAttachment(p); });
beginDict("copyAttachmentsFrom", bindBare(&Handlers::beginModifyCopyAttachmentsFrom), bindBare(&Handlers::endModifyCopyAttachmentsFrom)); // .modify.copyAttachmentsFrom
beginDict("copyAttachmentsFrom", bindJSON(&Handlers::beginModifyCopyAttachmentsFrom), bindBare(&Handlers::endModifyCopyAttachmentsFrom)); // .modify.copyAttachmentsFrom
doSetup("path", bindSetup(&Handlers::setupModifyCopyAttachmentsFromPath));
doSetup("password", bindSetup(&Handlers::setupModifyCopyAttachmentsFromPassword));
addParameter("prefix", [this](char const* p) { c_copy_att->prefix(p); });
@ -152,21 +151,21 @@ addParameter("oiMinArea", [this](char const* p) { c_main->oiMinArea(p); });
addParameter("oiMinHeight", [this](char const* p) { c_main->oiMinHeight(p); });
addParameter("oiMinWidth", [this](char const* p) { c_main->oiMinWidth(p); });
addBare("optimizeImages", [this]() { c_main->optimizeImages(); });
beginDict("pages", bindBare(&Handlers::beginModifyPages), bindBare(&Handlers::endModifyPages)); // .modify.pages
beginDict("pages", bindJSON(&Handlers::beginModifyPages), bindBare(&Handlers::endModifyPages)); // .modify.pages
doSetup("file", bindSetup(&Handlers::setupModifyPagesFile));
doSetup("password", bindSetup(&Handlers::setupModifyPagesPassword));
doSetup("range", bindSetup(&Handlers::setupModifyPagesRange));
endDict(); // .modify.pages
addBare("removePageLabels", [this]() { c_main->removePageLabels(); });
addParameter("rotate", [this](char const* p) { c_main->rotate(p); });
beginDict("overlay", bindBare(&Handlers::beginModifyOverlay), bindBare(&Handlers::endModifyOverlay)); // .modify.overlay
beginDict("overlay", bindJSON(&Handlers::beginModifyOverlay), bindBare(&Handlers::endModifyOverlay)); // .modify.overlay
doSetup("file", bindSetup(&Handlers::setupModifyOverlayFile));
doSetup("password", bindSetup(&Handlers::setupModifyOverlayPassword));
addParameter("from", [this](char const* p) { c_uo->from(p); });
addParameter("repeat", [this](char const* p) { c_uo->repeat(p); });
addParameter("to", [this](char const* p) { c_uo->to(p); });
endDict(); // .modify.overlay
beginDict("underlay", bindBare(&Handlers::beginModifyUnderlay), bindBare(&Handlers::endModifyUnderlay)); // .modify.underlay
beginDict("underlay", bindJSON(&Handlers::beginModifyUnderlay), bindBare(&Handlers::endModifyUnderlay)); // .modify.underlay
doSetup("file", bindSetup(&Handlers::setupModifyUnderlayFile));
doSetup("password", bindSetup(&Handlers::setupModifyUnderlayPassword));
addParameter("from", [this](char const* p) { c_uo->from(p); });

View File

@ -1,12 +1,12 @@
static constexpr char const* JOB_SCHEMA_DATA = R"({
"input": {
"fileName": "input filename",
"filename": "input filename",
"password": "specify password",
"passwordFile": "read password from a file",
"empty": "empty input file"
},
"output": {
"fileName": "output filename",
"filename": "output filename",
"replaceInput": "set to true to replace input",
"options": {
"qdf": "enable viewing PDF code in a text editor",
@ -31,16 +31,15 @@ static constexpr char const* JOB_SCHEMA_DATA = R"({
"progress": "show progress when writing",
"splitPages": "write pages to separate files",
"encrypt": {
"keyLength": "key length: 48, 128, 256",
"userPassword": "user password",
"ownerPassword": "owner password",
"40Bit": {
"40bit": {
"annotate": "restrict document annotation",
"extract": "restrict text/graphic extraction",
"modify": "restrict document modification",
"print": "restrict printing"
},
"128Bit": {
"128bit": {
"accessibility": "restrict document accessibility",
"annotate": "restrict document annotation",
"assemble": "restrict document assembly",
@ -53,7 +52,7 @@ static constexpr char const* JOB_SCHEMA_DATA = R"({
"forceV4": "force V=4 in encryption dictionary",
"useAes": "use AES with 128-bit encryption"
},
"256Bit": {
"256bit": {
"accessibility": "restrict document accessibility",
"annotate": "restrict document annotation",
"assemble": "restrict document assembly",