Jay Berkenbilt
63158cf546
Add --password-file=filename option ( fixes #499 )
2021-02-04 16:48:53 -05:00
Jay Berkenbilt
21b0f4acfc
Require --allow-insecure to create certain encrypted files ( fixes #501 )
...
For now, --allow-insecure allows creation of files with the owner
passwords empty or matching the user password.
2021-02-04 15:57:13 -05:00
Jay Berkenbilt
faa2e3ddfd
Handle older PDFs whose form XObjects inherit resources ( fixes #494 )
...
When removing unreferenced resources, notice if a page (recursively)
contains a form XObject with unreferenced resources, and count any
such resources as referenced by the page.
2021-02-02 18:06:05 -05:00
Jay Berkenbilt
9c9ce64eec
Handle strings in inline image dictionaries
...
We need to use token.getRawValue, not token.getValue
2021-01-31 07:50:03 -05:00
Jay Berkenbilt
1fec40454e
Add example of name/number trees and dictionary/array iteration
2021-01-30 15:52:16 -05:00
Jay Berkenbilt
de0b11fc47
Add C++ iterator API around array and dictionary objects
2021-01-30 15:15:23 -05:00
Jay Berkenbilt
35e7859bc7
Make QPDFObjectHandle::is* return false for uninitialized objects
2021-01-29 15:46:54 -05:00
Jay Berkenbilt
e7e20772ed
name/number trees: remove
2021-01-26 09:12:23 -05:00
Jay Berkenbilt
b5614f611d
Implement repair and insert for name/number trees
2021-01-24 19:31:45 -05:00
Jay Berkenbilt
04edfe9fad
QPDFObjectHandle::newUnicodeString to uses UTF-16 only when needed
...
Use the first of ASCII, PDFDocEncoding, or UTF-16 that is capable of
encoding the string.
2021-01-24 03:27:28 -05:00
Jay Berkenbilt
d61ffb65d0
Add new constructors for name/number tree helpers
...
Add constructors that take a QPDF object so we can issue warnings and
create new indirect objects.
2021-01-24 03:27:26 -05:00
Jay Berkenbilt
ba814703fb
Use QPDFNameTreeObjectHelper's iterator directly
2021-01-24 03:25:11 -05:00
Jay Berkenbilt
6226b69dba
Add warn() to QPDF's public API
2021-01-16 18:41:53 -05:00
Jay Berkenbilt
fc88837d4b
Treat /EmbeddedFiles as a proper name tree
...
If we ever had an encrypted file with different filters for
attachments and either the /EmbeddedFiles name tree was deep or some
of the file specs didn't have /Type, we would have overlooked those as
attachment streams. The code now properly handles /EmbeddedFiles as a
name tree.
2021-01-11 10:50:44 -05:00
Jay Berkenbilt
6fe7b704c7
Warn rather than segv on access after closing input source ( fixes #495 )
2021-01-06 10:11:34 -05:00
Jay Berkenbilt
0fed040392
Prepare version 10.1.0
2021-01-04 16:59:55 -05:00
Jay Berkenbilt
18340b8835
Spell check
2021-01-04 16:26:58 -05:00
Jay Berkenbilt
891751f618
Remove unreferenced resources only from relevant pages
2021-01-04 15:17:35 -05:00
Jay Berkenbilt
dc92574c10
Fix some pipelines to be safe if downstream write fails (fuzz issue 28262)
2021-01-04 15:17:35 -05:00
Jay Berkenbilt
a9bdeeb0e0
Fix zsh completion arguments ( fixes #473 )
2021-01-04 15:17:35 -05:00
Jay Berkenbilt
3be58f49e5
Make more QPDFPageObjectHelper methods work with form XObject
2021-01-02 14:08:53 -05:00
Jay Berkenbilt
98da4fd835
Externalize inline images now includes form XObjects
2021-01-02 14:08:17 -05:00
Jay Berkenbilt
a139d2b36d
Add several methods for working with form XObjects ( fixes #436 )
...
Make some more methods in QPDFPageObjectHelper work with form
XObjects, provide forEach methods to walk through nested form
XObjects, possibly recursively. This should make it easier to work
with form XObjects from user code.
2021-01-02 12:29:31 -05:00
Jay Berkenbilt
afb48d23a9
QPDFPageObjectHelper::removeUnreferencedResources works with form XObjects
2021-01-02 11:33:36 -05:00
Jay Berkenbilt
6154221edb
QPDFPageObjectHelper: filterPageContents -> filterContents + form XObject
2021-01-02 11:33:36 -05:00
Jay Berkenbilt
63ea46193d
QPDFPageObjectHelper: getPageImages -> getImages
2021-01-02 11:33:36 -05:00
Jay Berkenbilt
1562d34c09
Add QPDFObjectHandle::isFormXObject
2021-01-01 07:36:10 -05:00
Jay Berkenbilt
c9271335fa
Add QPDFPageObjectHelper::flattenRotation and --flatten-rotation
2020-12-30 13:03:55 -05:00
Jay Berkenbilt
d4d7630cf5
Add pdf-custom-filter example
2020-12-28 13:03:04 -05:00
Jay Berkenbilt
12ecd2019a
Add QPDFObjectHandle::setFilterOnWrite
2020-12-28 12:58:19 -05:00
Jay Berkenbilt
3f9191a344
Add ostream << for QPDFObjGen
2020-12-28 12:58:19 -05:00
Jay Berkenbilt
858c7b89bc
Let optimize filter stream parameters instead of making them direct
...
Also removes preclusion of stream references in stream parameters of
filterable streams and reduces write times by about 8% by eliminating
an extra traversal of the objects.
2020-12-28 12:58:19 -05:00
Jay Berkenbilt
39bfa01307
Implement user-provided stream filters
...
Refactor QPDF_Stream to use stream filter classes to handle supported
stream filters as well.
2020-12-28 12:58:19 -05:00
Jay Berkenbilt
cc8895078a
Add QPDFObjectHandle::makeDirect(bool allow_streams)
2020-12-26 08:48:18 -05:00
Jay Berkenbilt
573b6eb8b1
Provide qpdf write progress reporting from C API ( fixes #487 )
2020-12-20 14:43:24 -05:00
Jay Berkenbilt
2050977099
Add QPDFObjectHandle manipulation to C API
2020-11-28 19:48:07 -05:00
Jay Berkenbilt
78b9d6bfd4
Prepare 10.0.4 release
2020-11-21 13:50:02 -05:00
Jay Berkenbilt
9d64481571
Handle negative numbers in QIntC::range_check (fuzz issue 26994)
2020-11-21 13:43:04 -05:00
Jay Berkenbilt
13e6b54be1
Spell check
2020-11-21 11:22:05 -05:00
Jay Berkenbilt
bd79138c84
Treat direct page as runtime rather than logic error (fuzz issue 27393)
2020-11-11 09:50:43 -05:00
Jay Berkenbilt
a7ef572c84
Small enhancement to --pages argument parsing
2020-11-09 11:12:34 -05:00
Jay Berkenbilt
47f4ebcdac
Ignore unused field in xref entry, avoiding range error ( fixes #482 )
2020-11-04 07:46:46 -05:00
Jay Berkenbilt
fbe40b800d
Prepare 10.0.3 release
2020-10-31 13:47:03 -04:00
Jay Berkenbilt
6971f78ff6
Fix stack overflow on direct root (fuzz issue 26761)
2020-10-31 13:10:39 -04:00
Jay Berkenbilt
96767fb104
Fix foreign stream copying bug ( fixes #478 )
...
This reverts an incorrect fix to #449 and codes it properly. The real
problem was that we were looking at the local dictionaries rather than
the foreign dictionaries when saving the foreign stream data. In the
case of direct objects, these happened to be the same, but in the case
of indirect objects, the object references could be pointing anywhere
since object numbers don't match up between the old and new files.
2020-10-31 12:14:26 -04:00
Jay Berkenbilt
da7540794a
Prepare 10.0.2 release
2020-10-27 11:57:48 -04:00
Jay Berkenbilt
bcea54fcaa
Revert removal of unreadCh change for performance
...
Turns out unreadCh is much more efficient than seek(-1, SEEK_CUR).
Update comments and code to reflect this.
2020-10-27 11:57:48 -04:00
Jay Berkenbilt
81d2c548dc
Spell check
2020-10-26 19:42:46 -04:00
Jay Berkenbilt
db08974e88
Release notes for 10.0.2
2020-10-26 19:39:36 -04:00
Jay Berkenbilt
bc9c80dbe0
Add some missing ChangeLog entries
2020-10-26 11:51:33 -04:00
Jay Berkenbilt
7120c4a748
Use sha256 for signing release files
2020-10-25 18:06:40 -04:00
Jay Berkenbilt
4e8d21d849
Build Windows releases with openssl; automate external libraries
...
External libraries for Windows are now built automatically in the
qpdf/external-libs repository and include openssl in addition to zlib
and jpeg. Use these, and update the Windows build to build with the
openssl crypto provider by default. We leave the native crypto
provider enabled in case there is a problem with openssl and also to
continue to exercise that code.
2020-10-25 18:06:16 -04:00
Jay Berkenbilt
b30deaeeab
Avoid merging adjacent tokens when concatenating contents ( fixes #444 )
2020-10-23 08:00:04 -04:00
Jay Berkenbilt
0dea276997
Fix fix-qdf for empty streams
2020-10-23 06:39:42 -04:00
Jay Berkenbilt
24196c08cb
Fix loop detection error (fuzz issue 23172)
2020-10-22 05:48:35 -04:00
Jay Berkenbilt
956c8f6432
Obscure bug fix copying foreign streams in special cases ( fixes #449 )
...
Specifically, if a stream had its stream data replaced and had
indirect /Filter or /DecodeParms, it would result in non-silent loss
of data and/or internal error.
2020-10-21 19:23:23 -04:00
Jay Berkenbilt
395efdf8d7
Turn off azure pipelines, completing migration to GitHub Actions
2020-10-21 16:42:51 -04:00
Jay Berkenbilt
98f6c00dad
Protect numeric conversion against user's locale ( fixes #459 )
2020-10-21 16:42:51 -04:00
Jay Berkenbilt
cfafac8d13
Create a minimal Linux binary distribution ( fixes #352 )
...
This is suitable for use as a Lambda layer in AWS, inclusion in a
docker container, or other places where a minimal binary distribution
is desired.
2020-10-21 10:07:34 -04:00
Jay Berkenbilt
758e3e38f5
Add option --warning-exit-0 to exit 0 instead of 3 with warnings
2020-10-20 18:02:39 -04:00
Jay Berkenbilt
56d96e2260
Add --disable-rpath to configure ( fixes #422 )
2020-10-20 17:18:20 -04:00
Jay Berkenbilt
bed165c9fc
Stop using InputSource::unreadCh
2020-10-18 07:43:05 -04:00
Jay Berkenbilt
a3677ffe91
TODO and ChangeLog updates from merged pull requests
2020-10-16 20:15:14 -04:00
Jay Berkenbilt
894d1c650c
Minor notes on GitHub Actions migration
2020-10-16 17:52:43 -04:00
Jay Berkenbilt
26514ab731
Write linearization errors to stderr ( fixes #438 )
2020-04-29 17:33:34 -04:00
Jay Berkenbilt
821a701851
Prepare 10.0.1 release
2020-04-09 11:48:26 -04:00
Jay Berkenbilt
4977a7efa5
Bug fix: getStreamData should on unfilterable stream ( fixes #425 )
2020-04-08 18:52:04 -04:00
Jay Berkenbilt
65ae8511a7
Improve pdf-invert-images example
2020-04-07 18:11:00 -04:00
Jay Berkenbilt
fbac472510
Correction to ChangeLog
2020-04-07 17:54:47 -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
77198d5310
Delegate random number generation to crypto provider ( fixes #418 )
2020-04-06 11:23:02 -04:00
Jay Berkenbilt
619d294e9d
Remove QUtil::srandom
2020-04-06 09:49:02 -04:00
Jay Berkenbilt
1360b530ec
Update ChangeLog and manual for openssl crypto provider
2020-04-06 09:24:12 -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
893d38b87e
Allow propagation of errors and retry through StreamDataProvider
...
StreamDataProvider::provideStreamData now has a rich enough API for it
to effectively proxy to pipeStreamData.
2020-04-05 20:07:13 -04:00
Jay Berkenbilt
2118eecae7
Add objectinfo to json
2020-04-04 18:08:40 -04:00
Jay Berkenbilt
1e766dcda2
Add --remove-unreferenced-resources option
2020-04-04 13:19:49 -04:00
Jay Berkenbilt
b880273c43
Historical note in ChangeLog
...
I keep looking here to find out when I started requiring C++-11, and
now I will find the answer in the first place I look.
2020-04-04 13:19:49 -04:00
Jay Berkenbilt
2100b4ce15
Allow qpdf to be built on systems without wchar_t ( fixes #406 )
2020-04-03 21:39:44 -04:00
Jay Berkenbilt
4f3b89991b
placeFormXObject: allow control of shrink/expand ( fixes #409 )
2020-04-03 21:39:17 -04:00
Jay Berkenbilt
38afdcea7b
Add QPDFObjectHandle::unsafeShallowCopy
2020-04-03 12:16:24 -04:00
Jay Berkenbilt
89f19b7099
Performance: remove Members indirection for QPDFObjectHandle
2020-04-03 12:16:24 -04:00
Jay Berkenbilt
dac65a21fb
Look in form XObjects when removing unreferenced resources ( fixes #373 )
...
If a page contains a form XObject, also filter the form XObject and
remove its unreferenced resources.
2020-03-31 17:39:20 -04:00
Jay Berkenbilt
278710fbe8
Refactor QPDFPageObjectHelper::removeUnreferencedResources()
...
Refactor removeUnreferencedResources to prepare for filtering form
XObjects.
2020-03-31 17:39:20 -04:00
Jay Berkenbilt
b03e6bd65d
Use QPDF_EXECUTABLE as a hint for completion
2020-03-31 17:39:20 -04:00
Jay Berkenbilt
154b65f2e9
Add missing ChangeLog entry for :even and :odd
2020-02-24 12:27:46 -05:00
Jay Berkenbilt
ea58680eb0
Mention appearances in pdf-set-form-values example
2020-02-22 12:10:13 -05:00
Jay Berkenbilt
bb3137296d
Handle root /Pages pointing to other than page tree root ( fixes #398 )
2020-02-22 11:10:31 -05:00
Jay Berkenbilt
52a2e95dd5
Prepare 9.1.1 release
2020-01-26 18:49:04 -05:00
Jay Berkenbilt
57c01ef81f
In qdf mode, don't write extra XRef streams ( fixes #386 )
...
fix-qdf assumes there is exactly one XRef stream and that it is at the
end of the file.
2020-01-26 16:50:57 -05:00
Jay Berkenbilt
bbc2f8ffae
Bug fix: handle ColorSpace lookup for inline images ( fixes #392 )
...
If the value of /CS in the inline image dictionary was is key in the
page's /Resource -> /ColorSpace dictionary, properly resolve it by
referencing the proper colorspace, and not just the name, in the
external image dictionary.
2020-01-26 15:29:10 -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
Cloudmersive
a8b6ff5763
Fix for Windows unable to acquire crypt context with new keyset ( fixes #387 )
...
Fix is based on guidance
https://support.microsoft.com/en-us/help/238187/cryptacquirecontext-use-and-troubleshooting
and is the proper fix for #285/#286
2020-01-14 18:45:54 -05:00
Jay Berkenbilt
388990f7bc
Rewrite fix-qdf in C++
2020-01-14 11:53:19 -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
211a7f57be
QUtil::read_lines_from_file: optional EOL preservation
2020-01-13 11:26:18 -05:00
Jay Berkenbilt
9b0c6022d7
Prepare 9.1.0 release
2019-11-16 22:29:54 -05:00
Jay Berkenbilt
0e94aa6919
Fix up documentation around Windows wildcard fix
2019-11-10 20:19:38 -05:00
Jay Berkenbilt
5e6dfc938e
Prepare 9.1.rc1 release
2019-11-09 22:00:53 -05:00
Jay Berkenbilt
021d71454a
Spell check
2019-11-09 19:03:56 -05:00
Jay Berkenbilt
07da0039d3
Link with setargv or wsetargv with MSVC ( fixes #224 )
...
For wildcard expansion to work properly with the msvc binary, it is
necessary to link with setargv.obj or wsetargv.obj, depending on
whether wmain is in use.
2019-11-09 18:50:42 -05:00
Jay Berkenbilt
5508f74603
Allow /P in encryption dictionary to be positive ( fixes #382 )
...
Even though this is disallowed by the spec, files like this have been
encountered in the wild.
2019-11-09 12:33:15 -05:00
Jay Berkenbilt
1ee45458fc
Update docs for crypto providers
2019-11-09 09:53:42 -05:00
Jay Berkenbilt
9b76ec154d
Add ChangeLog and documentation for signature dict enhancements
2019-10-22 16:44:27 -04: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
db2e095a42
Update release notes for upcoming 9.0.1 release
2019-09-19 21:25:34 -04:00
Jay Berkenbilt
685250d7d6
Correct reversed Rectangle coordinates ( fixes #363 )
2019-09-19 21:25:34 -04:00
Jay Berkenbilt
8b1e307741
Warn for duplicated dictionary keys ( fixes #345 )
2019-09-19 20:22:34 -04:00
Jay Berkenbilt
6d81f01476
Don't assume char is signed in int conversion tests ( fixes #361 )
2019-09-17 12:18:09 -04:00
Jay Berkenbilt
5462dfce31
Prepare 9.0.0 release
2019-08-31 20:07:36 -04:00
Jay Berkenbilt
babd12c9b2
Add methods QPDF::anyWarnings and QPDF::closeInputSource
2019-08-31 15:51:20 -04:00
Jay Berkenbilt
4fa7b1eb60
Add remove_file and rename_file to QUtil
2019-08-31 15:51:04 -04:00
Jay Berkenbilt
0787ec9620
spell check
2019-08-31 08:43:18 -04:00
Jay Berkenbilt
5da146c8b5
Track separately whether password was user/owner ( fixes #159 )
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
Jay Berkenbilt
dac0598b94
Add ability to set zlib compression level globally
2019-08-23 20:34:21 -04:00
Jay Berkenbilt
3f1ab64066
Pass offset and length to ParserCallbacks::handleObject
2019-08-22 22:54:29 -04:00
Jay Berkenbilt
4b2e72c4cd
Test for direct, rather than resolved nulls in parser
...
Just because we know an indirect reference is null, doesn't mean we
shouldn't keep it indirect.
2019-08-22 17:55:16 -04:00
Jay Berkenbilt
3f3dbe22ea
Remove array null flattening
...
For some reason, qpdf from the beginning was replacing indirect
references to null with literal null in arrays even after removing the
old behavior of flattening scalar references. This seems like a bad
idea.
2019-08-22 17:55:16 -04:00
Jay Berkenbilt
ae5bd7102d
Accept extraneous space before xref ( fixes #341 )
2019-08-19 22:24:53 -04:00
Jay Berkenbilt
8a9086a689
Accept extraneous space after stream keyword ( fixes #329 )
2019-08-19 21:43:44 -04:00
Jay Berkenbilt
42d396f1dd
Handle invalid name tokens symmetrically for PDF < 1.2 ( fixes #332 )
2019-08-19 19:48:27 -04:00
Jay Berkenbilt
d9dd99eca3
Attempt to repair /Type key in pages nodes ( fixes #349 )
2019-08-18 18:54:37 -04:00
Jay Berkenbilt
89dacd8eba
Array optimization fixes performance issues ( fixes #305 , #311 )
2019-08-18 09:00:55 -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
c5ed1b8075
Handle invalid encryption Length ( fixes #333 )
2019-06-22 20:57:33 -04:00
Jay Berkenbilt
551dfbf697
Allow set*EncryptionParameters before filename iset ( fixes #336 )
2019-06-22 20:57:33 -04:00
Jay Berkenbilt
ed62be888c
Fix --completion-* args to work from AppImage ( fixes #285 )
2019-06-22 17:12:01 -04:00
Jay Berkenbilt
7bd38a3eb3
Provide error message in Windows crypto code ( fixes #286 )
...
Thanks to github user zdenop for supplying some additional
error-handling code.
2019-06-22 17:12:01 -04:00
Jay Berkenbilt
6c39aa8763
In shippable code, favor smart pointers ( fixes #235 )
...
Use PointerHolder in several places where manually memory allocation
and deallocation were being used. This helps to protect against memory
leaks when exceptions are thrown in surprising places.
2019-06-22 16:57:52 -04:00
Jay Berkenbilt
1240047528
Try to use pkg-config to find external dependencies ( fixes #324 )
2019-06-22 16:57:52 -04:00
Jay Berkenbilt
f2ef161261
Override umask on install ( fixes #326 )
2019-06-22 16:57:52 -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
a5814d9302
ChangeLog: fix errors in previous entries
2019-06-22 16:57:51 -04:00
Jay Berkenbilt
1bde5c68a3
Add QUtil::read_file_into_memory
...
This code was essentially duplicated between test_driver and
standalone_fuzz_target_runner.
2019-06-22 10:14:25 -04:00
Jay Berkenbilt
864a546af6
Build with -fvisibility=hidden when supported
2019-06-21 22:29:31 -04:00
Jay Berkenbilt
45dac410b5
Remove broken QPDFTokenizer::expectInlineImage
2019-06-21 22:29:31 -04:00
Jay Berkenbilt
25dd3c6750
Remove QPDF::copyForeignObject with unused parameter
2019-06-21 22:29:31 -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
cc2e8853b5
Enable int warnings by default
...
Now that there aren't any more...
2019-06-21 13:17:21 -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
f40ffc9d63
Pl_Flate: constructor's out_bufsize is now unsigned int
...
This is the type we need for the underlying zlib implementation.
2019-06-21 13:17:21 -04:00
Jay Berkenbilt
3608afd5c5
Add new integer accessors to QPDFObjectHandle
2019-06-21 13:17:21 -04:00
Jay Berkenbilt
42306e2ff8
QUtil: add unsigned int/string functions
2019-06-21 13:17:21 -04:00
Jay Berkenbilt
a66828caff
New safe type converters in QIntC
2019-06-21 13:17:21 -04:00
Jay Berkenbilt
616ae15595
Remove qpdf_read_memory_fuzzer
2019-06-18 08:43:55 -04:00
Jay Berkenbilt
127859a6d3
Run tests with sanitizers in CI
2019-06-15 17:24:24 -04:00
Jay Berkenbilt
bcfa407912
As a test suite, run stand-alone fuzzer on seed corpus
...
Temporarily skip fuzz tests on Windows. There are Windows-specific
failures to address later.
2019-06-15 17:24:24 -04:00
Jay Berkenbilt
cf469d7890
Give up reading objects with too many consecutive errors
2019-06-15 08:52:19 -04:00
Jay Berkenbilt
3d03024ab2
oss-fuzz initial integration
2019-06-13 09:28:38 -04:00
Jay Berkenbilt
31bde2f9d7
Handle empty DecodeParams array for ( fixes #331 )
...
On read, ignore /DecodeParms when empty list; on write, delete it.
Some files have been found that include an empty list for
/DecodeParms, but this is not technically compliant with the spec, and
the only sensible interpretation is to treat it as if there are no
decode parameters.
2019-06-09 17:19:49 -04:00
Jay Berkenbilt
b1a78be1a8
Prepare 8.4.2 release
2019-05-18 08:56:37 -04:00
Jay Berkenbilt
b3f0dbff62
Fix Windows memory error ( fixes #330 )
2019-05-16 14:26:51 -04:00
Jay Berkenbilt
a323f6f49f
Prepare 8.4.1 release
2019-04-27 20:44:20 -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
011695dfdf
Support Unicode in filenames ( fixes #298 )
2019-04-20 21:00:43 -04:00
Jay Berkenbilt
4ccb29912a
Tighten isPageObject ( fixes #310 )
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
Jay Berkenbilt
da7c2c0ee9
Fix json serialization for {x | -1 < x < 1} ( fixes #308 )
...
JSON serialization was preserving the value as presented, but JSON
doesn't accept decimal values without a 0 before the decimal point.
2019-03-11 16:22:59 -04:00
Jay Berkenbilt
03074ca5a0
Prepare 8.4.0 release
2019-02-01 22:25:25 -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
eb49e07c0a
Make inline image token exactly contain the image data
...
Do not include the trailing EI, and handle cases where EI is not
preceded by a delimiter. Such cases have been seen in the wild.
2019-01-31 20:28:44 -05:00
Jay Berkenbilt
5211bcb5ea
Externalize inline images ( fixes #278 )
2019-01-31 10:38:13 -05:00
Jay Berkenbilt
22bcdbe786
Remove acroread from tests
...
This hasn't worked or been exercised in years since Adobe stopped
releasing a Linux version of reader.
2019-01-31 10:38:13 -05:00
Jay Berkenbilt
1eb35a355f
Exclude space after ID in image data
2019-01-31 10:38:10 -05:00
Jay Berkenbilt
2b6c79bcae
Improve locating inline image's EI
...
We've actually seen a PDF file in the wild that contained EI
surrounded by delimiters inside the image data, which confused qpdf's
naive code. This significantly improves EI detection.
2019-01-31 09:26:37 -05:00
Jay Berkenbilt
31372edce0
Inline image token value ends with EI, not delimiter
...
The inline image token erroneously included the delimiter that
followed EI. The ObjectHandle created from it was correct.
2019-01-31 09:26:37 -05:00
Jay Berkenbilt
8a9cfd2605
Handle direct page objects ( fixes #164 )
2019-01-29 17:01:36 -05:00
Jay Berkenbilt
2712869cf9
Fix logic for when to compress object and xref streams ( fixes #271 )
2019-01-28 21:43:06 -05:00
Jay Berkenbilt
52f9d326a5
Resolve duplicated page objects ( fixes #268 )
...
When linearizing a file or getting the list of all pages in a file,
detect if the pages tree contains a duplicated page object and, if so,
shallow copy it. This makes it possible to have a one to one mapping
of page positions to page objects.
2019-01-28 20:29:58 -05:00
Jay Berkenbilt
426434c772
Add --overlay and --underlay to qpdf CLI ( fixes #207 )
2019-01-27 09:30:13 -05:00
Jay Berkenbilt
2d1db06042
Example of form XObject, page overlay
2019-01-27 07:50:30 -05:00
Jay Berkenbilt
623f5b664e
Convert pages to form XObjects
...
Support conversion of pages to form XObjects and placement of form
XObjects on pages.
2019-01-27 07:50:30 -05:00
Jay Berkenbilt
8cb245739c
Add QPDFObjectHandle::getUniqueResourceName
2019-01-27 07:50:30 -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
2d32f4db8f
Handle fallback font size in text appearances
...
If we end up using our fallback font size when generating appearances
for text fields, reflect that in the Tf operator used in the
appearance stream.
2019-01-21 07:38:21 -05:00
Jay Berkenbilt
930eade6d3
Fix omissions in text appearance generation
...
When generating appearance streams for variable text annotations,
properly handle the cases of there being no appearance dictionary, no
appearance stream, or an appearance stream with no BMC..EMC marker.
2019-01-20 23:05:58 -05:00
Jay Berkenbilt
65ef0bf313
When flattening, remove annotations with no appearance stream
...
With the exception of form field annotations when /NeedAppearances is
true, remove annotations that don't have appearance streams when
flattening. There is no reason to keep these when flattening since
they are invisible. This may include unchecked checkboxes, unshown
popup windows, etc.
2019-01-20 23:05:58 -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
e87d149918
Add QUtil::possible_repaired_encodings
2019-01-17 11:43:56 -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
4630377731
Add status-reporting transcoders to QUtil
2019-01-17 11:43:56 -05:00
Jay Berkenbilt
8f389f14c0
QUtil::analyze_encoding
2019-01-17 11:43:56 -05:00
Jay Berkenbilt
e09ae710dc
Add tests for shared font/xobject
...
The tests are in a separate commit so the bug-fix commit can be taken
as a patch for older versions.
2019-01-17 09:44:29 -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
4ecd1df6f2
Add configure option AVOID_WINDOWS_HANDLE
...
If set, we avoid using Windows I/O HANDLE, which is disallowed in some
versions of the Windows SDK, such as for Windows phones.
QUtil::same_file will always return false in this case. Only applies
to Windows builds.
2019-01-10 22:35:08 -05:00
Jay Berkenbilt
d24a120c7f
Add QPDF::setImmediateCopyFrom
2019-01-10 22:35:08 -05:00
Jay Berkenbilt
1dc235e56d
Add completion files for packagers
2019-01-07 19:56:46 -05:00
Jay Berkenbilt
2d0336d862
Add --disable-check-autofiles to configure
2019-01-07 19:56:36 -05:00
Jay Berkenbilt
8f6f7cec50
Prepare 8.3.0 release
2019-01-07 11:16:54 -05:00
Jay Berkenbilt
74bef044cc
Update release notes for 8.3.0
2019-01-07 11:16:54 -05:00
Jay Berkenbilt
fddbcab0e7
Mostly don't require original QPDF for copyForeignObject ( fixes #219 )
...
The original QPDF is only required now when the source
QPDFObjectHandle is a stream that gets its stream data from a
QPDFObjectHandle::StreamDataProvider.
2019-01-07 00:11:15 -05:00
Jay Berkenbilt
a70fbaaf50
Honor other base encodings when generating appearances
2019-01-05 23:01:59 -05:00
Jay Berkenbilt
b341d742db
Add WinAnsi and MacRoman encoding
2019-01-05 23:01:44 -05:00
Jay Berkenbilt
089ce5902e
Move utf8_to_utf16 into QUtil
2019-01-05 22:59:27 -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
16fd6e64f9
Add QPDFWriter::getFinalVersion ( fixes #266 )
2019-01-04 12:37:22 -05:00
Jay Berkenbilt
837dcf8fc2
Don't call assert while checking linearization data ( fixes #209 , #231 )
...
Instead of calling assert for problems found during checking
linearization data, throw an exception which is later caught and
issued as an error. Ideally we would handle errors more robustly, but
this is still a significant improvement.
2019-01-04 11:55:42 -05:00
Jay Berkenbilt
a01359189b
Fix dangling references ( fixes #240 )
...
On certain operations, such as iterating through all objects and
adding new indirect objects, walk through the entire object structure
and explicitly resolve any indirect references to non-existent
objects. That prevents new objects from springing into existence and
causing the previously dangling references to point to them.
2019-01-04 10:29:29 -05:00
Jay Berkenbilt
158156d506
Add basic appearance stream generation
2019-01-04 08:00:19 -05:00
Jay Berkenbilt
02281632cc
Add QUtil::utf8_to_ascii
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
06d6438ddf
Minor fixes
2019-01-03 09:17:43 -05:00
Jay Berkenbilt
f78ea057ca
Switch annotation flattening to use the form xobjects
...
Instead of directly putting the contents of the annotation appearance
streams into the page's content stream, add commands to render the
form xobjects directly. This is a more robust way to do it than the
original solution as it works properly with patterns and avoids
problems with resource name clashes between the pages and the form
xobjects.
2019-01-02 21:49:47 -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
95d6b17a89
Add QPDFObjectHandle::mergeDictionary()
2019-01-01 08:12:56 -05:00
Jay Berkenbilt
5059ec0d35
Add Matrix class under QPDFObjectHandle
2018-12-31 23:02:43 -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
24aeb9ae22
Document json support
2018-12-22 14:05:01 -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
313ba08126
Preserve some outline functionality in page splitting
2018-12-21 19:11:57 -05:00
Jay Berkenbilt
d5d179f441
Add document and object helpers for outlines (bookmarks)
2018-12-21 19:11:57 -05:00
Jay Berkenbilt
30a0c070e4
Add QPDFObjectHandle::getJSON()
2018-12-21 18:34:56 -05:00
Jay Berkenbilt
651179b5da
Add simple JSON serializer
2018-12-21 18:34:56 -05:00
Jay Berkenbilt
0776c00129
Add QPDFNameTreeObjectHelper
2018-12-21 18:34:56 -05:00
Jay Berkenbilt
352ce9b22b
Preserve page labels (numbers) when splitting and merging
2018-12-18 16:59:24 -05:00
Jay Berkenbilt
6ef9e31233
Add QPDFPageLabelDocumentHelper
2018-12-18 16:59:24 -05:00
Jay Berkenbilt
f38df27aa3
Add QPDFNumberTreeObjectHelper
2018-12-18 16:46:10 -05:00
Jay Berkenbilt
077d3d4512
Add QPDFObjectHandle::wrapInArray()
...
Wrap an object in an array if it is not already an array.
2018-12-18 16:45:48 -05:00
Jay Berkenbilt
a5ee55f2e8
ChangeLog
2018-10-11 19:16:26 -04:00
Jay Berkenbilt
4628461383
Set up Azure Pipelines
...
Use free Azure Pipelines to do Linux, Windows, and Mac build and test
and to generate Windows binary distributions.
2018-10-11 15:07:51 -04:00
Jay Berkenbilt
6ee761fc86
Prepare 8.2.1 release
2018-08-18 10:56:19 -04:00
Jay Berkenbilt
28453a4908
Add --keep-files-open flag ( fixes #237 )
2018-08-18 10:56:01 -04:00
Jay Berkenbilt
5e9e17e62a
Prepare 8.2.0 release
2018-08-16 11:53:10 -04:00
Jay Berkenbilt
723b054bf9
Spell check
2018-08-16 11:53:10 -04:00
Jay Berkenbilt
e37ce85190
Clarify static vs. import library on Windows ( fixes #225 )
2018-08-14 16:57:37 -04:00
Jay Berkenbilt
b4bdc42b4f
New exception class QPDFSystemError ( fixes #221 )
2018-08-13 20:01:51 -04:00
Jay Berkenbilt
fb1e29476c
Add --no-warn option to suppress warnings ( fixes #232 )
2018-08-12 22:20:40 -04:00
Jay Berkenbilt
3d6615b276
Pl_Buffer: reduce memory growth ( fixes #228 )
...
Rather than keeping a list of buffers for every write, accumulate
bytes in a single buffer, doubling the size of the buffer when needed
to accommodate new data.
This is not the best possible implementation, but the change was
implemented in this way to avoid changing the shape of Pl_Buffer and
thus breaking backward compatibility.
2018-08-12 17:45:43 -04:00
Jay Berkenbilt
4a4736c695
Fix EOL handling inside strings ( fixes #226 )
...
CR, CRLF, and LF are all supposed to be treated as LF; only one EOL is
to be ignored after backslash.
2018-08-05 20:48:35 -04:00
Jay Berkenbilt
e1cd5891af
Fix infinite loop on small files with progress reporting ( fixes #230 )
...
Turns out you can keep adding zero to a number over and over again and
it just doesn't get any bigger. Who would have known?
2018-08-05 15:43:34 -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
4f4c627b77
ClosedFileInputSource: add method to keep file open
...
During periods of intensive operation on a specific file, this method
can reduce the overhead of repeated open/close operations.
2018-08-04 19:52:46 -04:00
Jay Berkenbilt
1bd2a2e79b
Prepare 8.1.0 release
2018-06-23 07:50:11 -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
2a82f6e1e0
Add method to get count of objects in QPDF
2018-06-22 15:53:40 -04:00
Jay Berkenbilt
99593e0eef
Use ClosedFileInputSource when merging files ( fixes #154 )
2018-06-22 12:53:41 -04:00