Commit Graph

492 Commits

Author SHA1 Message Date
Jay Berkenbilt d866f48081 Change names of qpdf_object_type_e enumerations
They have to be ot_* rather than qpdf_ot_* for compatibility.

* Different enumerated types are not assignment-compatible in C++, at
  least with strict compiler settings
* While you can do `constexpr ot_xyz = ::qpdf_ot_xyz` in QPDFObject.hh to
  make QPDFObject::ot_xyz work, QPDFObject::object_type_e::ot_xyz will
  only work if the enumerated type names are the same.
2021-12-20 14:51:45 -05:00
Jay Berkenbilt ea73bf72e0 Further improvements to handling binary strings 2021-12-19 14:30:45 -05:00
Jay Berkenbilt e19114df7a Remove unneeded paragraph from comments 2021-12-18 11:05:51 -05:00
Jay Berkenbilt ddbe59179e C API: simplify new error handling and improve documentation 2021-12-17 15:59:47 -05:00
m-holger f6293bd94c C-API expose QPDFObjectHandle::getTypeCode and getTypeName (fixes #597) 2021-12-17 14:24:43 -05:00
Jay Berkenbilt feafcc4e88 C API: add several stream functions (fixes #596) 2021-12-17 13:28:11 -05:00
Jay Berkenbilt c40f8b5329 Make object types available to C API 2021-12-17 12:38:52 -05:00
Jay Berkenbilt fee7489ee4 Add Pl_Buffer::getMallocBuffer 2021-12-17 12:38:52 -05:00
Jay Berkenbilt 9bb6f570ec C API: add functions for working with pages (fixes #594) 2021-12-16 15:07:48 -05:00
Jay Berkenbilt 3f9d50b526 Change name of formal parameters from data to qpdf 2021-12-16 11:51:15 -05:00
Jay Berkenbilt 1c62c2a342 C API: expose functions for indirect objects (fixes #588) 2021-12-10 14:57:35 -05:00
Jay Berkenbilt 8e0b153332 Expose QPDFObjectHandle::addTokenFilter (fixes #580) 2021-12-10 13:37:07 -05:00
Jay Berkenbilt 72c10d8617 C API: overhaul error handling
* Handle error conditions that occur when using the object handle
  interfaces. In the past, some exceptions were not correctly
  converted to errors or warnings.
* Add more detailed information to qpdf-c.h
* Make it possible to work more explicitly with uninitialized objects
2021-12-10 12:16:02 -05:00
Jay Berkenbilt 3340dbe976 Use a specific error code for type warnings and clarify docs 2021-12-10 11:15:49 -05:00
Jay Berkenbilt e3cc171d02 C API: qpdf_oh_is_initialized 2021-12-09 10:33:31 -05:00
Jay Berkenbilt bef2c2222a C API: qpdf_get_last_string_length 2021-12-09 10:33:31 -05:00
Jay Berkenbilt 73d70902e0 Typos in comments 2021-12-09 10:33:31 -05:00
m-holger 0c705a882b Minor documentation updates 2021-12-09 10:24:14 -05:00
m-holger b4fc9eb700 C-API expose new_object as qpdf_oh_new_object 2021-12-02 13:59:58 -05:00
Jay Berkenbilt 720ce9e8f3 Improve testing and error handling around operating before processing 2021-11-29 07:42:36 -05:00
m-holger 4630b8567c Ensure qpdf_oh handles returned by C-API functions are unique.
Return new qpdf_oh from qpdf_oh_wrap_in_array when input is already an array.
Update some doc comments in qpdf-c.h.
2021-11-19 13:31:59 +00:00
Jay Berkenbilt 750aca5b94 First increment of improving handling of weak crypto (fixes #358) 2021-11-11 12:24:15 -05:00
Jay Berkenbilt ec09b91443 Add QIntC::range_check_subtract 2021-11-04 13:53:46 -04:00
Jay Berkenbilt 9b28933647 Check object ownership when adding
When adding a QPDFObjectHandle to an array or dictionary, if possible,
check if the new object belongs to the same QPDF. This makes it much
easier to find incorrect code than waiting for the situation to be
detected when the file is written.
2021-11-04 12:29:42 -04:00
Jay Berkenbilt 33a47d5c3c Make QPDF::findPage public (fixes #516)
This was originally not public because I wanted to get rid fo the
pages cache, but I recently realized there were deep reasons not to do
that, and the author of pikepdf wanted this, so I decided to make it
public.
2021-11-03 09:43:17 -04:00
Jay Berkenbilt 532a4f3d60 Detect recoverable but invalid zlib data streams (fixes #562) 2021-11-03 09:43:17 -04:00
Jay Berkenbilt 8971443e46 QPDF::addPage*: handle duplicate pages more robustly 2021-04-05 10:58:10 -04:00
Jay Berkenbilt cb6e53136f QPDFAcroFormDocumentHelper: add missing analyze calls 2021-03-04 18:11:44 -05:00
Jay Berkenbilt 0b77f2cf26 Revert non-binary-compatible handleWarning change -- see TODO (ABI) 2021-03-04 15:59:46 -05:00
Jay Berkenbilt 9fb174b9e9 Major rework of handling form fields when copying pages (fixes #509) 2021-03-04 15:08:37 -05:00
Jay Berkenbilt a2124f992c Add QPDFMatrix::operator== 2021-03-04 15:08:36 -05:00
Jay Berkenbilt c9c711a351 Add string to deprecation warning 2021-03-04 15:08:36 -05:00
Jay Berkenbilt d7ffdfa994 Add optional conflict detection to mergeResources
Also improve behavior around direct vs. indirect resources.
2021-03-04 15:08:36 -05:00
Jay Berkenbilt a15ec6967d Enhancements to ParserCallbacks 2021-03-03 17:05:49 -05:00
Jay Berkenbilt 1bb209a9bf Add QPDF::numWarnings 2021-03-03 17:05:49 -05:00
Jay Berkenbilt fa2516df71 Fix behavior for finding /Q, /DA, and /DR for form fields
If not found in the field hierarchy, /Q and /DA are supposed to be
looked up in the document-level form dictionary. /DR is supposed to
only come from the document dictionary.
2021-03-03 17:05:19 -05:00
Jay Berkenbilt a4d6589ff2 Have QPDFObjectHandle notice when replaceObject was called
This results in a performance penalty of 1% to 2% when replaceObject
and swapObjects are never called and a somewhat larger penalty if they
are called, but it's worth it to avoid very confusing behavior as
discussed in depth in qpdf#507.
2021-02-25 07:32:46 -05:00
Jay Berkenbilt 1886673d7e Spell check 2021-02-23 10:38:05 -05:00
Jay Berkenbilt be3a8c0e7a Keep only referenced form fields in --pages 2021-02-23 08:26:21 -05:00
Jay Berkenbilt 1f35ec9988 Add methods for copying form fields 2021-02-22 18:42:06 -05:00
Jay Berkenbilt 8e8c0d8290 Add new placeFormXObject that takes a matrix reference 2021-02-22 18:42:06 -05:00
Jay Berkenbilt 61d41e2e88 Add copyAnnotations, use with overlay/underlay (fixes #395) 2021-02-22 18:42:06 -05:00
Jay Berkenbilt 7b3cbacf5d Change from QPDF{Array,Dict}Items to aitems() and ditems() 2021-02-22 11:05:39 -05:00
Jay Berkenbilt a9ae8cadc6 Add transformAnnotations and fix flattenRotations to use it 2021-02-21 17:13:09 -05:00
Jay Berkenbilt a76decd2d5 Add QPDFObjGen::unparse 2021-02-21 16:21:52 -05:00
Jay Berkenbilt aa848126cb Comment about QPDFMatrix and QPDFObjectHandle::Matrix 2021-02-21 08:06:19 -05:00
Jay Berkenbilt 92fbc6fdf5 QPDFObjectHandle::copyStream 2021-02-21 06:36:30 -05:00
Jay Berkenbilt 60afe4142e Refactor: separate copyStreamData from replaceForeignIndirectObjects 2021-02-21 06:36:30 -05:00
Jay Berkenbilt 901f1a788c Enhance QPDFMatrix API 2021-02-21 06:36:30 -05:00
Jay Berkenbilt 71e8627285 Add const versions of QPDFMatrix::transform* 2021-02-19 18:35:19 -05:00