diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-05-08 19:42:16 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-05-16 19:41:40 +0200 |
commit | 4fe2e06b4787ffb639f965ac840b51018308ec07 (patch) | |
tree | 667474624e264384d544cbed4324b909478f3450 /include | |
parent | ed6130036c65124cb236e709201330404a4b1d72 (diff) | |
download | qpdf-4fe2e06b4787ffb639f965ac840b51018308ec07.tar.zst |
Add --create-from-json and --update-from-json arguments
Also add stubs for top-level QPDF methods (createFromJSON,
updateFromJSON)
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDF.hh | 22 | ||||
-rw-r--r-- | include/qpdf/QPDFJob.hh | 4 | ||||
-rw-r--r-- | include/qpdf/auto_job_c_main.hh | 1 |
3 files changed, 27 insertions, 0 deletions
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index bbbb896e..5cba93a8 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -110,6 +110,28 @@ class QPDF void processInputSource(std::shared_ptr<InputSource>, char const* password = 0); + // Create a PDF from an input source that contains JSON as written + // by qpdf --json (version 2 or higher). The JSON must be a + // complete representation of a PDF. See "QPDF JSON Format" in the + // manual for details. + QPDF_DLL + void + createFromJSON(std::string const& json_file); + QPDF_DLL + void + createFromJSON(std::shared_ptr<InputSource>); + + // Update a PDF from an input source that contains JSON in the + // same format as is written by qpdf --json (version 2 or higher). + // Objects in the PDF and not in the JSON are not modified. See + // "QPDF JSON Format" in the manual for details. + QPDF_DLL + void + updateFromJSON(std::string const& json_file); + QPDF_DLL + void + updateFromJSON(std::shared_ptr<InputSource>); + // Close or otherwise release the input source. Once this has been // called, no other methods of qpdf can be called safely except // for getWarnings and anyWarnings(). After this has been called, diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh index da8d3fcb..a7d86337 100644 --- a/include/qpdf/QPDFJob.hh +++ b/include/qpdf/QPDFJob.hh @@ -323,6 +323,8 @@ class QPDFJob Config* outputFile(std::string const& filename); QPDF_DLL Config* replaceInput(); + QPDF_DLL + Config* createFromJson(std::string const& filename); QPDF_DLL std::shared_ptr<CopyAttConfig> copyAttachmentsFrom(); @@ -674,6 +676,8 @@ class QPDFJob bool check_requires_password; std::shared_ptr<char> infilename; std::shared_ptr<char> outfilename; + std::string create_from_json; + std::string update_from_json; }; std::shared_ptr<Members> m; }; diff --git a/include/qpdf/auto_job_c_main.hh b/include/qpdf/auto_job_c_main.hh index 42e30a70..cc1bf469 100644 --- a/include/qpdf/auto_job_c_main.hh +++ b/include/qpdf/auto_job_c_main.hh @@ -68,6 +68,7 @@ QPDF_DLL Config* rotate(std::string const& parameter); QPDF_DLL Config* showAttachment(std::string const& parameter); QPDF_DLL Config* showObject(std::string const& parameter); QPDF_DLL Config* jsonStreamPrefix(std::string const& parameter); +QPDF_DLL Config* updateFromJson(std::string const& parameter); QPDF_DLL Config* collate(std::string const& parameter); QPDF_DLL Config* collate(); QPDF_DLL Config* splitPages(std::string const& parameter); |