Commit Graph

53 Commits

Author SHA1 Message Date
Jay Berkenbilt 4ee393d1fa Remove compression from linearization tests where possible
By combining --linearize with --compress-streams=n, we ensure that no
new compressed data will appear in linearized output, which makes the
output independent of zlib's output. There are other tests to ensure
that linearization works correctly with compression. This commit
involves changing some test outputs and test code as well just
updating test suites.
2023-12-20 15:46:20 -05:00
Jay Berkenbilt c67634afa0 Fix tests when running comparison tool is adequate
Fix all tests where the only required fix is to run qpdf-test-compare
instead of doing a simple file comparison.
2023-12-20 15:21:32 -05:00
Jay Berkenbilt d7a364b882 Allow regular C++ functions to interoperate with the C API 2023-12-16 10:06:34 -05:00
Jay Berkenbilt 5f02c7c9e7 Tweak pdf-filter-tokens to be less sensitive to floating point
Switch output to QDF for easier diffing
Simplify input image
Reduce decimal places

This works around an issue were, for certain versions, the mingw32
tests failed because of irrelevant floating point rounding issues in
the test output.
2023-05-20 14:52:19 -04:00
m-holger 99231c4378 Add example qpdfjob-remove-annotations 2023-03-09 17:29:39 +00:00
Jay Berkenbilt 8e361d98f0 Add examples for output capture (fixes #691) 2022-06-19 08:46:58 -04:00
Jay Berkenbilt a734af681b Run qpdf from path rather than environment variable in tests
With cmake, we are customizing the path for each test suite so we can
ensure we get the right qpdf without having to use an environment
variable.
2022-03-18 19:53:18 -04:00
Jay Berkenbilt cb769c62e5 WHITESPACE ONLY -- expand tabs in source code
This comment expands all tabs using an 8-character tab-width. You
should ignore this commit when using git blame or use git blame -w.

In the early days, I used to use tabs where possible for indentation,
since emacs did this automatically. In recent years, I have switched
to only using spaces, which means qpdf source code has been a mixture
of spaces and tabs. I have avoided cleaning this up because of not
wanting gratuitous whitespaces change to cloud the output of git
blame, but I changed my mind after discussing with users who view qpdf
source code in editors/IDEs that have other tab widths by default and
in light of the fact that I am planning to start applying automatic
code formatting soon.
2022-02-08 11:51:15 -05:00
m-holger 3e98fe46a2 Tidy example CLI usage
Change "-" to "--" for named parameters.
Remove spaces inside "[ option ]" for optional parameters.
Fix "pdf-mod-info --dump file" to match usage message.
2022-02-07 12:49:24 -05:00
Jay Berkenbilt a0d9d9923c Finish QPDFJob examples and add tests for them 2022-02-01 13:50:58 -05:00
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 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 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 bfbeec5497 Make newly created name/number trees indirect objects 2021-02-08 06:49:56 -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 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 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 62d5fb34b1 Fix typo in test case name 2020-04-08 20:46:01 -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
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 2e8a3e163f Add interactive form example 2018-06-21 16:04:54 -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 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 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 ceae9dc1cb Enhance pdf-create example
pdf-create now creates images with different color spaces and encoding
schemes and verifies them for data correctness.
2017-08-21 17:44:22 -04:00
Jay Berkenbilt 428d96dfe1 Convert many more errors to warnings 2017-07-27 22:57:55 -04:00
Jay Berkenbilt 0b2e9cb168 Example: fast split into single pages
This is faster than using qpdf --pages to do it.
2014-06-07 16:40:38 -04:00
Jay Berkenbilt 478c05fcab Allow -DNO_GET_ENVIRONMENT to avoid GetEnvironmentVariable
If NO_GET_ENVIRONMENT is #defined at compile time on Windows, do not
call GetEnvironmentVariable.  QUtil::get_env will always return
false.  This option is not available through configure.  This was
added to support a specific user's requirements to avoid calling
GetEnvironmentVariable from the Windows API.  Nothing in qpdf outside
the test coverage system in qtest relies on QUtil::get_env.
2013-11-30 15:58:32 -05:00
Jay Berkenbilt bfda717749 Cosmetic changes to be closer to Adobe terminology
Change object type Keyword to Operator, and place the order of the
object types in object_type_e in the same order as they are mentioned
in the PDF specification.

Note that this change only breaks backward compatibility with code
that has not yet been released.
2013-01-23 09:38:05 -05:00
Jay Berkenbilt 913eb5ac35 Add getTypeCode() and getTypeName()
Add virtual methods to QPDFObject, wrappers to QPDFObjectHandle, and
implementations to all the QPDF_Object types.
2013-01-22 10:01:45 -05:00
Jay Berkenbilt f81152311e Add QPDFObjectHandle::parseContentStream method
This method allows parsing of the PDF objects in a content stream or
array of content streams.
2013-01-20 15:35:39 -05:00
Jay Berkenbilt ffb96ee17e Add pdf-from-scratch example 2012-06-23 09:05:06 -04:00
Jay Berkenbilt cb1d89e763 invert images example
git-svn-id: svn+q:///qpdf/trunk@1001 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-06 01:27:47 +00:00
Jay Berkenbilt b6c7a80950 rename program
git-svn-id: svn+q:///qpdf/trunk@1000 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-06 00:45:51 +00:00
Jay Berkenbilt 9ba5b27ce4 add double-page-size example
git-svn-id: svn+q:///qpdf/trunk@996 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-05 21:51:19 +00:00
Jay Berkenbilt 71f171356a change output message from qpdf --check when no errors are found
git-svn-id: svn+q:///qpdf/trunk@955 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-04-10 13:43:16 +00:00
Jay Berkenbilt 3f8c4c2736 categorize all error messages and include object information if available
git-svn-id: svn+q:///qpdf/trunk@829 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-19 23:09:19 +00:00
Jay Berkenbilt 351284b5ec make -key not take an argument with a / to appease msys's path translation
git-svn-id: svn+q:///qpdf/trunk@803 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-14 01:06:18 +00:00
Jay Berkenbilt d6d36b6ced C linearization example
git-svn-id: svn+q:///qpdf/trunk@739 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 20:59:16 +00:00