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

245 Commits

Author SHA1 Message Date
Jay Berkenbilt
578c5ac66c Use more references when iterating
When possible, use `for (auto&` or `for (auto const&` when iterating
using C++-11 style iterators.
2020-04-10 13:30:33 -04:00
Jay Berkenbilt
821a701851 Prepare 10.0.1 release 2020-04-09 11:48:26 -04:00
Jay Berkenbilt
1a7d3700a6 Fix unnecessary copies in auto iter (fixes #426)
Also switch to colon-style iteration in some cases. Thanks to Dean
Scarff for drawing this to my attention after detecting some
unnecessary copies with
https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html
2020-04-08 20:45:26 -04:00
Jay Berkenbilt
892937cbbe Fix errors in --remove-unreferenced-resources=auto 2020-04-06 12:14:27 -04:00
Jay Berkenbilt
1e629c278a Prepare 10.0.0 release 2020-04-06 11:30:15 -04:00
Jay Berkenbilt
ce6cee3570 Spell check 2020-04-06 11:23:02 -04:00
Jay Berkenbilt
3d0de5b924 Fixes to ChangeLog and manual for 10.0.0 changes 2020-04-06 09:02:58 -04:00
Jay Berkenbilt
2118eecae7 Add objectinfo to json 2020-04-04 18:08:40 -04:00
Jay Berkenbilt
67d5ed3a64 Implement remove-unreferenced-resources=auto 2020-04-04 13:19:49 -04:00
Jay Berkenbilt
1e766dcda2 Add --remove-unreferenced-resources option 2020-04-04 13:19:49 -04:00
Jay Berkenbilt
b03e6bd65d Use QPDF_EXECUTABLE as a hint for completion 2020-03-31 17:39:20 -04:00
Jay Berkenbilt
52a2e95dd5 Prepare 9.1.1 release 2020-01-26 18:49:04 -05:00
Jay Berkenbilt
e5cc065598 Update copyright to 2020 2020-01-26 16:57:27 -05:00
Jay Berkenbilt
12777a04ca Add encrypt key to json 2020-01-26 14:44:03 -05:00
Jay Berkenbilt
731c4f711b Add --is-encrypted and --requires-password (fixes #390)
Allow exit status-based checking of whether a file is encrypted or
requires a password without necessarily supplying the correct
password. Useful for scripting.
2020-01-26 11:26:53 -05:00
Jay Berkenbilt
a44b5a34a0 Pull wmain -> main code from qpdf.cc into QUtil.cc 2020-01-14 11:40:51 -05:00
Jay Berkenbilt
9b0c6022d7 Prepare 9.1.0 release 2019-11-16 22:29:54 -05:00
Jay Berkenbilt
5e6dfc938e Prepare 9.1.rc1 release 2019-11-09 22:00:53 -05:00
Jay Berkenbilt
c4478e5249 Allow odd/even modifiers in numeric range (fixes #364) 2019-11-09 13:23:12 -05:00
Jay Berkenbilt
127a957aee Allow runtime inspection/override of crypto provider 2019-11-09 09:53:42 -05:00
Jay Berkenbilt
3094955dee Prepare 9.0.2 release 2019-10-12 19:37:40 -04:00
Jay Berkenbilt
e188d0fffa Make --replace-input work with / in path (fixes #365) 2019-10-12 19:27:50 -04:00
Jay Berkenbilt
4ea940b03c Prepare 9.0.1 release 2019-09-20 07:38:18 -04:00
Jay Berkenbilt
5462dfce31 Prepare 9.0.0 release 2019-08-31 20:07:36 -04:00
Jay Berkenbilt
d492bb0a90 Add --replace-input option (fixes #321) 2019-08-31 15:51:21 -04:00
Jay Berkenbilt
41b5c46497 refactor: split write_outfile and do_split_pages 2019-08-31 15:51:06 -04:00
Jay Berkenbilt
9ebb55aff1 Include password match information in show encryption 2019-08-24 11:01:19 -04:00
Jay Berkenbilt
2794bfb1a6 Add flags to control zlib compression level (fixes #113) 2019-08-23 20:34:21 -04:00
Thorsten Schöning
8f06da7534 Change list to vector for outline helpers (fixes #297)
This change works around STL problems with Embarcadero C++ Builder
version 10.2, but std::vector is more common than std::list in qpdf,
and this is a relatively new API, so an API change is tolerable.

Thanks to Thorsten Schöning <6223655+ams-tschoening@users.noreply.github.com>
for the fix.
2019-07-03 20:08:47 -04:00
Jay Berkenbilt
04f45cf652 Treat all linearization errors as warnings
This also reverts the addition of a new checkLinearization that
distinguishes errors from warnings. There's no practical distinction
between what was considered an error and what was considered a
warning.
2019-06-23 13:45:45 -04:00
Jay Berkenbilt
ed62be888c Fix --completion-* args to work from AppImage (fixes #285) 2019-06-22 17:12:01 -04:00
Jay Berkenbilt
85a3f95a89 qpdf: exit 3 for linearization warnings without errors (fixes #50) 2019-06-22 16:57:51 -04:00
Jay Berkenbilt
c6cfd64503 Rename QUtil::strcasecmp to QUtil::str_compare_nocase (fixes #242) 2019-06-21 22:29:31 -04:00
Jay Berkenbilt
d71f05ca07 Fix sign and conversion warnings (major)
This makes all integer type conversions that have potential data loss
explicit with calls that do range checks and raise an exception. After
this commit, qpdf builds with no warnings when -Wsign-conversion
-Wconversion is used with gcc or clang or when -W3 -Wd4800 is used
with MSVC. This significantly reduces the likelihood of potential
crashes from bogus integer values.

There are some parts of the code that take int when they should take
size_t or an offset. Such places would make qpdf not support files
with more than 2^31 of something that usually wouldn't be so large. In
the event that such a file shows up and is valid, at least qpdf would
raise an error in the right spot so the issue could be legitimately
addressed rather than failing in some weird way because of a silent
overflow condition.
2019-06-21 13:17:21 -04:00
Jay Berkenbilt
b1a78be1a8 Prepare 8.4.2 release 2019-05-18 08:56:37 -04:00
Jay Berkenbilt
a323f6f49f Prepare 8.4.1 release 2019-04-27 20:44:20 -04:00
Jay Berkenbilt
7db5bc289b Fix typo 2019-04-22 09:37:23 -04:00
Jay Berkenbilt
12b159118a Compare versions between CLI and library 2019-04-20 21:00:43 -04:00
Jay Berkenbilt
2b011f9d81 Add --remove-page-labels option (fixes #317) 2019-04-20 21:00:43 -04:00
Jay Berkenbilt
e50d5201df Add --keep-files-open-threshold (fixes #288) 2019-04-20 21:00:43 -04:00
Jay Berkenbilt
131a21d36f Document that linearize disables qdf (fixes #312) 2019-04-20 21:00:43 -04:00
Jay Berkenbilt
a5a016cdd2 Revert preservations of outlines with --split-pages
The preservation of outlines didn't provide very useful behavior
anyway as it copied all outlines but most didn't work. This
implementation also caused a very significant performance hit and so
is being reverted until a proper solution can be coded. The eventual
solution will not be compatible with the reverted solution anyway, so
it's best not to leave this in.
2019-04-20 21:00:43 -04:00
Thorsten Schöning
2e7f81452f [bcc32 Error] qpdf.cc(3837): E2354 Two operands must evaluate to the same type
Full parser context
    qpdf.cc(3803): parsing: PointerHolder<Pipeline> ImageOptimizer::makePipeline(const std::string &,Pipeline *)
2019-02-14 19:45:00 +01:00
Jay Berkenbilt
fec5bb124c Spell check 2019-01-31 21:41:29 -05:00
Jay Berkenbilt
0a470d2daf Don't optimize non-8-bit images
Also add test cases for additional coverage on image optimization.
2019-01-31 21:29:28 -05:00
Jay Berkenbilt
5211bcb5ea Externalize inline images (fixes #278) 2019-01-31 10:38:13 -05:00
Jay Berkenbilt
c136356378 Typo in message 2019-01-31 09:26:37 -05:00
Jay Berkenbilt
8d229e078f Improve info message in optimize images (fixes #280)
When qpdf can't optimize an image because of an unsupported color
space, state this specifically. Recognize that many valid colorspaces
are not represented as name objects.
2019-01-29 18:16:02 -05:00
Jay Berkenbilt
426434c772 Add --overlay and --underlay to qpdf CLI (fixes #207) 2019-01-27 09:30:13 -05:00
Jay Berkenbilt
009767d97a Handle inheritable page attributes
Add getAttribute for handling inheritable page attributes, and fix
getPageImages and annotation flattening code to use it.
2019-01-25 22:30:05 -05:00
Jay Berkenbilt
c2030d1f33 Implement password recovery suppression and password mode (fixes #215)
Allow fine control over how passwords are encoded for writing, and
allow password for reading to be given as a hexademical encoded
string. Allow suppression of password recovery as a means to ensure
that the password you specify is actually the right one.
2019-01-19 10:14:07 -05:00
Jay Berkenbilt
392f2ece51 Try passwords with different string encodings 2019-01-19 10:10:58 -05:00
Jay Berkenbilt
e4fa5a3c2a Refactor qpdf processing
Push calls to processFile and processInputSource into separate
functions in preparation for password recovery changes
2019-01-19 10:10:58 -05:00
Jay Berkenbilt
966429e718 Update CLI and manual for new encryption granularity (fixes #214) 2019-01-17 11:43:56 -05:00
Jay Berkenbilt
6ec22f117d Modernize encryption API for more granularity
Setting encryption permissions for R >= 3 set permission bits in
groups corresponding to menu options in Acrobat 5. The new API allows
the bits to be set individually.
2019-01-17 11:43:56 -05:00
Jay Berkenbilt
429ffcf397 Unicode main for Windows qpdf.cc 2019-01-17 11:43:56 -05:00
Jay Berkenbilt
654c0e8caf Allow adding the same page more than once in --pages (fixes #272) 2019-01-12 10:01:47 -05:00
Jay Berkenbilt
53d8e916b7 Interpret . in --pages as a shortcut for the primary file 2019-01-12 09:59:03 -05:00
Jay Berkenbilt
3472f6c984 Update copyrights for 2019 2019-01-07 07:54:55 -05:00
Jay Berkenbilt
8a5ca0e406 Don't keep QPDF objects for merging longer than needed 2019-01-07 07:38:03 -05:00
Jay Berkenbilt
a70fbaaf50 Honor other base encodings when generating appearances 2019-01-05 23:01:59 -05:00
Jay Berkenbilt
5c682f6d1e Fix image optimization evaluation
Don't attempt to pass data through a JPEG filter if we are unable to
filter the data.
2019-01-05 22:37:49 -05:00
Jay Berkenbilt
ee437705fc Update documentation for new features 2019-01-04 21:58:22 -05:00
Jay Berkenbilt
ab9f4cc212 Split help string
It was too long for some compilers.
2019-01-04 21:33:14 -05:00
Jay Berkenbilt
2e342ee5bb Spell check 2019-01-04 21:33:14 -05:00
Jay Berkenbilt
ee2aad4381 Add CLI flags for image optimization 2019-01-04 21:33:14 -05:00
Jay Berkenbilt
7b6ab900dc Support page collation with --collate (fixes #259) 2019-01-04 15:13:02 -05:00
Jay Berkenbilt
158156d506 Add basic appearance stream generation 2019-01-04 08:00:19 -05:00
Jay Berkenbilt
e3144ac417 Add form fields to json output
Also add some additional methods for detecting form field types to
assist in the json creation and for later use.
2019-01-03 23:18:13 -05:00
Jay Berkenbilt
ca94ac68d9 Honor flags when flattening annotations 2019-01-03 11:59:55 -05:00
Jay Berkenbilt
3b8ce4f12a Annotation flattening including form fields
Flatten annotations by integrating their appearance streams into the
content stream of the containing page. In the case of form fields,
only flatten if /NeedAppearance is false (or equivalently absent). If
flattening form fields, also remove /AcroForm from the document
catalog.
2019-01-01 08:14:15 -05:00
Jay Berkenbilt
3440ea7d3c JSON::serialize -> unparse
Unparse is admittedly strange, but I'd rather be strange and
consistent, and everything else in the qpdf library uses unparse to
serialize. (If you're reading this, the convention of using "unparse"
comes from the "clu" programming language.)
2018-12-25 11:52:21 -05:00
Jay Berkenbilt
6048c6e2f0 Don't crash on @file when file doesn't exist (fixes #265)
When @file is used and file doesn't exist, just treat it as a normal
argument.
2018-12-23 11:46:56 -05:00
Jay Berkenbilt
64c1579544 Support zsh completion 2018-12-23 11:21:59 -05:00
Jay Berkenbilt
76bf863aaa Add page position information to json 2018-12-23 09:15:40 -05:00
Jay Berkenbilt
52a0b767c8 Slightly improve bash completion arg parsing 2018-12-23 09:15:40 -05:00
Jay Berkenbilt
86f9b4c43b Add colorspace and depth information in json for images 2018-12-22 11:42:38 -05:00
Jay Berkenbilt
62ea3b9197 Add outlines to json at document level 2018-12-22 11:42:38 -05:00
Jay Berkenbilt
ae9455bf44 Implement --json-objects 2018-12-22 11:42:38 -05:00
Jay Berkenbilt
fa3051d977 Implement --json-keys 2018-12-22 11:42:38 -05:00
Jay Berkenbilt
2008d037b3 Handle help args using option tables; add json help 2018-12-22 11:42:38 -05:00
Jay Berkenbilt
b3da5a2cba Switch json args and structure 2018-12-22 11:42:38 -05:00
Jay Berkenbilt
7985c77326 Completion: ignore characters at and after point 2018-12-22 11:42:37 -05:00
Jay Berkenbilt
bb89382f93 Allow --show-object=trailer 2018-12-21 19:11:57 -05:00
Jay Berkenbilt
dd1aca552c Support bash completion using complete -C 2018-12-21 19:11:57 -05:00
Jay Berkenbilt
3c075fc017 Table-driven parsing of encrypt options 2018-12-21 19:11:57 -05:00
Jay Berkenbilt
245723c570 Table-driven parsing for top-level arguments 2018-12-21 19:11:57 -05:00
Jay Berkenbilt
151206603b Move argument parsing into a class 2018-12-21 19:11:57 -05:00
Jay Berkenbilt
6580ffe983 Preliminary implementation of json mode
The json mode implemented in this commit is not the final version, or
are the command line arguments used to invoke it.
2018-12-21 19:11:57 -05:00
Jay Berkenbilt
fa3664357b Move numrange code from qpdf.cc to QUtil.cc
Also move tests to libtests.
2018-12-21 19:11:57 -05:00
Jay Berkenbilt
313ba08126 Preserve some outline functionality in page splitting 2018-12-21 19:11:57 -05:00
Jay Berkenbilt
352ce9b22b Preserve page labels (numbers) when splitting and merging 2018-12-18 16:59:24 -05:00
Jay Berkenbilt
28453a4908 Add --keep-files-open flag (fixes #237) 2018-08-18 10:56:01 -04:00
Jay Berkenbilt
fb1e29476c Add --no-warn option to suppress warnings (fixes #232) 2018-08-12 22:20:40 -04:00
Jay Berkenbilt
a2f62935b3 Catch exceptions as const references (fixes #236)
This fix allows qpdf to compile/test cleanly with gcc 8.
2018-08-12 21:57:52 -04:00
Jay Berkenbilt
fe769f2723 Keep file open while adding its pages during merge (fixes #217) 2018-08-04 19:58:13 -04:00
Jay Berkenbilt
6bf47ac6e8 With --verbose, give information on processing merge inputs 2018-06-22 16:14:54 -04:00
Jay Berkenbilt
a433ed24f9 Add progress reporting for QPDFWriter (fixes #200) 2018-06-22 16:14:54 -04:00
Jay Berkenbilt
99593e0eef Use ClosedFileInputSource when merging files (fixes #154) 2018-06-22 12:53:41 -04:00
Jay Berkenbilt
c71dc6888c Don't prune resource dictionaries on errors or by request
If we are unable to filter a page's content streams, don't attempt to
remove objects from the page's resource dictionary. Also provide a
command line option to suppress resource removal in case we ever need
this as a workaround for some bug or broken PDF files.
2018-06-22 10:45:31 -04:00