2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-28 07:53:11 +00:00
Commit Graph

88 Commits

Author SHA1 Message Date
m-holger
5906dd5c1f Code tidy - Clang-Tidy rule modernize-use-default-member-init 2023-06-09 15:43:21 +01:00
m-holger
698a70e6a8 Code tidy - reflow comments and strings 2023-05-27 10:54:19 +01:00
Jay Berkenbilt
60965d5f4d Rerun clang-format 2023-05-21 13:35:09 -04:00
Jay Berkenbilt
d740c6ccce Rerun format_code (after merging clang-tidy PR) 2023-05-20 14:52:19 -04:00
Jay Berkenbilt
a85635b839
Merge pull request #929 from m-holger/ogguard
Add new convenience class QPDFObjGen::Guard
2023-05-20 14:09:49 -04:00
m-holger
d0682f0f60 Use nullptr instead of 0 or NULL 2023-05-20 15:41:36 +01:00
m-holger
9db2965f62 Use QPDFObjGen::set in QPDFJob::getWantedJSONObjects 2023-05-19 18:56:10 +01:00
m-holger
43d9ee56ea Split QPDFJob::run into createQPDF and writeQPDF
Also, change QPDFJob to use unique_ptr<QPDF> instead of shared pointers.
2023-03-09 17:21:55 +00:00
m-holger
b27be3ed27 Remove redundant parameter from QPDFJob::handlePageSpecs and doSplitPages 2023-03-05 09:01:49 -05:00
Jay Berkenbilt
c99a1ecd4f Update copyright to 2023 2023-02-25 14:18:13 -05:00
Jay Berkenbilt
48bacbf2e6 Refactor overlay/underlay in preparation for change 2023-02-25 11:25:28 -05:00
Jay Berkenbilt
fe11f13d63 Add stub for --remove-restrictions 2023-01-28 13:24:45 -05:00
Jay Berkenbilt
acfc9db051 QPDFJob: switch to C++11-style field initializers 2023-01-28 13:24:30 -05:00
m-holger
008364a9a4 Remove redundant friend class statements 2022-12-04 14:05:16 -05:00
Jay Berkenbilt
94c79bb8f6 Support --show-encryption without a valid password (fixes #598) 2022-09-06 12:45:12 -04:00
Jay Berkenbilt
433f1dae19 Add --report-mem-usage option for debugging/testing 2022-08-31 14:47:27 -04:00
Jay Berkenbilt
a9c0b02668 Fix code formatting for deprecated 2022-07-31 17:10:55 -04:00
Jay Berkenbilt
5f4224f31a Simplify --json-output
Now --json-output just changes defaults. Allow output file with --json.
2022-07-31 16:23:17 -04:00
Jay Berkenbilt
80acfc3826 Fix --json-help to take a version parameter 2022-07-31 16:23:17 -04:00
Jay Berkenbilt
69820847af Change the output of --json to use "qpdf" instead of "objects" 2022-07-31 15:17:01 -04:00
Jay Berkenbilt
87412eb05b Add QPDFJob::registerProgressReporter 2022-06-19 08:46:58 -04:00
Jay Berkenbilt
daef4e8fb8 Add more flexible funtions to qpdfjob C API 2022-06-19 08:46:58 -04:00
Jay Berkenbilt
28cc3692e3 Expose exit code values to C API via Constants.h 2022-06-18 11:36:11 -04:00
Jay Berkenbilt
641e92c6a7 QPDF, QPDFJob: use QPDFLogger instead of custom output streams 2022-06-18 09:02:55 -04:00
Jay Berkenbilt
6f43bf8de3 Major rework -- see long comments
* Replace --create-from-json=file with --json-input, which causes the
  regular input to be treated as json.
* Eliminate --to-json
* In --json=2, bring back "objects" and eliminate "objectinfo". Stream
  data is never present.
* In --json-output=2, write "qpdf-v2" with "objects" and include
  stream data.
2022-05-20 09:16:25 -04:00
Jay Berkenbilt
4fe2e06b47 Add --create-from-json and --update-from-json arguments
Also add stubs for top-level QPDF methods (createFromJSON,
updateFromJSON)
2022-05-16 13:41:40 -04:00
Jay Berkenbilt
c76536dd9a Implement JSON v2 output 2022-05-08 13:45:20 -04:00
Jay Berkenbilt
15272662f6 Fix typo in json output key name
moddify -> modify. Also carefully spell checked all remaining keys by
splitting them into words and running a spell checker, not just
relying on visual proofreading. That was the only one.
2022-05-08 13:45:20 -04:00
Jay Berkenbilt
16f4f94cd9 Prepare code for JSON v2
Update getJSON() methods and calls to them
2022-05-07 11:12:01 -04:00
Jay Berkenbilt
dc9b7287cd Top-level json: write incrementally
This commit just changes the order in which fields are written to the
json without changing their content. All the json files in the test
suite were modified with this script to ensure that we didn't get any
changes other than ordering.

----------
#!/usr/bin/env python3
import json
import sys

def json_dumps(data):
    return json.dumps(data, ensure_ascii=False,
                      indent=2, separators=(',', ': '))

for filename in sys.argv[1:]:
    with open(filename, 'r') as f:
        data = json.loads(f.read())
    newdata = {}
    for i in ('version', 'parameters', 'pages', 'pagelabels',
              'acroform', 'attachments', 'encrypt', 'outlines',
              'objects', 'objectinfo'):
        if i in data:
            newdata[i] = data[i]
print(json_dumps(newdata))
----------
2022-05-07 08:26:31 -04:00
Jay Berkenbilt
b361c5ce19 Add --test-json-schema command-line option 2022-05-07 08:26:31 -04:00
Jay Berkenbilt
7604ac5cb2 QPDFJob: have doJSON write to a pipeline 2022-05-07 08:26:31 -04:00
Jay Berkenbilt
a68703b07e Replace PointerHolder with std::shared_ptr in library sources only
(patrepl and cleanpatch are my own utilities)

patrepl s/PointerHolder/std::shared_ptr/g {include,libqpdf}/qpdf/*.hh
patrepl s/PointerHolder/std::shared_ptr/g libqpdf/*.cc
patrepl s/make_pointer_holder/std::make_shared/g libqpdf/*.cc
patrepl s/make_array_pointer_holder/QUtil::make_shared_array/g libqpdf/*.cc
patrepl s,qpdf/std::shared_ptr,qpdf/PointerHolder, **/*.cc **/*.hh
git restore include/qpdf/PointerHolder.hh
cleanpatch
./format-code
2022-04-09 17:33:29 -04:00
Jay Berkenbilt
12f1eb15ca Programmatically apply new formatting to code
Run this:

for i in  **/*.cc **/*.c **/*.h **/*.hh; do
  clang-format < $i >| $i.new && mv $i.new $i
done
2022-04-04 08:10:40 -04:00
Jay Berkenbilt
d501e1c0d4 Only update output version from files used as input
If we're opening a PDF file to copy its encryption information or
attachments, its version doesn't need to influence the output version.
2022-02-08 13:49:22 -05:00
Jay Berkenbilt
f91b21c7d4 Preserve input PDF version on pages/split-pages (fixes #610) 2022-02-08 12:34:14 -05:00
Jay Berkenbilt
cfaa2de804 Update copyright for 2022 2022-02-04 16:36:22 -05:00
Jay Berkenbilt
42bff9f458 QPDFJob: let initializeFromArgv just take argv, not argc
Let argv be a null-terminated array. There is already code that
assumes this, and it makes it easier to construct the arguments.
2022-02-01 13:50:58 -05:00
Jay Berkenbilt
b02d37bc0a Make QPDFArgParser accept const argv
This makes it much more convention to use the initializeFromArgv
functions since you can use string literals.
2022-02-01 13:50:58 -05:00
Jay Berkenbilt
b42f3e1d15 Move more code from qpdf.cc into QPDFJob 2022-02-01 09:04:55 -05:00
Jay Berkenbilt
cc5485dac1 QPDFJob: documentation 2022-02-01 09:04:55 -05:00
Jay Berkenbilt
e3506253f1 Add optional version to --json 2022-01-31 15:57:45 -05:00
Jay Berkenbilt
caa00556cf Change filename or path to file in json and QPDFJob
Use "file" consistently for specifying a file path. We use "filename"
when adding attachments for a completely different purpose.
2022-01-31 15:57:45 -05:00
Jay Berkenbilt
f99e0af49c QPDFJob: rename function that returns job schema 2022-01-31 15:57:45 -05:00
Jay Berkenbilt
1355d95d08 QPDFJob: partial mode for initializeFromJson 2022-01-31 15:57:45 -05:00
Jay Berkenbilt
8a9100f674 QPDFJob: add checkConfiguration to Config 2022-01-31 15:57:45 -05:00
Jay Berkenbilt
0364024781 Use QPDFUsage exception for cli, json, and QPDFJob errors 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
2e4e25a934 Fix some comments 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
c62ab2ee9f QPDFJob: use pointers instead of references for Config
Why? The main methods that create them return smart pointers so that
users can initialize them when needed, which you can't do with
references. Returning pointers instead of references makes for a more
uniform interface.
2022-01-30 13:11:03 -05:00
Jay Berkenbilt
03f3369f35 QPDFJob: use manually named end functions for Config classes
Use named functions rather than just end() for clarity.
2022-01-30 13:11:03 -05:00