2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-20 10:52:20 +00:00
Commit Graph

923 Commits

Author SHA1 Message Date
Jay Berkenbilt
37105710ee Implement JSONHandler for recursively processing JSON 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
a6df6fdaf7 CLI doc: use tables where helpful 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
e8e8f6f43c Add JSON::parse 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
aa0a379b37 Add JSON::isDictionary and JSON::isArray 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
c8729398dd Generate help content from manual
This is a massive rewrite of the help text and cli.rst section of the
manual. All command-line flags now have their own help and are
specifically index. qpdf --help is completely redone.
2022-01-30 13:11:03 -05:00
Jay Berkenbilt
b4bd124be4 QPDFArgParser: support adding/printing help information 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
5303130cf9 Fix comment on duplicated top-level json keys 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
53ba65eb59 QPDFArgParser: handle optional choices including help
Handle optional choices in addition to required choices. Refactor the
way help options are added to completion to make it work with optional
help choices.
2022-01-30 13:11:03 -05:00
Jay Berkenbilt
a301cc5373 Minor code cleanup 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
3ab25d595b Fix doc typos caught by m-holger -- thanks 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
4577df4b5d QPDFJob increment: generate option table initialization 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
f1d805badc Add QPDFArgParser::copyFromOtherTable 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
c3e9b64e7f QPDFJob increment: generate handler declarations 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
6e70d99b58 QPDFJob increment: generate choices variables in init 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
cb684ec4d3 QPDFJob increment: generate table names 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
f8eee83515 Expose QPDFArgParser::usage 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
8dcf6da259 QPDFJob: remove non-check from doFinalChecks 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
c216854607 Add basic framework for QPDFJob code generation 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
12396702af QPDFJob: reorder functions, no other changes 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
2394dd8519 QPDFJob increment: static functions to member functions
Convert remaining static functions that take QPDFJob& as a parameter
to member functions. Utility functions that don't take QPDFJob& remain
static functions and can probably just stay that way since the keep
extra complexity out of QPDFJob.hh.
2022-01-30 13:11:03 -05:00
Jay Berkenbilt
e2975b9ed0 QPDFJob: de-templatize do_process and do_process_once 2022-01-30 13:11:03 -05:00
Jay Berkenbilt
2f631997f2 QPDFJob increment: remove std::cout, std::cerr, whoami
Remove remaining temporary duplication of hard-coded values and direct
access to std::cout, std::cerr, and whoami in favor of parameters in
QPDFJob. This moves a few more static methods into QPDFJob member
functions.
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
Jay Berkenbilt
52817f0a45 Implement QPDFArgParser based on ArgParser from qpdf.cc 2022-01-30 13:11:02 -05:00
m-holger
0f9086e509 Fix doc typos 2022-01-30 12:09:54 -06:00
m-holger
8eca9d8fd9 Fix QPDFObjectHandle::isOrHasName
Ensure isOrHasName returns true if object is an array and the name is
present anywhere in the array.
2022-01-27 09:35:39 -06:00
m-holger
07db3200cb Remove some if statements and simplify some boolean expressions
Use QPDFObjectHandle::isNameAndEquals, isDictionaryOfType and
isStreamOfType.
2022-01-27 07:31:12 -06:00
m-holger
710d2e54f0 Allow testing for subtype without specifying type in isDictionaryOfType etc
Accept empty string as type parameter in
QPDFObjectHandle::isDictionaryOfType and isStreamOfType
to allow for dictionaries with optional type.
2022-01-27 07:31:12 -06:00
m-holger
1b1b471ca9 Make a few whitespace fixes from last commit
Commit by ejb@ql.org using m-holger as author so git annotate gives
proper credit for changes.
2022-01-22 09:14:53 -05:00
m-holger
8593b9fdf7 Add new convenience methods QPDFObjectHandle::isNameAndEquals, etc
Add methods isNameAndEquals, isDictionaryOfType, isStreamOfType
2022-01-22 08:10:28 -06:00
Jay Berkenbilt
370710657a Add missing characters from PDF doc encoding (fixes #606) 2022-01-11 15:55:19 -05:00
Jay Berkenbilt
77c31305fe Fix signed/unsigned char warning (fixes #604) 2022-01-11 06:51:31 -05:00
Jay Berkenbilt
af91b5b584 Add QUtil::file_can_be_opened 2021-12-29 13:41:02 -05:00
Jay Berkenbilt
04745320d6 Prepare 10.5.0 release 2021-12-20 14:51:46 -05:00
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
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
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
245ca28066 Use value rather than reference captures where possible 2021-12-16 11:47:07 -05:00
Jay Berkenbilt
af2a71aa2c Handle bitstream overflow errors more gracefully (fixes #581)
* Make it a runtime error, not a logic error
* Include additional information
* Capture it properly in checkLinearization
2021-12-10 15:37:35 -05:00
Jay Berkenbilt
1c62c2a342 C API: expose functions for indirect objects (fixes #588) 2021-12-10 14:57:35 -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