Commit Graph

725 Commits

Author SHA1 Message Date
Jay Berkenbilt 6941923ca9 Improve large file test output 2022-03-18 19:53:18 -04:00
Jay Berkenbilt c0a231bf32 Reverse sense of compare images toggle for qpdf.test
Run compare images tests when QPDF_TEST_COMPARE_IMAGES is set rather
than when QPDF_SKIP_TEST_COMPARE_IMAGES is not set.
2022-03-18 19:53:18 -04:00
Jay Berkenbilt 17c0e38c8e Force assert to be defined in test code 2022-03-07 10:07:27 -05:00
Jay Berkenbilt 1d86b70eab Tweak include of config for ctest 2022-03-01 14:01:34 -05:00
Jay Berkenbilt 99393e6ab7 Shorten coverage case name
This is so it will fit on one line after a qtest upgrade allows us to
split lines.
2022-02-26 10:18:23 -05:00
Jay Berkenbilt f7ac591590 Recognize explicit UTF-8 strings (fixes #654) 2022-02-22 08:10:05 -05:00
Jay Berkenbilt 31b45b0fd4 Fix logic error with Tf when generating appearances (fixes #655) 2022-02-18 13:46:35 -05:00
Jay Berkenbilt 3e2109ab37 Remove special case for 0xad for 10.6.2. 2022-02-16 06:52:05 -05:00
Jay Berkenbilt e810fe678a Fix asymmetry between newUnicodeString and getUTF8Value 2022-02-15 19:22:35 -05:00
Jay Berkenbilt a478cbb6dc Silently/transparently recognize UTF-16LE as UTF-16 (fixes #649)
The PDF spec only allows UTF-16BE, but most readers seem to accept
UTF-16LE as well, so now qpdf does too.
2022-02-15 16:13:12 -05:00
Jay Berkenbilt fbd3e56da7 Ignore -- at the top level arg parser (fixes #652)
This was unintended behavior that was added back for backward
compatibility. It is intentionally undocumented.
2022-02-15 16:13:12 -05:00
Jay Berkenbilt 19608ec151 Add missing spaces in usageExit 2022-02-15 16:11:33 -05:00
Jay Berkenbilt 956a272d62 Remove abs calls and pick correct floating point epsilon values (fixes #641) 2022-02-11 07:18:33 -05:00
Jay Berkenbilt d501e1c0d4 Only update output version from files used as input
If we're opening a PDF file to copy its encryption information or
attachments, its version doesn't need to influence the output version.
2022-02-08 13:49:22 -05:00
Jay Berkenbilt f91b21c7d4 Preserve input PDF version on pages/split-pages (fixes #610) 2022-02-08 12:34:14 -05:00
Jay Berkenbilt cfd5147d92 Add QPDF::getVersionAsPDFVersion 2022-02-08 12:34:14 -05: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
Jay Berkenbilt c62e8e2b28 Update for clean compile with POINTERHOLDER_TRANSITION=2 2022-02-07 17:38:22 -05:00
m-holger 5901fcad4c C-API expose QPDFObjectHandle::getKeyIfDict 2022-02-06 11:21:15 -05:00
m-holger 8371060340 Add method QPDFObjectHandle::getKeyIfDict 2022-02-06 11:21:15 -05:00
m-holger 2ed5f49a79 C-API expose QPDFObjectHandle::getValueAs... accessors 2022-02-05 19:40:30 -05:00
Jay Berkenbilt 7fb22740e1 Add operator ""_qpdf for creating QPDFObjectHandle literals 2022-02-05 11:29:25 -05:00
Jay Berkenbilt b48a0ff0e8 Add qpdf_empty_pdf to C API 2022-02-05 11:29:25 -05:00
m-holger e58b1174c7 Add new QPDFObjectHandle::getValueAs... accessors 2022-02-05 11:24:35 -05:00
Jay Berkenbilt 9044a24097 PointerHolder: deprecate getPointer() and getRefcount()
Use get() and use_count() instead. Add #define
NO_POINTERHOLDER_DEPRECATION to remove deprecation markers for these
only.

This commit also removes all deprecated PointerHolder API calls from
qpdf's code except in PointerHolder's test suite, which must continue
to test the deprecated APIs.
2022-02-04 13:12:37 -05:00
m-holger 95e7d36b7a C-API add two binary UTF8 funtions
add qpdf_oh_new_binary_unicode_string and qpdf_oh_get_binary_utf8_value
2022-02-04 13:10:51 -05:00
m-holger 1925ffd467 Fix --check-linearization of non-linearized files (fixes #615) 2022-02-04 06:52:38 -05:00
Jay Berkenbilt 42bff9f458 QPDFJob: let initializeFromArgv just take argv, not argc
Let argv be a null-terminated array. There is already code that
assumes this, and it makes it easier to construct the arguments.
2022-02-01 13:50:58 -05:00
Jay Berkenbilt b02d37bc0a Make QPDFArgParser accept const argv
This makes it much more convention to use the initializeFromArgv
functions since you can use string literals.
2022-02-01 13:50:58 -05:00
Jay Berkenbilt bc4e2320e7 Add qpdfjob-c.h -- simple C API around parts of QPDFJob 2022-02-01 09:04:55 -05:00
Jay Berkenbilt 03e67a28fe Move QTC::TC for qpdf to QPDFJob
All the coverage cases that used to be in qpdf.cc are now in
QPDFJob*.cc. It doesn't really matter, but better to follow the
convention of starting with the class that includes the coverage call.
2022-02-01 09:04:55 -05:00
Jay Berkenbilt b42f3e1d15 Move more code from qpdf.cc into QPDFJob 2022-02-01 09:04:55 -05:00
Jay Berkenbilt 21b9290785 QPDFJob json: make bare arguments expect the empty string
Changing from bool requiring true to string requiring the empty string
is more consistent with the CLI and makes it possible to add an
optional parameter or choices later without breaking compatibility.
2022-01-31 18:16:09 -05:00
Jay Berkenbilt ea96330bb6 QPDFJob json: flatten json structure
Flatten everything to make it easier to map command-line flags to
json. The old structure was an illusion anyway because there was no
mechanism to enforce that things were in the right place. This also
helps with future flexibility.
2022-01-31 18:16:09 -05:00
Jay Berkenbilt 47f33cec25 QPDFJob: add test cases 2022-01-31 15:57:45 -05:00
Jay Berkenbilt e3506253f1 Add optional version to --json 2022-01-31 15:57:45 -05:00
Jay Berkenbilt caa00556cf Change filename or path to file in json and QPDFJob
Use "file" consistently for specifying a file path. We use "filename"
when adding attachments for a completely different purpose.
2022-01-31 15:57:45 -05:00
Jay Berkenbilt 7097f29019 More editorial changes from m-holger + spell check 2022-01-30 13:11:03 -05:00
Jay Berkenbilt 0e909bab8e Improve top-level help information 2022-01-30 13:11:03 -05:00
Jay Berkenbilt 0364024781 Use QPDFUsage exception for cli, json, and QPDFJob errors 2022-01-30 13:11:03 -05:00
Jay Berkenbilt 95d127641c QPDFJob: move more top-level trivial handlers into config 2022-01-30 13:11:03 -05:00
Jay Berkenbilt 9373881cca Add QPDFJob::ConfigError exception 2022-01-30 13:11:03 -05:00
Jay Berkenbilt b9cd693a5b QPDFJob: allocate QPDFArgParser on stack
The previous commits have removed all references to memory from
QPDFArgParser from QPDFJob. This commit removes the constraint that
QPDFArgParser remain in scope. This is a prerequisite to allowing JSON
as an alternative way to initialize QPDFJob and to initialize it
directly using a public API.
2022-01-30 13:11:03 -05:00
Jay Berkenbilt b9af421ef7 Add missing \f support for JSON string encoder 2022-01-30 13:11:03 -05:00
Jay Berkenbilt 5c5e5ca29b Document how to add a command-line argument 2022-01-30 13:11:03 -05:00
Jay Berkenbilt a301cc5373 Minor code cleanup 2022-01-30 13:11:03 -05:00
Jay Berkenbilt bd89aac360 QPDFJob increment: move arg parsing into QPDFJob
Move ArgParser from qpdf.cc into QPDFJob.cc. It still works with
millions of public member variables, but now qpdf.cc is minimal and
just calls stable library functions.
2022-01-30 13:11:03 -05:00
Jay Berkenbilt 23b64f8357 Remove qpdf.cc version check
Remove comparison of qpdf CLI version with library. With almost all
the functionality moving into the library, this check is no longer
meaningful.
2022-01-30 13:11:03 -05:00
Jay Berkenbilt 1ddf5b4b4b QPDFJob increment: get rid of exit, handle verbose
Remove all calls to exit() from QPDFJob. Handle code that runs in
verbose mode to enable it to make use of output streams and message
prefix (whoami) from QPDFJob. This removes temporarily duplicated exit
code logic and most access to whoami/std::cout outside of QPDFJob
proper.
2022-01-30 13:11:03 -05:00
Jay Berkenbilt 0910e767ad QPDFJob increment: basic QPDFJob structure
Move most of the methods called from qpdf.cc after argument parsing
into QPDFJob. In this increment, enough QPDFJob API has been added to
handle the branch of QPDFJob::run() that creates output with an
appropriate division between qpdf.cc and QPDFJob.

There are temporary bits of code to enable everything to compile and
pass the test suite, including some duplication and hard-coded values.
2022-01-30 13:11:03 -05:00