Commit Graph

100 Commits

Author SHA1 Message Date
Fredrik Fornwall e0775238b8 Fix QPDFEFStreamObjectHelper::{get,set}Subtype
The /Subtype entry that specifies the mime type of an embedded file is
inside the embedded file stream dictionary directly, not it in the
parameter dictionary.

See Table 45 and 46 in the PDF 1.7 specification:
https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#page=112
2021-09-10 10:02:24 -04:00
Jay Berkenbilt cb6e53136f QPDFAcroFormDocumentHelper: add missing analyze calls 2021-03-04 18:11:44 -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 3bdefb4c2d Update examples to use copyStream() 2021-02-25 13:21:23 -05:00
Jay Berkenbilt 8fc453b724 Remove accidentally-committed file and fix test that created it 2021-02-23 10:38:05 -05:00
Jay Berkenbilt f02aa74bf5 Update pdf-overlay-page example to copy annotations 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 0a52e60ece Use QUtil::path_basename 2021-02-18 09:59:03 -05:00
Jay Berkenbilt f21e4f264a Add file attachment example 2021-02-18 09:59:03 -05:00
Jay Berkenbilt 07f40bd254 QUtil::double_to_string: trim trailing zeroes with option to disable 2021-02-13 02:30:00 -05:00
Jay Berkenbilt 1f4771cd0d Minor clean up of Windows headers 2021-02-10 07:36:18 -05:00
Jay Berkenbilt bfbeec5497 Make newly created name/number trees indirect objects 2021-02-08 06:49:56 -05:00
Jay Berkenbilt 4ae93a73c5 Improve memory safety of dict/array iterators 2021-01-31 07:16: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 ce19ec5c4b Update examples to use QPDFObjectHandle iterators 2021-01-30 15:15:24 -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 18340b8835 Spell check 2021-01-04 16:26:58 -05:00
Jay Berkenbilt 3be58f49e5 Make more QPDFPageObjectHelper methods work with form XObject 2021-01-02 14:08:53 -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 d4d7630cf5 Add pdf-custom-filter example 2020-12-28 13:03:04 -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 92d3cbecd4 Fix warnings reported by -Wshadow=local (fixes #431) 2020-04-16 12:41:43 -04:00
Jay Berkenbilt 62d5fb34b1 Fix typo in test case name 2020-04-08 20:46:01 -04:00
Jay Berkenbilt b89b1d772d Fix memory leak in pdf-invert-images
A class can't have a PointerHolder to itself since PointerHolder
doesn't have the concept of weak references.
2020-04-08 20:45:26 -04:00
Jay Berkenbilt 65ae8511a7 Improve pdf-invert-images example 2020-04-07 18:11:00 -04:00
Jay Berkenbilt ea58680eb0 Mention appearances in pdf-set-form-values example 2020-02-22 12:10:13 -05:00
Jay Berkenbilt 3f1ab64066 Pass offset and length to ParserCallbacks::handleObject 2019-08-22 22:54:29 -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 848351f1fc Add missing #include <cstring> 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
Thorsten Schöning 2c704b99a1 Undefined functions because of missing std:: or header. (#295)
* [bcc32 Error] QPDF.cc(375): E2268 Call to undefined function 'atof'
  Full parser context
    QPDF.cc(358): parsing: void QPDF::parse(const char *)

* [bcc32 Error] QPDFTokenizer.cc(183): E2268 Call to undefined function 'strtol'
  Full parser context
    QPDFTokenizer.cc(163): parsing: void QPDFTokenizer::resolveLiteral()

* [bcc32 Error] pdf-split-pages.cc(52): E2268 Call to undefined function 'exit'
  Full parser context
    pdf-split-pages.cc(50): parsing: void usage()

* PR #295: Including "cstdlib" should be replaced with "stdlib.h" to be more consistent. At the same time I changed the order of the surrounding includes to reflect alphabetical order, because at some files this already have been the case.
2019-03-12 10:05:29 -04:00
Jay Berkenbilt 8acf636b4e Incorporate improved Windows fragility workaround from qtest 2019-02-01 22:25:25 -05:00
Jay Berkenbilt 2d1db06042 Example of form XObject, page overlay 2019-01-27 07:50:30 -05:00
Jay Berkenbilt e6f1e54771 Work around test fragility on Windows 2019-01-07 12:51:34 -05:00
Jay Berkenbilt 2e306d3249 Add comment about json to pdf-bookmarks 2018-12-23 09:15:46 -05:00
Jay Berkenbilt 4fbffdf8ed Rewrite bookmark example to use outline helpers
Now uses QPDFOutlineDocumentHelper and QPDFOutlineObjectHelper.
2018-12-21 19:11:57 -05: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 32ddcec91e Add missing headers 2018-06-22 11:44:04 -04:00
Jay Berkenbilt 2e8a3e163f Add interactive form example 2018-06-21 16:04:54 -04:00
Jay Berkenbilt 2e6e1204a5 Convert examples to use new page helper classes 2018-06-21 15:57:13 -04:00
Jay Berkenbilt 4bb3046f0b Properly handle strings with PDF Doc Encoding (fixes #179)
The QPDF_String::getUTF8Val() method was not treating strings that
weren't explicitly Unicode as PDF Doc Encoded. This only affects
characters in the range 0x80 through 0xa0.
2018-02-18 21:06:27 -05:00
Jay Berkenbilt e410b0fe0d Simplify TokenFilter interface
Expose Pl_QPDFTokenizer, and have it do more of the work of managing
the token filter's pipeline.
2018-02-18 21:05:47 -05:00
Jay Berkenbilt 5708b5d0aa Add additional interface for filtering page contents 2018-02-18 21:05:47 -05:00
Jay Berkenbilt 30709935af Filter tokens example 2018-02-18 21:05:47 -05:00
Jay Berkenbilt 25988e8d10 Bug fix: content normalizer should not add trailing newline
Adding a trailing newline in content normalization damages files whose
contents are split across streams in the middle of tokens. Let
QPDFWriter add the newline with the indicator to ignore the newline,
which it already does. This changes the way some qdf files look.
2018-02-18 21:05:46 -05:00
Jay Berkenbilt 6afe83978f Switch from parseContentStream to parsePageContents 2018-02-18 21:05:46 -05:00
Jay Berkenbilt 9732de7ea4 Rename test output files (fixes #173)
Some file names had `...` in their name, which causes problems on some
systems.
2018-02-04 14:26:34 -05:00
Jay Berkenbilt 559eefa9d0 Add comment to setStaticID call 2018-02-04 14:19:00 -05:00