Commit 6cf04b0a8863512765864287271248a61eac6214
1 parent
0161f62e
Allow repetition of overlay/underlay
This is just QPDFJob wiring.
Showing
6 changed files
with
64 additions
and
28 deletions
job.sums
| @@ -7,13 +7,13 @@ include/qpdf/auto_job_c_enc.hh 28446f3c32153a52afa239ea40503e6cc8ac2c026813526a3 | @@ -7,13 +7,13 @@ include/qpdf/auto_job_c_enc.hh 28446f3c32153a52afa239ea40503e6cc8ac2c026813526a3 | ||
| 7 | include/qpdf/auto_job_c_main.hh dbfc221d1533120d1aa9c361d8d2483dea5fcb1c0fd95144d98d305e64ed32a6 | 7 | include/qpdf/auto_job_c_main.hh dbfc221d1533120d1aa9c361d8d2483dea5fcb1c0fd95144d98d305e64ed32a6 |
| 8 | include/qpdf/auto_job_c_pages.hh 09ca15649cc94fdaf6d9bdae28a20723f2a66616bf15aa86d83df31051d82506 | 8 | include/qpdf/auto_job_c_pages.hh 09ca15649cc94fdaf6d9bdae28a20723f2a66616bf15aa86d83df31051d82506 |
| 9 | include/qpdf/auto_job_c_uo.hh 9c2f98a355858dd54d0bba444b73177a59c9e56833e02fa6406f429c07f39e62 | 9 | include/qpdf/auto_job_c_uo.hh 9c2f98a355858dd54d0bba444b73177a59c9e56833e02fa6406f429c07f39e62 |
| 10 | -job.yml 790dd0f62f124a6cc97cc54bae992a1f1b1f3a9b4f0294bcf123868f3d3b39d3 | 10 | +job.yml 53cad86659db6722e8f415aacb19fc51ab81bb1589c3cb8f65ec893bb4bf5566 |
| 11 | libqpdf/qpdf/auto_job_decl.hh 20d6affe1e260f5a1af4f1d82a820b933835440ff03020e877382da2e8dac6c6 | 11 | libqpdf/qpdf/auto_job_decl.hh 20d6affe1e260f5a1af4f1d82a820b933835440ff03020e877382da2e8dac6c6 |
| 12 | libqpdf/qpdf/auto_job_help.hh 5808d936f6cd41af278ca298ed0c0762ce0a16956cbe1757a40e4443485cf31e | 12 | libqpdf/qpdf/auto_job_help.hh 5808d936f6cd41af278ca298ed0c0762ce0a16956cbe1757a40e4443485cf31e |
| 13 | libqpdf/qpdf/auto_job_init.hh 19d1da7c4c0c635bd1c5db8d5f17df8edad3442f8eba006adb075cec295fa158 | 13 | libqpdf/qpdf/auto_job_init.hh 19d1da7c4c0c635bd1c5db8d5f17df8edad3442f8eba006adb075cec295fa158 |
| 14 | -libqpdf/qpdf/auto_job_json_decl.hh 7c7fbf9f7fdf7a1f5f7cedb09af16b8dcf30b6860947bd38c970385b05d22fc1 | ||
| 15 | -libqpdf/qpdf/auto_job_json_init.hh 436567565691252d62a1852564729925ef996e78eba9ea3d947829c05f72a309 | ||
| 16 | -libqpdf/qpdf/auto_job_schema.hh 30dcb22bfa76d731dfa2cc2a226d7deaa25145f964b19ab44161356c909e4dc1 | 14 | +libqpdf/qpdf/auto_job_json_decl.hh 843892c8e8652a86b7eb573893ef24050b7f36fe313f7251874be5cd4cdbe3fd |
| 15 | +libqpdf/qpdf/auto_job_json_init.hh a87256c082427ec0318223762472970b2eced535c0c8b0288d45c8cdaaf62f74 | ||
| 16 | +libqpdf/qpdf/auto_job_schema.hh 5dac568dff39614e161a0af59a0f328f1e28edf69b96f08bb76fd592d51bb053 | ||
| 17 | manual/_ext/qpdf.py 6add6321666031d55ed4aedf7c00e5662bba856dfcd66ccb526563bffefbb580 | 17 | manual/_ext/qpdf.py 6add6321666031d55ed4aedf7c00e5662bba856dfcd66ccb526563bffefbb580 |
| 18 | manual/cli.rst 0e6a957defa4839abb9a69414de6a5ec5524fd6ff56fe9abf8f241bee54813e2 | 18 | manual/cli.rst 0e6a957defa4839abb9a69414de6a5ec5524fd6ff56fe9abf8f241bee54813e2 |
| 19 | manual/qpdf.1 7250b4e26033fca6b6b9cb23a51e1f46c26f8033663901d4af06b451e287e814 | 19 | manual/qpdf.1 7250b4e26033fca6b6b9cb23a51e1f46c26f8033663901d4af06b451e287e814 |
job.yml
| @@ -446,17 +446,17 @@ json: | @@ -446,17 +446,17 @@ json: | ||
| 446 | set-page-labels: | 446 | set-page-labels: |
| 447 | - null | 447 | - null |
| 448 | overlay: | 448 | overlay: |
| 449 | - UO.file: | ||
| 450 | - UO.password: | ||
| 451 | - from: | ||
| 452 | - repeat: | ||
| 453 | - to: | 449 | + - UO.file: |
| 450 | + UO.password: | ||
| 451 | + from: | ||
| 452 | + repeat: | ||
| 453 | + to: | ||
| 454 | underlay: | 454 | underlay: |
| 455 | - UO.file: | ||
| 456 | - UO.password: | ||
| 457 | - from: | ||
| 458 | - repeat: | ||
| 459 | - to: | 455 | + - UO.file: |
| 456 | + UO.password: | ||
| 457 | + from: | ||
| 458 | + repeat: | ||
| 459 | + to: | ||
| 460 | warning-exit-0: | 460 | warning-exit-0: |
| 461 | job-json-file: | 461 | job-json-file: |
| 462 | preserve-unreferenced-resources: | 462 | preserve-unreferenced-resources: |
libqpdf/QPDFJob_json.cc
| @@ -522,6 +522,18 @@ Handlers::setupPagesPassword() | @@ -522,6 +522,18 @@ Handlers::setupPagesPassword() | ||
| 522 | } | 522 | } |
| 523 | 523 | ||
| 524 | void | 524 | void |
| 525 | +Handlers::beginOverlayArray(JSON) | ||
| 526 | +{ | ||
| 527 | + // nothing needed | ||
| 528 | +} | ||
| 529 | + | ||
| 530 | +void | ||
| 531 | +Handlers::endOverlayArray() | ||
| 532 | +{ | ||
| 533 | + // nothing needed | ||
| 534 | +} | ||
| 535 | + | ||
| 536 | +void | ||
| 525 | Handlers::beginOverlay(JSON j) | 537 | Handlers::beginOverlay(JSON j) |
| 526 | { | 538 | { |
| 527 | this->c_uo = c_main->overlay(); | 539 | this->c_uo = c_main->overlay(); |
| @@ -549,6 +561,18 @@ Handlers::setupOverlayPassword() | @@ -549,6 +561,18 @@ Handlers::setupOverlayPassword() | ||
| 549 | } | 561 | } |
| 550 | 562 | ||
| 551 | void | 563 | void |
| 564 | +Handlers::beginUnderlayArray(JSON) | ||
| 565 | +{ | ||
| 566 | + // nothing needed | ||
| 567 | +} | ||
| 568 | + | ||
| 569 | +void | ||
| 570 | +Handlers::endUnderlayArray() | ||
| 571 | +{ | ||
| 572 | + // nothing needed | ||
| 573 | +} | ||
| 574 | + | ||
| 575 | +void | ||
| 552 | Handlers::beginUnderlay(JSON j) | 576 | Handlers::beginUnderlay(JSON j) |
| 553 | { | 577 | { |
| 554 | this->c_uo = c_main->underlay(); | 578 | this->c_uo = c_main->underlay(); |
libqpdf/qpdf/auto_job_json_decl.hh
| @@ -46,10 +46,14 @@ void setupPagesPassword(); | @@ -46,10 +46,14 @@ void setupPagesPassword(); | ||
| 46 | void beginSetPageLabelsArray(JSON); | 46 | void beginSetPageLabelsArray(JSON); |
| 47 | void endSetPageLabelsArray(); | 47 | void endSetPageLabelsArray(); |
| 48 | void setupSetPageLabels(); | 48 | void setupSetPageLabels(); |
| 49 | +void beginOverlayArray(JSON); | ||
| 50 | +void endOverlayArray(); | ||
| 49 | void beginOverlay(JSON); | 51 | void beginOverlay(JSON); |
| 50 | void endOverlay(); | 52 | void endOverlay(); |
| 51 | void setupOverlayFile(); | 53 | void setupOverlayFile(); |
| 52 | void setupOverlayPassword(); | 54 | void setupOverlayPassword(); |
| 55 | +void beginUnderlayArray(JSON); | ||
| 56 | +void endUnderlayArray(); | ||
| 53 | void beginUnderlay(JSON); | 57 | void beginUnderlay(JSON); |
| 54 | void endUnderlay(); | 58 | void endUnderlay(); |
| 55 | void setupUnderlayFile(); | 59 | void setupUnderlayFile(); |
libqpdf/qpdf/auto_job_json_init.hh
| @@ -427,6 +427,7 @@ setupSetPageLabels(); | @@ -427,6 +427,7 @@ setupSetPageLabels(); | ||
| 427 | popHandler(); // array: .setPageLabels[] | 427 | popHandler(); // array: .setPageLabels[] |
| 428 | popHandler(); // key: setPageLabels | 428 | popHandler(); // key: setPageLabels |
| 429 | pushKey("overlay"); | 429 | pushKey("overlay"); |
| 430 | +beginArray(bindJSON(&Handlers::beginOverlayArray), bindBare(&Handlers::endOverlayArray)); // .overlay[] | ||
| 430 | beginDict(bindJSON(&Handlers::beginOverlay), bindBare(&Handlers::endOverlay)); // .overlay | 431 | beginDict(bindJSON(&Handlers::beginOverlay), bindBare(&Handlers::endOverlay)); // .overlay |
| 431 | pushKey("file"); | 432 | pushKey("file"); |
| 432 | setupOverlayFile(); | 433 | setupOverlayFile(); |
| @@ -443,8 +444,10 @@ popHandler(); // key: repeat | @@ -443,8 +444,10 @@ popHandler(); // key: repeat | ||
| 443 | pushKey("to"); | 444 | pushKey("to"); |
| 444 | addParameter([this](std::string const& p) { c_uo->to(p); }); | 445 | addParameter([this](std::string const& p) { c_uo->to(p); }); |
| 445 | popHandler(); // key: to | 446 | popHandler(); // key: to |
| 447 | +popHandler(); // array: .overlay[] | ||
| 446 | popHandler(); // key: overlay | 448 | popHandler(); // key: overlay |
| 447 | pushKey("underlay"); | 449 | pushKey("underlay"); |
| 450 | +beginArray(bindJSON(&Handlers::beginUnderlayArray), bindBare(&Handlers::endUnderlayArray)); // .underlay[] | ||
| 448 | beginDict(bindJSON(&Handlers::beginUnderlay), bindBare(&Handlers::endUnderlay)); // .underlay | 451 | beginDict(bindJSON(&Handlers::beginUnderlay), bindBare(&Handlers::endUnderlay)); // .underlay |
| 449 | pushKey("file"); | 452 | pushKey("file"); |
| 450 | setupUnderlayFile(); | 453 | setupUnderlayFile(); |
| @@ -461,6 +464,7 @@ popHandler(); // key: repeat | @@ -461,6 +464,7 @@ popHandler(); // key: repeat | ||
| 461 | pushKey("to"); | 464 | pushKey("to"); |
| 462 | addParameter([this](std::string const& p) { c_uo->to(p); }); | 465 | addParameter([this](std::string const& p) { c_uo->to(p); }); |
| 463 | popHandler(); // key: to | 466 | popHandler(); // key: to |
| 467 | +popHandler(); // array: .underlay[] | ||
| 464 | popHandler(); // key: underlay | 468 | popHandler(); // key: underlay |
| 465 | pushKey("warningExit0"); | 469 | pushKey("warningExit0"); |
| 466 | addBare([this]() { c_main->warningExit0(); }); | 470 | addBare([this]() { c_main->warningExit0(); }); |
libqpdf/qpdf/auto_job_schema.hh
| @@ -151,20 +151,24 @@ static constexpr char const* JOB_SCHEMA_DATA = R"({ | @@ -151,20 +151,24 @@ static constexpr char const* JOB_SCHEMA_DATA = R"({ | ||
| 151 | "setPageLabels": [ | 151 | "setPageLabels": [ |
| 152 | "number pages for the entire document" | 152 | "number pages for the entire document" |
| 153 | ], | 153 | ], |
| 154 | - "overlay": { | ||
| 155 | - "file": "source for pages", | ||
| 156 | - "password": "password for encrypted file", | ||
| 157 | - "from": "source pages for underlay/overlay", | ||
| 158 | - "repeat": "overlay/underlay pages to repeat", | ||
| 159 | - "to": "destination pages for underlay/overlay" | ||
| 160 | - }, | ||
| 161 | - "underlay": { | ||
| 162 | - "file": "source for pages", | ||
| 163 | - "password": "password for encrypted file", | ||
| 164 | - "from": "source pages for underlay/overlay", | ||
| 165 | - "repeat": "overlay/underlay pages to repeat", | ||
| 166 | - "to": "destination pages for underlay/overlay" | ||
| 167 | - }, | 154 | + "overlay": [ |
| 155 | + { | ||
| 156 | + "file": "source for pages", | ||
| 157 | + "password": "password for encrypted file", | ||
| 158 | + "from": "source pages for underlay/overlay", | ||
| 159 | + "repeat": "overlay/underlay pages to repeat", | ||
| 160 | + "to": "destination pages for underlay/overlay" | ||
| 161 | + } | ||
| 162 | + ], | ||
| 163 | + "underlay": [ | ||
| 164 | + { | ||
| 165 | + "file": "source for pages", | ||
| 166 | + "password": "password for encrypted file", | ||
| 167 | + "from": "source pages for underlay/overlay", | ||
| 168 | + "repeat": "overlay/underlay pages to repeat", | ||
| 169 | + "to": "destination pages for underlay/overlay" | ||
| 170 | + } | ||
| 171 | + ], | ||
| 168 | "warningExit0": "exit 0 even with warnings", | 172 | "warningExit0": "exit 0 even with warnings", |
| 169 | "jobJsonFile": "job JSON file", | 173 | "jobJsonFile": "job JSON file", |
| 170 | "preserveUnreferencedResources": "use removeUnreferencedResources=no", | 174 | "preserveUnreferencedResources": "use removeUnreferencedResources=no", |