Commit Graph

893 Commits

Author SHA1 Message Date
Jay Berkenbilt 293a2e52b3 Disregard appearance state when irrelevant (fixes #949)
If /AP is a dictionary of streams rather than a dictionary of
dictionaries, disregard /AS, which is supposed to point to a subkey of
one of the dictionaries. This fix prevents qpdf's annotation
flattening from discarding some annotations when /AS is erroneously
set.
2023-05-20 15:46:16 -04:00
Jay Berkenbilt d740c6ccce Rerun format_code (after merging clang-tidy PR) 2023-05-20 14:52:19 -04:00
m-holger 41ec7eda54 Use auto when initialializing with new 2023-05-20 15:41:40 +01:00
m-holger d0682f0f60 Use nullptr instead of 0 or NULL 2023-05-20 15:41:36 +01:00
m-holger e28f4efb00 Replace deprecated C++ includes 2023-05-20 15:41:25 +01:00
m-holger 7f043fe88e Remove unused include directives 2023-05-20 15:37:41 +01:00
m-holger 3f2ebf334b Fix bug in QPDF_Name::normalizeName introduced in #891
'#' was omitted from the list of chars that need to be escaped.
2023-04-04 15:54:54 +01:00
m-holger 41f79bedbc Add new functions qpdfjob_create_qpdf and qpdfjob_write_qpdf 2023-04-02 09:45:19 +01:00
m-holger 182c2480df Refactor QPDF_Array::setItem and rename to setAt 2023-04-01 13:56:29 +01:00
m-holger 4d37389bef Refactor QPDF_Array::eraseItem and rename to erase 2023-04-01 13:56:16 +01:00
m-holger 1bb23d0545 Refactor QPDF_Array::insertItem and rename to insert 2023-04-01 13:56:10 +01:00
Jay Berkenbilt f89196b6c8
Merge pull request #814 from m-holger/check
Warn if catalog type entry is invalid (fixes #810)
2023-03-20 06:59:47 -04:00
m-holger d8acccd5c8 Warn if catalog type entry is invalid (fixes #810) 2023-03-19 20:07:53 +00:00
Jay Berkenbilt fe36ef141c
Merge pull request #924 from cdosborn/main
Improve --optimize-images to find images nested within XObjects
2023-03-18 15:34:27 -04:00
Jay Berkenbilt 1e53da74bc
Merge pull request #918 from m-holger/fixqdf
Code tidy QdfFixer methods
2023-03-18 14:00:11 -04:00
Connor Osborn f6b13fcc05 Add test validating that images in nested XObjects are included in optimization
The sample file (nested-images.pdf) includes a pdf with an image that is
nested within an XObject within an XObject in the Resources dict of the
only page. These images were ignored in prior versions of qpdf.
2023-03-15 23:27:05 -04:00
m-holger cfcceff6aa Replace std::regex_search with string_view methods in QdfFixer::processLines 2023-03-09 12:16:33 +00:00
m-holger 011b1d7e3a Use std::string_view in QdfFixer::processLines
Change type of local var lines to string_view. Also, instead of
constructing a list of lines, read the entire input into a single string
and break it up into lines on the fly.stash
2023-03-09 11:44:26 +00:00
m-holger 82efe52b7d Tidy QdfFixer::adjustOstreamXref 2023-03-08 10:00:17 +00:00
m-holger fc828c2a50 Tidy QdfFixer::checkObjId 2023-03-08 09:56:53 +00:00
m-holger 71bba5d40d Code tidy QdfFixer::writeBinary 2023-03-08 09:50:49 +00:00
Jay Berkenbilt 78f7dc9fe8 Overlay/underlay: capture origial page as form XObject (fixes #904) 2023-02-25 12:58:51 -05:00
Jay Berkenbilt 0f97e98203 Handle linearization warnings as proper warning (fixes #851) 2023-02-18 19:38:49 -05:00
m-holger bb89a60320 Add data member JSONParser::token_start 2023-02-04 13:52:55 +00:00
Jay Berkenbilt 1308c45090 Implement --remove-restrictions (fixes #833) 2023-01-28 13:42:19 -05:00
Jay Berkenbilt e4e0f40fc0 Fix annotations properly for page with no /Resources (fixes #827) 2023-01-09 07:31:39 -05:00
Jay Berkenbilt bf477fbb96 Do double indirect test correctly 2023-01-01 07:33:34 -05:00
Jay Berkenbilt ce8e63cb9a Add test case for broken indirect object reference
...where the first "number" is an indirect object that happens to be a
number.
2022-12-31 15:12:58 -05:00
m-holger 0ca44ef84c Fix QPDFObjectHandle::isScalar
Exclude uninitialized, destroyed and reserved objects.
2022-12-31 09:27:19 -05:00
Jay Berkenbilt ff42ea4e6c Fix logic for fixDanglingReferences 2022-11-26 18:13:46 -05:00
m-holger 3f632458ae Refactor QPDF::fixDanglingReferences 2022-11-26 16:26:42 -05:00
Jay Berkenbilt 19a8d3fea2 Add test case of dangling ref not found until xref reconstruction 2022-11-25 15:16:16 -05:00
Jay Berkenbilt 32251497c1 Temporary (revert after fix): mark test as expected failure 2022-11-25 15:16:16 -05:00
Jay Berkenbilt bd337b8055 Preserve unreferenced objects in dangling test 2022-11-25 15:16:16 -05:00
Jay Berkenbilt f6367bbada Dangling ref test: show new object ID 2022-11-25 15:16:16 -05:00
Jay Berkenbilt 5489f1d8d6 Code formatting updates 2022-11-25 15:16:16 -05:00
m-holger b1eb1a9584 Refactor QPDFObjectHandle::copyObject1 2022-11-20 12:07:22 -05:00
Jay Berkenbilt e9980efec8 Correctly handle reuse of xref stream (fixes #809) 2022-11-19 17:03:17 -05:00
m-holger f69ed209d0 Use QPDF::newStream in examples 2022-11-19 14:10:42 -05:00
Jay Berkenbilt db6598b449 Attempt to test for QPDFNameTreeObjectHelper's vtable
It has disappeared from the DLL on Windows a few times.
2022-10-06 08:40:08 -04:00
m-holger 5ccab4be03 Add private methods QPDF::damagedPDF 2022-10-01 11:17:39 -04:00
Jay Berkenbilt f4ca04cec1 Fix edge case in character encoding (fixes #778)
Avoid representing as PDF Doc encoding any string whose PDF Doc
encoding representation starts with a UTF-16 or UTF-8 marker.
2022-09-26 08:06:47 -04:00
Jay Berkenbilt 77111086eb Add code to CI to verify signed/unsigned char
Make sure that our attempt to test both signed and unsigned char is
actually right.
2022-09-23 17:44:16 -04:00
m-holger 2e6869483b Replace calls to QUtil::int_to_string with std::to_string 2022-09-21 15:57:14 -04:00
Jay Berkenbilt 2394acf7a6 Remove explicit direct object check from getObject
An indirect object reference to 0, 0 is invalid. If it appears in the
file or is parsed from a string, the parser catches it. This check
would only be useful for someone explicitly calling getObject with 0,
0, and that would trigger an error during resolve().
2022-09-13 11:21:29 -04:00
Jay Berkenbilt 4963ce6a53 Remove obsolete LL_FMT check from build (fixes #768)
This was broken for cross-compilation and has probably been
unnecessary for several years now.

Also fix extraneous whitespace in related some tests.
2022-09-12 11:48:38 -04:00
Jay Berkenbilt 8a3cdfd2af Change QPDFObjectHandle == to isSameObjectAs
Replace operator== and operator!=, which were testing for the same
underlying object, with isSameObjectAs. This change was motivated by
the fact that pikepdf internally had its own operator== method for
QPDFObjectHandle that did structural comparison. I backed out qpdf's
operator== as a courtesy to pikepdf (in my own testing) but also
because I think people might naturally assume that operator== does a
structural comparison, and isSameObjectAs is clearer in its intent.
2022-09-09 18:09:40 -04:00
Jay Berkenbilt 3dbab589e3 Add C API functions for using custom loggers
Expose functions to the C API to create new loggers and to setLogger
and getLogger for QPDF and QPDFJob.
2022-09-09 10:49:25 -04:00
Andreas Stieger 7049588bff Fix tests with GNU grep 3.8
GNU grep 3.8 started to emit warnings when invoking egrep.
Convert all calls to grep -E.
2022-09-09 06:57:38 -04:00
Jay Berkenbilt f1a2d3160a Add JSON v2 support to C API 2022-09-09 06:19:09 -04:00