2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-31 17:30:54 +00:00

QPDFJob json: flatten json structure

Flatten everything to make it easier to map command-line flags to
json. The old structure was an illusion anyway because there was no
mechanism to enforce that things were in the right place. This also
helps with future flexibility.
This commit is contained in:
Jay Berkenbilt 2022-01-31 18:04:14 -05:00
parent 47f33cec25
commit ea96330bb6
34 changed files with 611 additions and 809 deletions

View File

@ -562,7 +562,7 @@ class Main:
def generate_schema(self, data): def generate_schema(self, data):
# Check to make sure that every command-line option is # Check to make sure that every command-line option is
# represented either in data['json'] or data['no-json']. # represented in data['json'].
# Build a list of options that we expect. If an option appears # Build a list of options that we expect. If an option appears
# once, we just expect to see it once. If it appears in more # once, we just expect to see it once. If it appears in more
@ -578,7 +578,7 @@ class Main:
else: else:
for t in sorted(tables): for t in sorted(tables):
expected[f'{t}.{k}'] = {**v} expected[f'{t}.{k}'] = {**v}
options_seen = set(data['no-json']) options_seen = set()
# Walk through the json information building the schema as we # Walk through the json information building the schema as we
# go. This verifies consistency between command-line options # go. This verifies consistency between command-line options
@ -600,7 +600,7 @@ class Main:
def validate(self, data): def validate(self, data):
self.check_keys('top', data, set( self.check_keys('top', data, set(
['choices', 'options', 'no-json', 'json'])) ['choices', 'options', 'json']))
for o in data['options']: for o in data['options']:
self.check_keys('top', o, set( self.check_keys('top', o, set(
['table', 'prefix', 'config', 'config_prefix', ['table', 'prefix', 'config', 'config_prefix',

View File

@ -1,17 +1,17 @@
# Generated by generate_auto_job # Generated by generate_auto_job
generate_auto_job ef1b438aeebed7ca0afcbe4d1f9c54d3acf899aec8410ebc69cd15ec673dd158 generate_auto_job 905fed38c06d258af617ac909bed78a7888a5eaba3f14cf143168665f6e90a86
include/qpdf/auto_job_c_att.hh 7ad43bb374c1370ef32ebdcdcb7b73a61d281f7f4e3f12755585872ab30fb60e include/qpdf/auto_job_c_att.hh 7ad43bb374c1370ef32ebdcdcb7b73a61d281f7f4e3f12755585872ab30fb60e
include/qpdf/auto_job_c_copy_att.hh 32275d03cdc69b703dd7e02ba0bbe15756e714e9ad185484773a6178dc09e1ee include/qpdf/auto_job_c_copy_att.hh 32275d03cdc69b703dd7e02ba0bbe15756e714e9ad185484773a6178dc09e1ee
include/qpdf/auto_job_c_enc.hh 72e138c7b96ed5aacdce78c1dec04b1c20d361faec4f8faf52f64c1d6be99265 include/qpdf/auto_job_c_enc.hh 72e138c7b96ed5aacdce78c1dec04b1c20d361faec4f8faf52f64c1d6be99265
include/qpdf/auto_job_c_main.hh ff776dd643279330fbf59770d1abf5aaeb13f20bfc5f6a25997aaa72a0907b44 include/qpdf/auto_job_c_main.hh ff776dd643279330fbf59770d1abf5aaeb13f20bfc5f6a25997aaa72a0907b44
include/qpdf/auto_job_c_pages.hh 931840b329a36ca0e41401190e04537b47f2867671a6643bfd8da74014202671 include/qpdf/auto_job_c_pages.hh 931840b329a36ca0e41401190e04537b47f2867671a6643bfd8da74014202671
include/qpdf/auto_job_c_uo.hh 0585b7de459fa479d9e51a45fa92de0ff6dee748efc9ec1cedd0dde6cee1ad50 include/qpdf/auto_job_c_uo.hh 0585b7de459fa479d9e51a45fa92de0ff6dee748efc9ec1cedd0dde6cee1ad50
job.yml c3e714b3c3e2fc85390d983302ff398aa0992c621e85dbcaee20173b1bd3cb0b job.yml 92565dc8023ea880aca5b96c2620f756642a6dafa5ed15546bc2c777c31b218e
libqpdf/qpdf/auto_job_decl.hh 9f79396ec459f191be4c5fe34cf88c265cf47355a1a945fa39169d1c94cf04f6 libqpdf/qpdf/auto_job_decl.hh 9f79396ec459f191be4c5fe34cf88c265cf47355a1a945fa39169d1c94cf04f6
libqpdf/qpdf/auto_job_help.hh a0ab6ab4dde2ad3d3f17ecae3ea274919119329e075061f3a3973535f5e367de libqpdf/qpdf/auto_job_help.hh a0ab6ab4dde2ad3d3f17ecae3ea274919119329e075061f3a3973535f5e367de
libqpdf/qpdf/auto_job_init.hh c244e03e8b83ed7db732920f40aff0134e5f2e78a6edb9473ea4dd1934a8953e libqpdf/qpdf/auto_job_init.hh c244e03e8b83ed7db732920f40aff0134e5f2e78a6edb9473ea4dd1934a8953e
libqpdf/qpdf/auto_job_json_decl.hh 741a44106f7850b6cbc8af264b5b77bb605475c8d8dd8cd87011d5debbee6269 libqpdf/qpdf/auto_job_json_decl.hh c5e3fd38a3b0c569eb0c6b4c60953a09cd6bc7d3361a357a81f64fe36af2b0cf
libqpdf/qpdf/auto_job_json_init.hh 63bbe1c3d673cd56196ec42ec7ede7b531563667d83564aa6680634fcb2cf259 libqpdf/qpdf/auto_job_json_init.hh bfaf88ad1461e1157e7a0eb6e8c90669eba6d03b5b1ffd2e7e7041250c5f0523
libqpdf/qpdf/auto_job_schema.hh a764050cc99f1cc95645fd1ea2f020c4b778957abc64fbc55c12eac3a369dc92 libqpdf/qpdf/auto_job_schema.hh 2ec70dffdd15974d74102b4d7ada9f97449bc28c98be119efee5e15507ed22a8
manual/_ext/qpdf.py e9ac9d6c70642a3d29281ee5ad92ae2422dee8be9306fb8a0bc9dba0ed5e28f3 manual/_ext/qpdf.py e9ac9d6c70642a3d29281ee5ad92ae2422dee8be9306fb8a0bc9dba0ed5e28f3
manual/cli.rst a75a7e34aa9aba4f06e9c88cae9a2d9a2aa4e55a08521dde1478e8f2d80aadab manual/cli.rst a75a7e34aa9aba4f06e9c88cae9a2d9a2aa4e55a08521dde1478e8f2d80aadab

293
job.yml
View File

@ -243,13 +243,6 @@ options:
required_parameter: required_parameter:
prefix: prefix prefix: prefix
password: password password: password
no-json:
- preserve-unreferenced-resources
- job-json-file
- replace-input
- warning-exit-0
- requires-password
- is-encrypted
json: json:
# The structure of this section defines what the json input to # The structure of this section defines what the json input to
# QPDFJob looks like. If a key starts with underscore, it does not # QPDFJob looks like. If a key starts with underscore, it does not
@ -262,143 +255,149 @@ json:
# converted to camelCase for the schema and must be appear that way # converted to camelCase for the schema and must be appear that way
# in the user-supplied json. This makes it more convenient to # in the user-supplied json. This makes it more convenient to
# populate JSON objects in some languages. # populate JSON objects in some languages.
_input:
_file: "input filename" # input
main.password: _inputFile: "input filename"
password-file: main.password:
empty: password-file:
_output: empty:
_file: "output filename" # output
_replace-input: "set to true to replace input" _outputFile: "output filename"
_options: replace-input:
qdf: # output options
preserve-unreferenced: qdf:
newline-before-endstream: preserve-unreferenced:
normalize-content: newline-before-endstream:
stream-data: normalize-content:
compress-streams: stream-data:
recompress-flate: compress-streams:
decode-level: recompress-flate:
decrypt: decode-level:
deterministic-id: decrypt:
static-aes-iv: deterministic-id:
static-id: static-aes-iv:
no-original-object-ids: static-id:
copy-encryption: no-original-object-ids:
encryption-file-password: copy-encryption:
linearize: encryption-file-password:
linearize-pass1: linearize:
object-streams: linearize-pass1:
min-version: object-streams:
force-version: min-version:
progress: force-version:
split-pages: progress:
encrypt: split-pages:
_user-password: "user password" encrypt:
_owner-password: "owner password" _user-password: "user password"
_40bit: _owner-password: "owner password"
Enc40.annotate: _40bit:
Enc40.extract: Enc40.annotate:
Enc40.modify: Enc40.extract:
Enc40.print: Enc40.modify:
_128bit: Enc40.print:
Enc128.accessibility: _128bit:
Enc128.annotate: Enc128.accessibility:
Enc128.assemble: Enc128.annotate:
Enc128.cleartext-metadata: Enc128.assemble:
Enc128.extract: Enc128.cleartext-metadata:
Enc128.form: Enc128.extract:
Enc128.modify-other: Enc128.form:
Enc128.modify: Enc128.modify-other:
Enc128.print: Enc128.modify:
force-V4: Enc128.print:
use-aes: force-V4:
_256bit: use-aes:
Enc256.accessibility: _256bit:
Enc256.annotate: Enc256.accessibility:
Enc256.assemble: Enc256.annotate:
Enc256.cleartext-metadata: Enc256.assemble:
Enc256.extract: Enc256.cleartext-metadata:
Enc256.form: Enc256.extract:
Enc256.modify-other: Enc256.form:
Enc256.modify: Enc256.modify-other:
Enc256.print: Enc256.modify:
allow-insecure: Enc256.print:
force-R5: allow-insecure:
_inspect: force-R5:
check: # inspect
check-linearization: check:
filtered-stream-data: check-linearization:
raw-stream-data: filtered-stream-data:
show-encryption: raw-stream-data:
show-encryption-key: show-encryption:
show-linearization: show-encryption-key:
show-npages: show-linearization:
show-object: show-npages:
show-pages: show-object:
show-xref: show-pages:
with-images: show-xref:
list-attachments: with-images:
show-attachment: list-attachments:
json: show-attachment:
json-key: json:
- null json-key:
json-object: - null
- null json-object:
_options: - null
allow-weak-crypto: # other options
keep-files-open: allow-weak-crypto:
keep-files-open-threshold: keep-files-open:
no-warn: keep-files-open-threshold:
verbose: no-warn:
ignore-xref-streams: verbose:
password-is-hex-key: ignore-xref-streams:
password-mode: password-is-hex-key:
suppress-password-recovery: password-mode:
suppress-recovery: suppress-password-recovery:
coalesce-contents: suppress-recovery:
compression-level: coalesce-contents:
externalize-inline-images: compression-level:
ii-min-bytes: externalize-inline-images:
remove-unreferenced-resources: ii-min-bytes:
add-attachment: remove-unreferenced-resources:
- _file: "attachment to add" add-attachment:
creationdate: - _file: "attachment to add"
description: creationdate:
filename: description:
key: filename:
mimetype: key:
moddate: mimetype:
replace: moddate:
remove-attachment: replace:
copy-attachments-from: remove-attachment:
- _file: "attachment source filename" copy-attachments-from:
CopyAtt.password: - _file: "attachment source filename"
prefix: CopyAtt.password:
collate: prefix:
flatten-annotations: collate:
flatten-rotation: flatten-annotations:
generate-appearances: flatten-rotation:
keep-inline-images: generate-appearances:
oi-min-area: keep-inline-images:
oi-min-height: oi-min-area:
oi-min-width: oi-min-height:
optimize-images: oi-min-width:
pages: optimize-images:
- _file: "source for for pages" pages:
Pages.password: - _file: "source for for pages"
_range: "page range" Pages.password:
remove-page-labels: _range: "page range"
rotate: remove-page-labels:
overlay: rotate:
_file: "source file for overlay" overlay:
UO.password: _file: "source file for overlay"
from: UO.password:
repeat: from:
to: repeat:
underlay: to:
_file: "source file for underlay" underlay:
UO.password: _file: "source file for underlay"
from: UO.password:
repeat: from:
to: repeat:
to:
warning-exit-0:
job-json-file:
preserve-unreferenced-resources:
requires-password:
is-encrypted:

View File

@ -219,18 +219,6 @@ Handlers::handle(JSON& j)
this->json_handlers.back()->handle(".", j); this->json_handlers.back()->handle(".", j);
} }
void
Handlers::beginInput(JSON)
{
// nothing needed
}
void
Handlers::endInput()
{
// nothing needed
}
void void
Handlers::setupInputFile() Handlers::setupInputFile()
{ {
@ -240,7 +228,7 @@ Handlers::setupInputFile()
} }
void void
Handlers::setupInputPassword() Handlers::setupPassword()
{ {
addParameter([this](char const* p) { addParameter([this](char const* p) {
c_main->password(p); c_main->password(p);
@ -248,25 +236,13 @@ Handlers::setupInputPassword()
} }
void void
Handlers::setupInputEmpty() Handlers::setupEmpty()
{ {
addBare([this]() { addBare([this]() {
c_main->emptyInput(); c_main->emptyInput();
}); });
} }
void
Handlers::beginOutput(JSON)
{
// nothing needed
}
void
Handlers::endOutput()
{
// nothing needed
}
void void
Handlers::setupOutputFile() Handlers::setupOutputFile()
{ {
@ -276,7 +252,7 @@ Handlers::setupOutputFile()
} }
void void
Handlers::setupOutputReplaceInput() Handlers::setupReplaceInput()
{ {
addBare([this]() { addBare([this]() {
c_main->replaceInput(); c_main->replaceInput();
@ -284,19 +260,7 @@ Handlers::setupOutputReplaceInput()
} }
void void
Handlers::beginOutputOptions(JSON) Handlers::beginEncrypt(JSON j)
{
// nothing needed
}
void
Handlers::endOutputOptions()
{
// nothing needed
}
void
Handlers::beginOutputOptionsEncrypt(JSON j)
{ {
// This method is only called if the overall JSON structure // This method is only called if the overall JSON structure
// matches the schema, so we already know that keys that are // matches the schema, so we already know that keys that are
@ -342,137 +306,113 @@ Handlers::beginOutputOptionsEncrypt(JSON j)
} }
void void
Handlers::endOutputOptionsEncrypt() Handlers::endEncrypt()
{ {
this->c_enc->endEncrypt(); this->c_enc->endEncrypt();
this->c_enc = nullptr; this->c_enc = nullptr;
} }
void void
Handlers::setupOutputOptionsEncryptUserPassword() Handlers::setupEncryptUserPassword()
{ {
// handled in beginOutputOptionsEncrypt // handled in beginEncrypt
ignoreItem(); ignoreItem();
} }
void void
Handlers::setupOutputOptionsEncryptOwnerPassword() Handlers::setupEncryptOwnerPassword()
{ {
// handled in beginOutputOptionsEncrypt // handled in beginEncrypt
ignoreItem(); ignoreItem();
} }
void void
Handlers::beginOutputOptionsEncrypt40bit(JSON) Handlers::beginEncrypt40bit(JSON)
{ {
// nothing needed // nothing needed
} }
void void
Handlers::endOutputOptionsEncrypt40bit() Handlers::endEncrypt40bit()
{ {
// nothing needed // nothing needed
} }
void void
Handlers::beginOutputOptionsEncrypt128bit(JSON) Handlers::beginEncrypt128bit(JSON)
{ {
// nothing needed // nothing needed
} }
void void
Handlers::endOutputOptionsEncrypt128bit() Handlers::endEncrypt128bit()
{ {
// nothing needed // nothing needed
} }
void void
Handlers::beginOutputOptionsEncrypt256bit(JSON) Handlers::beginEncrypt256bit(JSON)
{ {
// nothing needed // nothing needed
} }
void void
Handlers::endOutputOptionsEncrypt256bit() Handlers::endEncrypt256bit()
{ {
// nothing needed // nothing needed
} }
void void
Handlers::beginOptions(JSON) Handlers::beginJsonKeyArray(JSON)
{ {
// nothing needed // nothing needed
} }
void void
Handlers::endOptions() Handlers::endJsonKeyArray()
{ {
// nothing needed // nothing needed
} }
void void
Handlers::beginInspect(JSON) Handlers::beginJsonObjectArray(JSON)
{ {
// nothing needed // nothing needed
} }
void void
Handlers::endInspect() Handlers::endJsonObjectArray()
{ {
// nothing needed // nothing needed
} }
void void
Handlers::beginInspectJsonKeyArray(JSON) Handlers::beginAddAttachmentArray(JSON)
{ {
// nothing needed // nothing needed
} }
void void
Handlers::endInspectJsonKeyArray() Handlers::endAddAttachmentArray()
{ {
// nothing needed // nothing needed
} }
void void
Handlers::beginInspectJsonObjectArray(JSON) Handlers::beginAddAttachment(JSON)
{
// nothing needed
}
void
Handlers::endInspectJsonObjectArray()
{
// nothing needed
}
void
Handlers::beginOptionsAddAttachmentArray(JSON)
{
// nothing needed
}
void
Handlers::endOptionsAddAttachmentArray()
{
// nothing needed
}
void
Handlers::beginOptionsAddAttachment(JSON)
{ {
this->c_att = c_main->addAttachment(); this->c_att = c_main->addAttachment();
} }
void void
Handlers::endOptionsAddAttachment() Handlers::endAddAttachment()
{ {
this->c_att->endAddAttachment(); this->c_att->endAddAttachment();
this->c_att = nullptr; this->c_att = nullptr;
} }
void void
Handlers::setupOptionsAddAttachmentFile() Handlers::setupAddAttachmentFile()
{ {
addParameter([this](char const* p) { addParameter([this](char const* p) {
c_att->file(p); c_att->file(p);
@ -480,32 +420,32 @@ Handlers::setupOptionsAddAttachmentFile()
} }
void void
Handlers::beginOptionsCopyAttachmentsFromArray(JSON) Handlers::beginCopyAttachmentsFromArray(JSON)
{ {
// nothing needed // nothing needed
} }
void void
Handlers::endOptionsCopyAttachmentsFromArray() Handlers::endCopyAttachmentsFromArray()
{ {
// nothing needed // nothing needed
} }
void void
Handlers::beginOptionsCopyAttachmentsFrom(JSON) Handlers::beginCopyAttachmentsFrom(JSON)
{ {
this->c_copy_att = c_main->copyAttachmentsFrom(); this->c_copy_att = c_main->copyAttachmentsFrom();
} }
void void
Handlers::endOptionsCopyAttachmentsFrom() Handlers::endCopyAttachmentsFrom()
{ {
this->c_copy_att->endCopyAttachmentsFrom(); this->c_copy_att->endCopyAttachmentsFrom();
this->c_copy_att = nullptr; this->c_copy_att = nullptr;
} }
void void
Handlers::setupOptionsCopyAttachmentsFromFile() Handlers::setupCopyAttachmentsFromFile()
{ {
addParameter([this](char const* p) { addParameter([this](char const* p) {
c_copy_att->file(p); c_copy_att->file(p);
@ -513,7 +453,7 @@ Handlers::setupOptionsCopyAttachmentsFromFile()
} }
void void
Handlers::setupOptionsCopyAttachmentsFromPassword() Handlers::setupCopyAttachmentsFromPassword()
{ {
addParameter([this](char const* p) { addParameter([this](char const* p) {
c_copy_att->password(p); c_copy_att->password(p);
@ -521,20 +461,20 @@ Handlers::setupOptionsCopyAttachmentsFromPassword()
} }
void void
Handlers::beginOptionsPagesArray(JSON) Handlers::beginPagesArray(JSON)
{ {
this->c_pages = c_main->pages(); this->c_pages = c_main->pages();
} }
void void
Handlers::endOptionsPagesArray() Handlers::endPagesArray()
{ {
c_pages->endPages(); c_pages->endPages();
c_pages = nullptr; c_pages = nullptr;
} }
void void
Handlers::beginOptionsPages(JSON j) Handlers::beginPages(JSON j)
{ {
std::string file; std::string file;
std::string range("1-z"); std::string range("1-z");
@ -565,47 +505,47 @@ Handlers::beginOptionsPages(JSON j)
} }
void void
Handlers::endOptionsPages() Handlers::endPages()
{ {
// nothing needed // nothing needed
} }
void void
Handlers::setupOptionsPagesFile() Handlers::setupPagesFile()
{ {
// handled in beginOptionsPages // handled in beginPages
ignoreItem(); ignoreItem();
} }
void void
Handlers::setupOptionsPagesPassword() Handlers::setupPagesPassword()
{ {
// handled in beginOptionsPages // handled in beginPages
ignoreItem(); ignoreItem();
} }
void void
Handlers::setupOptionsPagesRange() Handlers::setupPagesRange()
{ {
// handled in beginOptionsPages // handled in beginPages
ignoreItem(); ignoreItem();
} }
void void
Handlers::beginOptionsOverlay(JSON) Handlers::beginOverlay(JSON)
{ {
this->c_uo = c_main->overlay(); this->c_uo = c_main->overlay();
} }
void void
Handlers::endOptionsOverlay() Handlers::endOverlay()
{ {
c_uo->endUnderlayOverlay(); c_uo->endUnderlayOverlay();
c_uo = nullptr; c_uo = nullptr;
} }
void void
Handlers::setupOptionsOverlayFile() Handlers::setupOverlayFile()
{ {
addParameter([this](char const* p) { addParameter([this](char const* p) {
c_uo->file(p); c_uo->file(p);
@ -613,7 +553,7 @@ Handlers::setupOptionsOverlayFile()
} }
void void
Handlers::setupOptionsOverlayPassword() Handlers::setupOverlayPassword()
{ {
addParameter([this](char const* p) { addParameter([this](char const* p) {
c_uo->password(p); c_uo->password(p);
@ -621,20 +561,20 @@ Handlers::setupOptionsOverlayPassword()
} }
void void
Handlers::beginOptionsUnderlay(JSON) Handlers::beginUnderlay(JSON)
{ {
this->c_uo = c_main->underlay(); this->c_uo = c_main->underlay();
} }
void void
Handlers::endOptionsUnderlay() Handlers::endUnderlay()
{ {
c_uo->endUnderlayOverlay(); c_uo->endUnderlayOverlay();
c_uo = nullptr; c_uo = nullptr;
} }
void void
Handlers::setupOptionsUnderlayFile() Handlers::setupUnderlayFile()
{ {
addParameter([this](char const* p) { addParameter([this](char const* p) {
c_uo->file(p); c_uo->file(p);
@ -642,7 +582,7 @@ Handlers::setupOptionsUnderlayFile()
} }
void void
Handlers::setupOptionsUnderlayPassword() Handlers::setupUnderlayPassword()
{ {
addParameter([this](char const* p) { addParameter([this](char const* p) {
c_uo->password(p); c_uo->password(p);

View File

@ -3,58 +3,48 @@
// Edits will be automatically overwritten if the build is // Edits will be automatically overwritten if the build is
// run in maintainer mode. // run in maintainer mode.
// //
void beginInput(JSON);
void endInput();
void setupInputFile(); void setupInputFile();
void setupInputPassword(); void setupPassword();
void setupInputEmpty(); void setupEmpty();
void beginOutput(JSON);
void endOutput();
void setupOutputFile(); void setupOutputFile();
void setupOutputReplaceInput(); void setupReplaceInput();
void beginOutputOptions(JSON); void beginEncrypt(JSON);
void endOutputOptions(); void endEncrypt();
void beginOutputOptionsEncrypt(JSON); void setupEncryptUserPassword();
void endOutputOptionsEncrypt(); void setupEncryptOwnerPassword();
void setupOutputOptionsEncryptUserPassword(); void beginEncrypt40bit(JSON);
void setupOutputOptionsEncryptOwnerPassword(); void endEncrypt40bit();
void beginOutputOptionsEncrypt40bit(JSON); void beginEncrypt128bit(JSON);
void endOutputOptionsEncrypt40bit(); void endEncrypt128bit();
void beginOutputOptionsEncrypt128bit(JSON); void beginEncrypt256bit(JSON);
void endOutputOptionsEncrypt128bit(); void endEncrypt256bit();
void beginOutputOptionsEncrypt256bit(JSON); void beginJsonKeyArray(JSON);
void endOutputOptionsEncrypt256bit(); void endJsonKeyArray();
void beginInspect(JSON); void beginJsonObjectArray(JSON);
void endInspect(); void endJsonObjectArray();
void beginInspectJsonKeyArray(JSON); void beginAddAttachmentArray(JSON);
void endInspectJsonKeyArray(); void endAddAttachmentArray();
void beginInspectJsonObjectArray(JSON); void beginAddAttachment(JSON);
void endInspectJsonObjectArray(); void endAddAttachment();
void beginOptions(JSON); void setupAddAttachmentFile();
void endOptions(); void beginCopyAttachmentsFromArray(JSON);
void beginOptionsAddAttachmentArray(JSON); void endCopyAttachmentsFromArray();
void endOptionsAddAttachmentArray(); void beginCopyAttachmentsFrom(JSON);
void beginOptionsAddAttachment(JSON); void endCopyAttachmentsFrom();
void endOptionsAddAttachment(); void setupCopyAttachmentsFromFile();
void setupOptionsAddAttachmentFile(); void setupCopyAttachmentsFromPassword();
void beginOptionsCopyAttachmentsFromArray(JSON); void beginPagesArray(JSON);
void endOptionsCopyAttachmentsFromArray(); void endPagesArray();
void beginOptionsCopyAttachmentsFrom(JSON); void beginPages(JSON);
void endOptionsCopyAttachmentsFrom(); void endPages();
void setupOptionsCopyAttachmentsFromFile(); void setupPagesFile();
void setupOptionsCopyAttachmentsFromPassword(); void setupPagesPassword();
void beginOptionsPagesArray(JSON); void setupPagesRange();
void endOptionsPagesArray(); void beginOverlay(JSON);
void beginOptionsPages(JSON); void endOverlay();
void endOptionsPages(); void setupOverlayFile();
void setupOptionsPagesFile(); void setupOverlayPassword();
void setupOptionsPagesPassword(); void beginUnderlay(JSON);
void setupOptionsPagesRange(); void endUnderlay();
void beginOptionsOverlay(JSON); void setupUnderlayFile();
void endOptionsOverlay(); void setupUnderlayPassword();
void setupOptionsOverlayFile();
void setupOptionsOverlayPassword();
void beginOptionsUnderlay(JSON);
void endOptionsUnderlay();
void setupOptionsUnderlayFile();
void setupOptionsUnderlayPassword();

View File

@ -15,31 +15,24 @@ static char const* json_key_choices[] = {"acroform", "attachments", "encrypt", "
static char const* print128_choices[] = {"full", "low", "none", 0}; static char const* print128_choices[] = {"full", "low", "none", 0};
static char const* modify128_choices[] = {"all", "annotate", "form", "assembly", "none", 0}; static char const* modify128_choices[] = {"all", "annotate", "form", "assembly", "none", 0};
pushKey("input"); pushKey("inputFile");
beginDict(bindJSON(&Handlers::beginInput), bindBare(&Handlers::endInput)); // .input
pushKey("file");
setupInputFile(); setupInputFile();
popHandler(); // key: file popHandler(); // key: inputFile
pushKey("password"); pushKey("password");
setupInputPassword(); setupPassword();
popHandler(); // key: password popHandler(); // key: password
pushKey("passwordFile"); pushKey("passwordFile");
addParameter([this](char const* p) { c_main->passwordFile(p); }); addParameter([this](char const* p) { c_main->passwordFile(p); });
popHandler(); // key: passwordFile popHandler(); // key: passwordFile
pushKey("empty"); pushKey("empty");
setupInputEmpty(); setupEmpty();
popHandler(); // key: empty popHandler(); // key: empty
popHandler(); // key: input pushKey("outputFile");
pushKey("output");
beginDict(bindJSON(&Handlers::beginOutput), bindBare(&Handlers::endOutput)); // .output
pushKey("file");
setupOutputFile(); setupOutputFile();
popHandler(); // key: file popHandler(); // key: outputFile
pushKey("replaceInput"); pushKey("replaceInput");
setupOutputReplaceInput(); setupReplaceInput();
popHandler(); // key: replaceInput popHandler(); // key: replaceInput
pushKey("options");
beginDict(bindJSON(&Handlers::beginOutputOptions), bindBare(&Handlers::endOutputOptions)); // .output.options
pushKey("qdf"); pushKey("qdf");
addBare([this]() { c_main->qdf(); }); addBare([this]() { c_main->qdf(); });
popHandler(); // key: qdf popHandler(); // key: qdf
@ -107,15 +100,15 @@ pushKey("splitPages");
addParameter([this](char const* p) { c_main->splitPages(p); }); addParameter([this](char const* p) { c_main->splitPages(p); });
popHandler(); // key: splitPages popHandler(); // key: splitPages
pushKey("encrypt"); pushKey("encrypt");
beginDict(bindJSON(&Handlers::beginOutputOptionsEncrypt), bindBare(&Handlers::endOutputOptionsEncrypt)); // .output.options.encrypt beginDict(bindJSON(&Handlers::beginEncrypt), bindBare(&Handlers::endEncrypt)); // .encrypt
pushKey("userPassword"); pushKey("userPassword");
setupOutputOptionsEncryptUserPassword(); setupEncryptUserPassword();
popHandler(); // key: userPassword popHandler(); // key: userPassword
pushKey("ownerPassword"); pushKey("ownerPassword");
setupOutputOptionsEncryptOwnerPassword(); setupEncryptOwnerPassword();
popHandler(); // key: ownerPassword popHandler(); // key: ownerPassword
pushKey("40bit"); pushKey("40bit");
beginDict(bindJSON(&Handlers::beginOutputOptionsEncrypt40bit), bindBare(&Handlers::endOutputOptionsEncrypt40bit)); // .output.options.encrypt.40bit beginDict(bindJSON(&Handlers::beginEncrypt40bit), bindBare(&Handlers::endEncrypt40bit)); // .encrypt.40bit
pushKey("annotate"); pushKey("annotate");
addChoices(yn_choices, [this](char const* p) { c_enc->annotate(p); }); addChoices(yn_choices, [this](char const* p) { c_enc->annotate(p); });
popHandler(); // key: annotate popHandler(); // key: annotate
@ -130,7 +123,7 @@ addChoices(print128_choices, [this](char const* p) { c_enc->print(p); });
popHandler(); // key: print popHandler(); // key: print
popHandler(); // key: 40bit popHandler(); // key: 40bit
pushKey("128bit"); pushKey("128bit");
beginDict(bindJSON(&Handlers::beginOutputOptionsEncrypt128bit), bindBare(&Handlers::endOutputOptionsEncrypt128bit)); // .output.options.encrypt.128bit beginDict(bindJSON(&Handlers::beginEncrypt128bit), bindBare(&Handlers::endEncrypt128bit)); // .encrypt.128bit
pushKey("accessibility"); pushKey("accessibility");
addChoices(yn_choices, [this](char const* p) { c_enc->accessibility(p); }); addChoices(yn_choices, [this](char const* p) { c_enc->accessibility(p); });
popHandler(); // key: accessibility popHandler(); // key: accessibility
@ -166,7 +159,7 @@ addChoices(yn_choices, [this](char const* p) { c_enc->useAes(p); });
popHandler(); // key: useAes popHandler(); // key: useAes
popHandler(); // key: 128bit popHandler(); // key: 128bit
pushKey("256bit"); pushKey("256bit");
beginDict(bindJSON(&Handlers::beginOutputOptionsEncrypt256bit), bindBare(&Handlers::endOutputOptionsEncrypt256bit)); // .output.options.encrypt.256bit beginDict(bindJSON(&Handlers::beginEncrypt256bit), bindBare(&Handlers::endEncrypt256bit)); // .encrypt.256bit
pushKey("accessibility"); pushKey("accessibility");
addChoices(yn_choices, [this](char const* p) { c_enc->accessibility(p); }); addChoices(yn_choices, [this](char const* p) { c_enc->accessibility(p); });
popHandler(); // key: accessibility popHandler(); // key: accessibility
@ -202,10 +195,6 @@ addBare([this]() { c_enc->forceR5(); });
popHandler(); // key: forceR5 popHandler(); // key: forceR5
popHandler(); // key: 256bit popHandler(); // key: 256bit
popHandler(); // key: encrypt popHandler(); // key: encrypt
popHandler(); // key: options
popHandler(); // key: output
pushKey("inspect");
beginDict(bindJSON(&Handlers::beginInspect), bindBare(&Handlers::endInspect)); // .inspect
pushKey("check"); pushKey("check");
addBare([this]() { c_main->check(); }); addBare([this]() { c_main->check(); });
popHandler(); // key: check popHandler(); // key: check
@ -252,18 +241,15 @@ pushKey("json");
addChoices(json_version_choices, [this](char const* p) { c_main->json(p); }); addChoices(json_version_choices, [this](char const* p) { c_main->json(p); });
popHandler(); // key: json popHandler(); // key: json
pushKey("jsonKey"); pushKey("jsonKey");
beginArray(bindJSON(&Handlers::beginInspectJsonKeyArray), bindBare(&Handlers::endInspectJsonKeyArray)); // .inspect.jsonKey[] beginArray(bindJSON(&Handlers::beginJsonKeyArray), bindBare(&Handlers::endJsonKeyArray)); // .jsonKey[]
addChoices(json_key_choices, [this](char const* p) { c_main->jsonKey(p); }); addChoices(json_key_choices, [this](char const* p) { c_main->jsonKey(p); });
popHandler(); // array: .inspect.jsonKey[] popHandler(); // array: .jsonKey[]
popHandler(); // key: jsonKey popHandler(); // key: jsonKey
pushKey("jsonObject"); pushKey("jsonObject");
beginArray(bindJSON(&Handlers::beginInspectJsonObjectArray), bindBare(&Handlers::endInspectJsonObjectArray)); // .inspect.jsonObject[] beginArray(bindJSON(&Handlers::beginJsonObjectArray), bindBare(&Handlers::endJsonObjectArray)); // .jsonObject[]
addParameter([this](char const* p) { c_main->jsonObject(p); }); addParameter([this](char const* p) { c_main->jsonObject(p); });
popHandler(); // array: .inspect.jsonObject[] popHandler(); // array: .jsonObject[]
popHandler(); // key: jsonObject popHandler(); // key: jsonObject
popHandler(); // key: inspect
pushKey("options");
beginDict(bindJSON(&Handlers::beginOptions), bindBare(&Handlers::endOptions)); // .options
pushKey("allowWeakCrypto"); pushKey("allowWeakCrypto");
addBare([this]() { c_main->allowWeakCrypto(); }); addBare([this]() { c_main->allowWeakCrypto(); });
popHandler(); // key: allowWeakCrypto popHandler(); // key: allowWeakCrypto
@ -310,10 +296,10 @@ pushKey("removeUnreferencedResources");
addChoices(remove_unref_choices, [this](char const* p) { c_main->removeUnreferencedResources(p); }); addChoices(remove_unref_choices, [this](char const* p) { c_main->removeUnreferencedResources(p); });
popHandler(); // key: removeUnreferencedResources popHandler(); // key: removeUnreferencedResources
pushKey("addAttachment"); pushKey("addAttachment");
beginArray(bindJSON(&Handlers::beginOptionsAddAttachmentArray), bindBare(&Handlers::endOptionsAddAttachmentArray)); // .options.addAttachment[] beginArray(bindJSON(&Handlers::beginAddAttachmentArray), bindBare(&Handlers::endAddAttachmentArray)); // .addAttachment[]
beginDict(bindJSON(&Handlers::beginOptionsAddAttachment), bindBare(&Handlers::endOptionsAddAttachment)); // .options.addAttachment beginDict(bindJSON(&Handlers::beginAddAttachment), bindBare(&Handlers::endAddAttachment)); // .addAttachment
pushKey("file"); pushKey("file");
setupOptionsAddAttachmentFile(); setupAddAttachmentFile();
popHandler(); // key: file popHandler(); // key: file
pushKey("creationdate"); pushKey("creationdate");
addParameter([this](char const* p) { c_att->creationdate(p); }); addParameter([this](char const* p) { c_att->creationdate(p); });
@ -336,24 +322,24 @@ popHandler(); // key: moddate
pushKey("replace"); pushKey("replace");
addBare([this]() { c_att->replace(); }); addBare([this]() { c_att->replace(); });
popHandler(); // key: replace popHandler(); // key: replace
popHandler(); // array: .options.addAttachment[] popHandler(); // array: .addAttachment[]
popHandler(); // key: addAttachment popHandler(); // key: addAttachment
pushKey("removeAttachment"); pushKey("removeAttachment");
addParameter([this](char const* p) { c_main->removeAttachment(p); }); addParameter([this](char const* p) { c_main->removeAttachment(p); });
popHandler(); // key: removeAttachment popHandler(); // key: removeAttachment
pushKey("copyAttachmentsFrom"); pushKey("copyAttachmentsFrom");
beginArray(bindJSON(&Handlers::beginOptionsCopyAttachmentsFromArray), bindBare(&Handlers::endOptionsCopyAttachmentsFromArray)); // .options.copyAttachmentsFrom[] beginArray(bindJSON(&Handlers::beginCopyAttachmentsFromArray), bindBare(&Handlers::endCopyAttachmentsFromArray)); // .copyAttachmentsFrom[]
beginDict(bindJSON(&Handlers::beginOptionsCopyAttachmentsFrom), bindBare(&Handlers::endOptionsCopyAttachmentsFrom)); // .options.copyAttachmentsFrom beginDict(bindJSON(&Handlers::beginCopyAttachmentsFrom), bindBare(&Handlers::endCopyAttachmentsFrom)); // .copyAttachmentsFrom
pushKey("file"); pushKey("file");
setupOptionsCopyAttachmentsFromFile(); setupCopyAttachmentsFromFile();
popHandler(); // key: file popHandler(); // key: file
pushKey("password"); pushKey("password");
setupOptionsCopyAttachmentsFromPassword(); setupCopyAttachmentsFromPassword();
popHandler(); // key: password popHandler(); // key: password
pushKey("prefix"); pushKey("prefix");
addParameter([this](char const* p) { c_copy_att->prefix(p); }); addParameter([this](char const* p) { c_copy_att->prefix(p); });
popHandler(); // key: prefix popHandler(); // key: prefix
popHandler(); // array: .options.copyAttachmentsFrom[] popHandler(); // array: .copyAttachmentsFrom[]
popHandler(); // key: copyAttachmentsFrom popHandler(); // key: copyAttachmentsFrom
pushKey("collate"); pushKey("collate");
addParameter([this](char const* p) { c_main->collate(p); }); addParameter([this](char const* p) { c_main->collate(p); });
@ -383,18 +369,18 @@ pushKey("optimizeImages");
addBare([this]() { c_main->optimizeImages(); }); addBare([this]() { c_main->optimizeImages(); });
popHandler(); // key: optimizeImages popHandler(); // key: optimizeImages
pushKey("pages"); pushKey("pages");
beginArray(bindJSON(&Handlers::beginOptionsPagesArray), bindBare(&Handlers::endOptionsPagesArray)); // .options.pages[] beginArray(bindJSON(&Handlers::beginPagesArray), bindBare(&Handlers::endPagesArray)); // .pages[]
beginDict(bindJSON(&Handlers::beginOptionsPages), bindBare(&Handlers::endOptionsPages)); // .options.pages beginDict(bindJSON(&Handlers::beginPages), bindBare(&Handlers::endPages)); // .pages
pushKey("file"); pushKey("file");
setupOptionsPagesFile(); setupPagesFile();
popHandler(); // key: file popHandler(); // key: file
pushKey("password"); pushKey("password");
setupOptionsPagesPassword(); setupPagesPassword();
popHandler(); // key: password popHandler(); // key: password
pushKey("range"); pushKey("range");
setupOptionsPagesRange(); setupPagesRange();
popHandler(); // key: range popHandler(); // key: range
popHandler(); // array: .options.pages[] popHandler(); // array: .pages[]
popHandler(); // key: pages popHandler(); // key: pages
pushKey("removePageLabels"); pushKey("removePageLabels");
addBare([this]() { c_main->removePageLabels(); }); addBare([this]() { c_main->removePageLabels(); });
@ -403,12 +389,12 @@ pushKey("rotate");
addParameter([this](char const* p) { c_main->rotate(p); }); addParameter([this](char const* p) { c_main->rotate(p); });
popHandler(); // key: rotate popHandler(); // key: rotate
pushKey("overlay"); pushKey("overlay");
beginDict(bindJSON(&Handlers::beginOptionsOverlay), bindBare(&Handlers::endOptionsOverlay)); // .options.overlay beginDict(bindJSON(&Handlers::beginOverlay), bindBare(&Handlers::endOverlay)); // .overlay
pushKey("file"); pushKey("file");
setupOptionsOverlayFile(); setupOverlayFile();
popHandler(); // key: file popHandler(); // key: file
pushKey("password"); pushKey("password");
setupOptionsOverlayPassword(); setupOverlayPassword();
popHandler(); // key: password popHandler(); // key: password
pushKey("from"); pushKey("from");
addParameter([this](char const* p) { c_uo->from(p); }); addParameter([this](char const* p) { c_uo->from(p); });
@ -421,12 +407,12 @@ addParameter([this](char const* p) { c_uo->to(p); });
popHandler(); // key: to popHandler(); // key: to
popHandler(); // key: overlay popHandler(); // key: overlay
pushKey("underlay"); pushKey("underlay");
beginDict(bindJSON(&Handlers::beginOptionsUnderlay), bindBare(&Handlers::endOptionsUnderlay)); // .options.underlay beginDict(bindJSON(&Handlers::beginUnderlay), bindBare(&Handlers::endUnderlay)); // .underlay
pushKey("file"); pushKey("file");
setupOptionsUnderlayFile(); setupUnderlayFile();
popHandler(); // key: file popHandler(); // key: file
pushKey("password"); pushKey("password");
setupOptionsUnderlayPassword(); setupUnderlayPassword();
popHandler(); // key: password popHandler(); // key: password
pushKey("from"); pushKey("from");
addParameter([this](char const* p) { c_uo->from(p); }); addParameter([this](char const* p) { c_uo->from(p); });
@ -438,4 +424,18 @@ pushKey("to");
addParameter([this](char const* p) { c_uo->to(p); }); addParameter([this](char const* p) { c_uo->to(p); });
popHandler(); // key: to popHandler(); // key: to
popHandler(); // key: underlay popHandler(); // key: underlay
popHandler(); // key: options pushKey("warningExit0");
addBare([this]() { c_main->warningExit0(); });
popHandler(); // key: warningExit0
pushKey("jobJsonFile");
addParameter([this](char const* p) { c_main->jobJsonFile(p); });
popHandler(); // key: jobJsonFile
pushKey("preserveUnreferencedResources");
addBare([this]() { c_main->preserveUnreferencedResources(); });
popHandler(); // key: preserveUnreferencedResources
pushKey("requiresPassword");
addBare([this]() { c_main->requiresPassword(); });
popHandler(); // key: requiresPassword
pushKey("isEncrypted");
addBare([this]() { c_main->isEncrypted(); });
popHandler(); // key: isEncrypted

View File

@ -1,164 +1,159 @@
static constexpr char const* JOB_SCHEMA_DATA = R"({ static constexpr char const* JOB_SCHEMA_DATA = R"({
"input": { "inputFile": "input filename",
"file": "input filename", "password": "specify password",
"password": "specify password", "passwordFile": "read password from a file",
"passwordFile": "read password from a file", "empty": "empty input file",
"empty": "empty input file" "outputFile": "output filename",
}, "replaceInput": "replace input with output",
"output": { "qdf": "enable viewing PDF code in a text editor",
"file": "output filename", "preserveUnreferenced": "preserve unreferenced objects",
"replaceInput": "set to true to replace input", "newlineBeforeEndstream": "force a newline before endstream",
"options": { "normalizeContent": "fix newlines in content streams",
"qdf": "enable viewing PDF code in a text editor", "streamData": "control stream compression",
"preserveUnreferenced": "preserve unreferenced objects", "compressStreams": "compress uncompressed streams",
"newlineBeforeEndstream": "force a newline before endstream", "recompressFlate": "uncompress and recompress flate",
"normalizeContent": "fix newlines in content streams", "decodeLevel": "control which streams to uncompress",
"streamData": "control stream compression", "decrypt": "remove encryption from input file",
"compressStreams": "compress uncompressed streams", "deterministicId": "generate ID deterministically",
"recompressFlate": "uncompress and recompress flate", "staticAesIv": "use a fixed AES vector",
"decodeLevel": "control which streams to uncompress", "staticId": "use a fixed document ID",
"decrypt": "remove encryption from input file", "noOriginalObjectIds": "omit original object IDs in qdf",
"deterministicId": "generate ID deterministically", "copyEncryption": "copy another file's encryption details",
"staticAesIv": "use a fixed AES vector", "encryptionFilePassword": "supply password for copyEncryption",
"staticId": "use a fixed document ID", "linearize": "linearize (web-optimize) output",
"noOriginalObjectIds": "omit original object IDs in qdf", "linearizePass1": "save pass 1 of linearization",
"copyEncryption": "copy another file's encryption details", "objectStreams": "control use of object streams",
"encryptionFilePassword": "supply password for copyEncryption", "minVersion": "set minimum PDF version",
"linearize": "linearize (web-optimize) output", "forceVersion": "set output PDF version",
"linearizePass1": "save pass 1 of linearization", "progress": "show progress when writing",
"objectStreams": "control use of object streams", "splitPages": "write pages to separate files",
"minVersion": "set minimum PDF version", "encrypt": {
"forceVersion": "set output PDF version", "userPassword": "user password",
"progress": "show progress when writing", "ownerPassword": "owner password",
"splitPages": "write pages to separate files", "40bit": {
"encrypt": { "annotate": "restrict document annotation",
"userPassword": "user password", "extract": "restrict text/graphic extraction",
"ownerPassword": "owner password", "modify": "restrict document modification",
"40bit": { "print": "restrict printing"
"annotate": "restrict document annotation",
"extract": "restrict text/graphic extraction",
"modify": "restrict document modification",
"print": "restrict printing"
},
"128bit": {
"accessibility": "restrict document accessibility",
"annotate": "restrict document annotation",
"assemble": "restrict document assembly",
"cleartextMetadata": "don't encrypt metadata",
"extract": "restrict text/graphic extraction",
"form": "restrict form filling",
"modifyOther": "restrict other modifications",
"modify": "restrict document modification",
"print": "restrict printing",
"forceV4": "force V=4 in encryption dictionary",
"useAes": "use AES with 128-bit encryption"
},
"256bit": {
"accessibility": "restrict document accessibility",
"annotate": "restrict document annotation",
"assemble": "restrict document assembly",
"cleartextMetadata": "don't encrypt metadata",
"extract": "restrict text/graphic extraction",
"form": "restrict form filling",
"modifyOther": "restrict other modifications",
"modify": "restrict document modification",
"print": "restrict printing",
"allowInsecure": "allow empty owner passwords",
"forceR5": "use unsupported R=5 encryption"
}
}
}
},
"inspect": {
"check": "partially check whether PDF is valid",
"checkLinearization": "check linearization tables",
"filteredStreamData": "show filtered stream data",
"rawStreamData": "show raw stream data",
"showEncryption": "information about encrypted files",
"showEncryptionKey": "show key with showEncryption",
"showLinearization": "show linearization hint tables",
"showNpages": "show number of pages",
"showObject": "show contents of an object",
"showPages": "display page dictionary information",
"showXref": "show cross reference data",
"withImages": "include image details with showPages",
"listAttachments": "list embedded files",
"showAttachment": "export an embedded file",
"json": "show file in json format",
"jsonKey": [
"restrict which keys are in json output"
],
"jsonObject": [
"restrict which objects are in JSON"
]
},
"options": {
"allowWeakCrypto": "allow insecure cryptographic algorithms",
"keepFilesOpen": "manage keeping multiple files open",
"keepFilesOpenThreshold": "set threshold for keepFilesOpen",
"noWarn": "suppress printing of warning messages",
"verbose": "print additional information",
"ignoreXrefStreams": "use xref tables rather than streams",
"passwordIsHexKey": "provide hex-encoded encryption key",
"passwordMode": "tweak how qpdf encodes passwords",
"suppressPasswordRecovery": "don't try different password encodings",
"suppressRecovery": "suppress error recovery",
"coalesceContents": "combine content streams",
"compressionLevel": "set compression level for flate",
"externalizeInlineImages": "convert inline to regular images",
"iiMinBytes": "set minimum size for externalizeInlineImages",
"removeUnreferencedResources": "remove unreferenced page resources",
"addAttachment": [
{
"file": "attachment to add",
"creationdate": "set attachment's creation date",
"description": "set attachment's description",
"filename": "set attachment's displayed filename",
"key": "specify attachment key",
"mimetype": "attachment mime type, e.g. application/pdf",
"moddate": "set attachment's modification date",
"replace": "replace attachment with same key"
}
],
"removeAttachment": "remove an embedded file",
"copyAttachmentsFrom": [
{
"file": "attachment source filename",
"password": "specify password",
"prefix": "key prefix for copying attachments"
}
],
"collate": "collate with pages",
"flattenAnnotations": "push annotations into content",
"flattenRotation": "remove rotation from page dictionary",
"generateAppearances": "generate appearances for form fields",
"keepInlineImages": "exclude inline images from optimization",
"oiMinArea": "minimum area for optimizeImages",
"oiMinHeight": "minimum height for optimizeImages",
"oiMinWidth": "minimum width for optimizeImages",
"optimizeImages": "use efficient compression for images",
"pages": [
{
"file": "source for for pages",
"password": "specify password",
"range": "page range"
}
],
"removePageLabels": "remove explicit page numbers",
"rotate": "rotate pages",
"overlay": {
"file": "source file for overlay",
"password": "specify password",
"from": "source pages for underlay/overlay",
"repeat": "overlay/underlay pages to repeat",
"to": "destination pages for underlay/overlay"
}, },
"underlay": { "128bit": {
"file": "source file for underlay", "accessibility": "restrict document accessibility",
"password": "specify password", "annotate": "restrict document annotation",
"from": "source pages for underlay/overlay", "assemble": "restrict document assembly",
"repeat": "overlay/underlay pages to repeat", "cleartextMetadata": "don't encrypt metadata",
"to": "destination pages for underlay/overlay" "extract": "restrict text/graphic extraction",
"form": "restrict form filling",
"modifyOther": "restrict other modifications",
"modify": "restrict document modification",
"print": "restrict printing",
"forceV4": "force V=4 in encryption dictionary",
"useAes": "use AES with 128-bit encryption"
},
"256bit": {
"accessibility": "restrict document accessibility",
"annotate": "restrict document annotation",
"assemble": "restrict document assembly",
"cleartextMetadata": "don't encrypt metadata",
"extract": "restrict text/graphic extraction",
"form": "restrict form filling",
"modifyOther": "restrict other modifications",
"modify": "restrict document modification",
"print": "restrict printing",
"allowInsecure": "allow empty owner passwords",
"forceR5": "use unsupported R=5 encryption"
} }
} },
"check": "partially check whether PDF is valid",
"checkLinearization": "check linearization tables",
"filteredStreamData": "show filtered stream data",
"rawStreamData": "show raw stream data",
"showEncryption": "information about encrypted files",
"showEncryptionKey": "show key with showEncryption",
"showLinearization": "show linearization hint tables",
"showNpages": "show number of pages",
"showObject": "show contents of an object",
"showPages": "display page dictionary information",
"showXref": "show cross reference data",
"withImages": "include image details with showPages",
"listAttachments": "list embedded files",
"showAttachment": "export an embedded file",
"json": "show file in json format",
"jsonKey": [
"restrict which keys are in json output"
],
"jsonObject": [
"restrict which objects are in JSON"
],
"allowWeakCrypto": "allow insecure cryptographic algorithms",
"keepFilesOpen": "manage keeping multiple files open",
"keepFilesOpenThreshold": "set threshold for keepFilesOpen",
"noWarn": "suppress printing of warning messages",
"verbose": "print additional information",
"ignoreXrefStreams": "use xref tables rather than streams",
"passwordIsHexKey": "provide hex-encoded encryption key",
"passwordMode": "tweak how qpdf encodes passwords",
"suppressPasswordRecovery": "don't try different password encodings",
"suppressRecovery": "suppress error recovery",
"coalesceContents": "combine content streams",
"compressionLevel": "set compression level for flate",
"externalizeInlineImages": "convert inline to regular images",
"iiMinBytes": "set minimum size for externalizeInlineImages",
"removeUnreferencedResources": "remove unreferenced page resources",
"addAttachment": [
{
"file": "attachment to add",
"creationdate": "set attachment's creation date",
"description": "set attachment's description",
"filename": "set attachment's displayed filename",
"key": "specify attachment key",
"mimetype": "attachment mime type, e.g. application/pdf",
"moddate": "set attachment's modification date",
"replace": "replace attachment with same key"
}
],
"removeAttachment": "remove an embedded file",
"copyAttachmentsFrom": [
{
"file": "attachment source filename",
"password": "specify password",
"prefix": "key prefix for copying attachments"
}
],
"collate": "collate with pages",
"flattenAnnotations": "push annotations into content",
"flattenRotation": "remove rotation from page dictionary",
"generateAppearances": "generate appearances for form fields",
"keepInlineImages": "exclude inline images from optimization",
"oiMinArea": "minimum area for optimizeImages",
"oiMinHeight": "minimum height for optimizeImages",
"oiMinWidth": "minimum width for optimizeImages",
"optimizeImages": "use efficient compression for images",
"pages": [
{
"file": "source for for pages",
"password": "specify password",
"range": "page range"
}
],
"removePageLabels": "remove explicit page numbers",
"rotate": "rotate pages",
"overlay": {
"file": "source file for overlay",
"password": "specify password",
"from": "source pages for underlay/overlay",
"repeat": "overlay/underlay pages to repeat",
"to": "destination pages for underlay/overlay"
},
"underlay": {
"file": "source file for underlay",
"password": "specify password",
"from": "source pages for underlay/overlay",
"repeat": "overlay/underlay pages to repeat",
"to": "destination pages for underlay/overlay"
},
"warningExit0": "exit 0 even with warnings",
"jobJsonFile": "job JSON file",
"preserveUnreferencedResources": "use removeUnreferencedResourcesNo",
"requiresPassword": "silently test a file's password",
"isEncrypted": "silently test whether a file is encrypted"
})"; })";

View File

@ -1,5 +1,5 @@
qpdf: error with job-json file bad-json-bare-option-false.json: .output.options.qdf: value must be true qpdf: error with job-json file bad-json-bare-option-false.json: .qdf: value must be true
Run qpdf--job-json-help for information on the file format. Run qpdf--job-json-help for information on the file format.
For help: For help:

View File

@ -1,5 +1,5 @@
qpdf: error with job-json file bad-json-choice-mismatch.json: .output.options.objectStreams: unexpected value; expected one of disable, preserve, generate qpdf: error with job-json file bad-json-choice-mismatch.json: .objectStreams: unexpected value; expected one of disable, preserve, generate
Run qpdf--job-json-help for information on the file format. Run qpdf--job-json-help for information on the file format.
For help: For help:

View File

@ -1,7 +1,3 @@
{ {
"output": { "qdf": false
"options": {
"qdf": false
}
}
} }

View File

@ -1,7 +1,3 @@
{ {
"output": { "objectStreams": "potato"
"options": {
"objectStreams": "potato"
}
}
} }

View File

@ -1,14 +1,10 @@
{ {
"output": { "encrypt": {
"options": { "userPassword": "",
"encrypt": { "ownerPassword": "someOwnerThing",
"userPassword": "", "256bit": {
"ownerPassword": "someOwnerThing", },
"256bit": { "128bit": {
},
"128bit": {
}
}
} }
} }
} }

View File

@ -1,11 +1,7 @@
{ {
"output": { "encrypt": {
"options": { "userPassword": "",
"encrypt": { "256bit": {
"userPassword": "",
"256bit": {
}
}
} }
} }
} }

View File

@ -1,10 +1,6 @@
{ {
"output": { "encrypt": {
"options": { "userPassword": "",
"encrypt": { "ownerPassword": "someOwnerThing"
"userPassword": "",
"ownerPassword": "someOwnerThing"
}
}
} }
} }

View File

@ -1,5 +1,5 @@
qpdf: error with job-json file bad-json-json-error.json: JSON: offset 130: unexpected dictionary end delimiter qpdf: error with job-json file bad-json-json-error.json: JSON: offset 83: unexpected dictionary end delimiter
Run qpdf--job-json-help for information on the file format. Run qpdf--job-json-help for information on the file format.
For help: For help:

View File

@ -1,10 +1,6 @@
{ {
"output": { "encrypt": {
"options": { "userPassword": "",
"encrypt": { "ownerPassword": "someOwnerThing",
"userPassword": "",
"ownerPassword": "someOwnerThing",
}
}
} }
} }

View File

@ -1,9 +1,7 @@
{ {
"options": { "pages": [
"pages": [ {
{ "range": "1-z"
"range": "1-z" }
} ]
]
}
} }

View File

@ -1,12 +1,10 @@
{ {
"output": { "potato": {
"potato": { },
"encrypt": { "encrypt": {
"userPassword": "", "userPassword": "",
"ownerPassword": "someOwnerThing", "ownerPassword": "someOwnerThing",
"256bit": { "256bit": {
}
}
} }
} }
} }

View File

@ -1,6 +1,6 @@
qpdf: error with job-json file bad-json-schema-error.json: qpdf: job json has errors: qpdf: error with job-json file bad-json-schema-error.json: qpdf: job json has errors:
json key ".output": key "potato" is not present in schema but appears in object top-level object: key "potato" is not present in schema but appears in object
Run qpdf--job-json-help for information on the file format. Run qpdf--job-json-help for information on the file format.
For help: For help:

View File

@ -1,27 +1,19 @@
{ {
"input": { "inputFile": "minimal.pdf",
"file": "minimal.pdf" "outputFile": "a.pdf",
}, "staticId": true,
"output": { "addAttachment": [
"file": "a.pdf", {
"options": { "file": "auto-txt",
"staticId": true "moddate": "D:20220131134246-05'00'",
"creationdate": "D:20220131134246-05'00'"
},
{
"file": "auto-txt",
"moddate": "D:20220131134246-05'00'",
"creationdate": "D:20220131134246-05'00'",
"filename": "auto2",
"key": "auto2-key"
} }
}, ]
"options": {
"addAttachment": [
{
"file": "auto-txt",
"moddate": "D:20220131134246-05'00'",
"creationdate": "D:20220131134246-05'00'"
},
{
"file": "auto-txt",
"moddate": "D:20220131134246-05'00'",
"creationdate": "D:20220131134246-05'00'",
"filename": "auto2",
"key": "auto2-key"
}
]
}
} }

View File

@ -1,12 +1,6 @@
{ {
"input": { "inputFile": "minimal.pdf",
"file": "minimal.pdf" "outputFile": "a.pdf",
}, "deterministicId": true,
"output": { "objectStreams": "generate"
"file": "a.pdf",
"options": {
"deterministicId": true,
"objectStreams": "generate"
}
}
} }

View File

@ -1,26 +1,18 @@
{ {
"input": { "inputFile": "minimal.pdf",
"file": "minimal.pdf" "outputFile": "a.pdf",
}, "staticId": true,
"output": { "copyAttachmentsFrom": [
"file": "a.pdf", {
"options": { "file": "job-json-add-attachments.pdf"
"staticId": true },
{
"file": "20-pages.pdf",
"password": "user"
},
{
"file": "job-json-add-attachments.pdf",
"prefix": "p-"
} }
}, ]
"options": {
"copyAttachmentsFrom": [
{
"file": "job-json-add-attachments.pdf"
},
{
"file": "20-pages.pdf",
"password": "user"
},
{
"file": "job-json-add-attachments.pdf",
"prefix": "p-"
}
]
}
} }

View File

@ -1,23 +1,15 @@
{ {
"input": { "empty": true,
"empty": true "outputFile": "a.pdf",
}, "staticId": true,
"output": { "pages": [
"file": "a.pdf", {
"options": { "file": "minimal.pdf"
"staticId": true },
{
"file": "20-pages.pdf",
"password": "user",
"range": "1-5"
} }
}, ]
"options": {
"pages": [
{
"file": "minimal.pdf"
},
{
"file": "20-pages.pdf",
"password": "user",
"range": "1-5"
}
]
}
} }

View File

@ -1,19 +1,13 @@
{ {
"input": { "inputFile": "fxo-blue.pdf",
"file": "fxo-blue.pdf" "outputFile": "a.pdf",
}, "staticId": true,
"output": { "staticAesIv": true,
"file": "a.pdf", "encrypt": {
"options": { "userPassword": "u",
"staticId": true, "ownerPassword": "o",
"staticAesIv": true, "128bit": {
"encrypt": { "useAes": "y"
"userPassword": "u",
"ownerPassword": "o",
"128bit": {
"useAes": "y"
}
}
} }
} }
} }

View File

@ -1,20 +1,14 @@
{ {
"input": { "inputFile": "minimal.pdf",
"file": "minimal.pdf" "outputFile": "a.pdf",
}, "staticId": true,
"output": { "staticAesIv": true,
"file": "a.pdf", "encrypt": {
"options": { "userPassword": "u",
"staticId": true, "ownerPassword": "o",
"staticAesIv": true, "256bit": {
"encrypt": { "print": "low",
"userPassword": "u", "modify": "form"
"ownerPassword": "o",
"256bit": {
"print": "low",
"modify": "form"
}
}
} }
} }
} }

View File

@ -1,19 +1,11 @@
{ {
"input": { "inputFile": "minimal.pdf",
"file": "minimal.pdf" "outputFile": "a.pdf",
"staticId": true,
"encrypt": {
"userPassword": "u",
"ownerPassword": "o",
"40bit": {}
}, },
"output": { "allowWeakCrypto": true
"file": "a.pdf",
"options": {
"staticId": true,
"encrypt": {
"userPassword": "u",
"ownerPassword": "o",
"40bit": {}
}
}
},
"options": {
"allowWeakCrypto": true
}
} }

View File

@ -1,14 +1,8 @@
{ {
"input": { "inputFile": "20-pages.pdf",
"file": "20-pages.pdf", "password": "user",
"password": "user" "outputFile": "a.pdf",
}, "staticId": true,
"output": { "staticAesIv": true,
"file": "a.pdf", "compressStreams": "n"
"options": {
"staticId": true,
"staticAesIv": true,
"compressStreams": "n"
}
}
} }

View File

@ -1,13 +1,7 @@
{ {
"input": { "inputFile": "minimal.pdf",
"file": "minimal.pdf" "outputFile": "a.pdf",
}, "staticId": true,
"output": { "linearize": true,
"file": "a.pdf", "compressStreams": "n"
"options": {
"staticId": true,
"linearize": true,
"compressStreams": "n"
}
}
} }

View File

@ -1,16 +1,12 @@
{ {
"input": { "inputFile": "minimal.pdf",
"file": "minimal.pdf" "json": "1",
}, "jsonKey": [
"inspect": { "pages",
"json": "1", "objects"
"jsonKey": [ ],
"pages", "jsonObject": [
"objects" "trailer",
], "5"
"jsonObject": [ ]
"trailer",
"5"
]
}
} }

View File

@ -1,12 +1,6 @@
{ {
"input": { "inputFile": "a.pdf",
"file": "a.pdf" "replaceInput": true,
}, "staticId": true,
"output": { "objectStreams": "generate"
"replaceInput": true,
"options": {
"staticId": true,
"objectStreams": "generate"
}
}
} }

View File

@ -1,23 +1,15 @@
{ {
"input": { "inputFile": "minimal.pdf",
"file": "minimal.pdf" "outputFile": "a.pdf",
"staticId": true,
"underlay": {
"file": "20-pages.pdf",
"password": "user",
"from": "5"
}, },
"output": { "overlay": {
"file": "a.pdf", "file": "job-json-encrypt-128.pdf",
"options": { "password": "o",
"staticId": true "from": "7"
}
},
"options": {
"underlay": {
"file": "20-pages.pdf",
"password": "user",
"from": "5"
},
"overlay": {
"file": "job-json-encrypt-128.pdf",
"password": "o",
"from": "7"
}
} }
} }

View File

@ -1,23 +1,15 @@
{ {
"input": { "inputFile": "20-pages.pdf",
"file": "20-pages.pdf", "password": "owner",
"password": "owner" "outputFile": "a.pdf",
"staticId": true,
"decrypt": true,
"underlay": {
"file": "fxo-green.pdf"
}, },
"output": { "overlay": {
"file": "a.pdf", "file": "fxo-red.pdf",
"options": { "from": "1,2",
"staticId": true, "repeat": "3"
"decrypt": true
}
},
"options": {
"underlay": {
"file": "fxo-green.pdf"
},
"overlay": {
"file": "fxo-red.pdf",
"from": "1,2",
"repeat": "3"
}
} }
} }

View File

@ -1,12 +1,8 @@
{ {
"output": { "encrypt": {
"options": { "userPassword": "",
"encrypt": { "ownerPassword": "",
"userPassword": "", "256bit": {
"ownerPassword": "",
"256bit": {
}
}
} }
} }
} }

View File

@ -1,5 +1,3 @@
{ {
"inspect": { "showEncryption": true
"showEncryption": true
}
} }