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 | 7 | include/qpdf/auto_job_c_main.hh dbfc221d1533120d1aa9c361d8d2483dea5fcb1c0fd95144d98d305e64ed32a6 |
| 8 | 8 | include/qpdf/auto_job_c_pages.hh 09ca15649cc94fdaf6d9bdae28a20723f2a66616bf15aa86d83df31051d82506 |
| 9 | 9 | include/qpdf/auto_job_c_uo.hh 9c2f98a355858dd54d0bba444b73177a59c9e56833e02fa6406f429c07f39e62 |
| 10 | -job.yml 790dd0f62f124a6cc97cc54bae992a1f1b1f3a9b4f0294bcf123868f3d3b39d3 | |
| 10 | +job.yml 53cad86659db6722e8f415aacb19fc51ab81bb1589c3cb8f65ec893bb4bf5566 | |
| 11 | 11 | libqpdf/qpdf/auto_job_decl.hh 20d6affe1e260f5a1af4f1d82a820b933835440ff03020e877382da2e8dac6c6 |
| 12 | 12 | libqpdf/qpdf/auto_job_help.hh 5808d936f6cd41af278ca298ed0c0762ce0a16956cbe1757a40e4443485cf31e |
| 13 | 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 | 17 | manual/_ext/qpdf.py 6add6321666031d55ed4aedf7c00e5662bba856dfcd66ccb526563bffefbb580 |
| 18 | 18 | manual/cli.rst 0e6a957defa4839abb9a69414de6a5ec5524fd6ff56fe9abf8f241bee54813e2 |
| 19 | 19 | manual/qpdf.1 7250b4e26033fca6b6b9cb23a51e1f46c26f8033663901d4af06b451e287e814 | ... | ... |
job.yml
| ... | ... | @@ -446,17 +446,17 @@ json: |
| 446 | 446 | set-page-labels: |
| 447 | 447 | - null |
| 448 | 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 | 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 | 460 | warning-exit-0: |
| 461 | 461 | job-json-file: |
| 462 | 462 | preserve-unreferenced-resources: | ... | ... |
libqpdf/QPDFJob_json.cc
| ... | ... | @@ -522,6 +522,18 @@ Handlers::setupPagesPassword() |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 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 | 537 | Handlers::beginOverlay(JSON j) |
| 526 | 538 | { |
| 527 | 539 | this->c_uo = c_main->overlay(); |
| ... | ... | @@ -549,6 +561,18 @@ Handlers::setupOverlayPassword() |
| 549 | 561 | } |
| 550 | 562 | |
| 551 | 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 | 576 | Handlers::beginUnderlay(JSON j) |
| 553 | 577 | { |
| 554 | 578 | this->c_uo = c_main->underlay(); | ... | ... |
libqpdf/qpdf/auto_job_json_decl.hh
| ... | ... | @@ -46,10 +46,14 @@ void setupPagesPassword(); |
| 46 | 46 | void beginSetPageLabelsArray(JSON); |
| 47 | 47 | void endSetPageLabelsArray(); |
| 48 | 48 | void setupSetPageLabels(); |
| 49 | +void beginOverlayArray(JSON); | |
| 50 | +void endOverlayArray(); | |
| 49 | 51 | void beginOverlay(JSON); |
| 50 | 52 | void endOverlay(); |
| 51 | 53 | void setupOverlayFile(); |
| 52 | 54 | void setupOverlayPassword(); |
| 55 | +void beginUnderlayArray(JSON); | |
| 56 | +void endUnderlayArray(); | |
| 53 | 57 | void beginUnderlay(JSON); |
| 54 | 58 | void endUnderlay(); |
| 55 | 59 | void setupUnderlayFile(); | ... | ... |
libqpdf/qpdf/auto_job_json_init.hh
| ... | ... | @@ -427,6 +427,7 @@ setupSetPageLabels(); |
| 427 | 427 | popHandler(); // array: .setPageLabels[] |
| 428 | 428 | popHandler(); // key: setPageLabels |
| 429 | 429 | pushKey("overlay"); |
| 430 | +beginArray(bindJSON(&Handlers::beginOverlayArray), bindBare(&Handlers::endOverlayArray)); // .overlay[] | |
| 430 | 431 | beginDict(bindJSON(&Handlers::beginOverlay), bindBare(&Handlers::endOverlay)); // .overlay |
| 431 | 432 | pushKey("file"); |
| 432 | 433 | setupOverlayFile(); |
| ... | ... | @@ -443,8 +444,10 @@ popHandler(); // key: repeat |
| 443 | 444 | pushKey("to"); |
| 444 | 445 | addParameter([this](std::string const& p) { c_uo->to(p); }); |
| 445 | 446 | popHandler(); // key: to |
| 447 | +popHandler(); // array: .overlay[] | |
| 446 | 448 | popHandler(); // key: overlay |
| 447 | 449 | pushKey("underlay"); |
| 450 | +beginArray(bindJSON(&Handlers::beginUnderlayArray), bindBare(&Handlers::endUnderlayArray)); // .underlay[] | |
| 448 | 451 | beginDict(bindJSON(&Handlers::beginUnderlay), bindBare(&Handlers::endUnderlay)); // .underlay |
| 449 | 452 | pushKey("file"); |
| 450 | 453 | setupUnderlayFile(); |
| ... | ... | @@ -461,6 +464,7 @@ popHandler(); // key: repeat |
| 461 | 464 | pushKey("to"); |
| 462 | 465 | addParameter([this](std::string const& p) { c_uo->to(p); }); |
| 463 | 466 | popHandler(); // key: to |
| 467 | +popHandler(); // array: .underlay[] | |
| 464 | 468 | popHandler(); // key: underlay |
| 465 | 469 | pushKey("warningExit0"); |
| 466 | 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 | 151 | "setPageLabels": [ |
| 152 | 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 | 172 | "warningExit0": "exit 0 even with warnings", |
| 169 | 173 | "jobJsonFile": "job JSON file", |
| 170 | 174 | "preserveUnreferencedResources": "use removeUnreferencedResources=no", | ... | ... |