2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-26 23:23:34 +00:00
Commit Graph

174 Commits

Author SHA1 Message Date
Jay Berkenbilt
32b62035ce Replace many calls to sprintf with QUtil::hex_encode
Add QUtil::hex_encode to encode binary data has a hexadecimal string,
and use it in place of sprintf where possible.
2013-03-04 16:45:15 -05:00
Jay Berkenbilt
9f1594656c Work around gcc 4.8.0 issue on ppc64
Change iteration to use size_t instead of int.  The code should be
equivalent in all reasonable cases, but the original way this was
coded was causing a test failure with gcc 4.8.0 on ppc64.  See
https://bugzilla.redhat.com/show_bug.cgi?id=915321 for additional
information.
2013-03-04 16:43:29 -05:00
Jay Berkenbilt
6c7bf114dc Bug fix: properly handle overridden compressed objects
When caching objects in an object stream, only cache objects that
still resolve to that stream.  See Changelog mod from this commit for
details.
2013-02-23 17:51:17 -05:00
Jay Berkenbilt
a5d8783f67 Improve qpdf --check
Fix exit status for case of errors without warnings, continue after
errors when possible, add test case for parsing a file with content
stream errors on some but not all pages.
2013-01-25 11:08:50 -05:00
Jay Berkenbilt
a7e8b8c789 Have qpdf --check parse content streams
Also move writing to null and parsing of content streams out of the
wrong if block.
2013-01-24 11:47:36 -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
9261f3b922 Detect binary attachments better
This fix eliminates a false test failure on some platforms and makes
the binary test work properly whether characters with the high bit
set, when treated as integers, are negative or not.
2013-01-03 16:44:04 -05:00
Jay Berkenbilt
f8306913ba Update "C" API with functions for new features 2012-12-31 10:32:32 -05:00
Jay Berkenbilt
8843e499b8 Update copyright year to 2013
Also add copyright notice to a few public headers that were missing
one.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
9a23c3dcb6 Remove /Crypt from stream filters unconditionally
When writing a new stream, always remove /Crypt even if we are not
otherwise able to filter the stream.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
4237a29c94 Refactor Dictionary writing code
Original code was written before we could shallow copy objects, so all
the filtering was done by suppressing the output of certain keys and
replacing them with other keys.  Now we can simplify the code greatly
by modifying shallow copies of dictionaries in place.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
e57c25814e Support for encryption with /V=5 and /R=5 and /R=6
Read and write support is implemented for /V=5 with /R=5 as well as
/R=6.  /R=5 is the deprecated encryption method used by Acrobat IX.
/R=6 is the encryption method used by PDF 2.0 from ISO 32000-2.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
93ac1695a4 Support files with only attachments encrypted
Test cases added in a future commit since they depend on /R=6 support.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
eff2c9a679 Cosmetic change to test_driver source
Change variable name for better clarity.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
4fe6f61def Add missing test case from long ago
I noticed a test output file that was not accessed in the test suite
and added a test case for it.
2012-12-31 10:32:32 -05:00
Jay Berkenbilt
16a23368e7 Fix infinite loop trimming passwords with ( in them 2012-12-31 10:32:31 -05:00
Jay Berkenbilt
774584163f Add ExtensionLevel support to version handling
All version operations are now fully aware of extension levels.
2012-12-31 05:36:50 -05:00
Jay Berkenbilt
04c203ae06 Eliminate flattenScalarReferences 2012-12-31 05:36:48 -05:00
Jay Berkenbilt
b4b8b28ed2 Reference object with zero offset
This file used to exercise a zero offset test case when qpdf would
visit every object in the file.  After the next commit, qpdf no longer
touches unreferenced objects, so a reference had to be added to
continue to have this file exercise the zero offset case.
2012-12-27 11:36:48 -05:00
Jay Berkenbilt
35873031a7 Uncompress stream data for some linearization tests
For linearization tests where we are actually comparing the exact
output of the test with a known file, uncompress stream data so we can
see what's there.  This makes looking at future changes a little
easier.
2012-12-27 11:26:06 -05:00
Jay Berkenbilt
7f84239cad Find PDF header anywhere in the first 1024 bytes 2012-12-25 14:43:37 -05:00
Jay Berkenbilt
f256670eba Ignore objects with offset 0 2012-11-20 13:57:37 -05:00
Jay Berkenbilt
041397fdab Allow reading from InputSource and writing to Pipeline
Allowing users to subclass InputSource and Pipeline to read and write
from/to arbitrary sources provides the maximum flexibility for users
who want to read and write from other than files or memory.
2012-09-23 17:42:26 -04:00
Jay Berkenbilt
c1627d0438 Add QPDFWriter::setExtraHeaderText 2012-09-06 15:31:12 -04:00
Jay Berkenbilt
8d2b29ef98 Fix segmentation fault with use of QPDFWriter::setOutputMemory 2012-09-06 14:39:06 -04:00
Jay Berkenbilt
3c4110184c Add specially crafted test cases for EOF error
This replaces a PDF from the wild that I didn't want to include in the
test suite but used to verify the original fix.
2012-08-11 12:36:57 -04:00
Jay Berkenbilt
29e9c34fe3 Bug fix: let EOF resolve literal token
Previously only whitespace and comments did it.  This fix is needed
for object streams whose last object is a literal (name, integer,
real, string) not terminated by space or newline.
2012-08-11 09:29:04 -04:00
Jay Berkenbilt
32051283b9 Fix spelling errors 2012-07-29 14:44:12 -04:00
Jay Berkenbilt
bde98044f4 Improve password handling
Use --encryption-file-password, if given, in addition to --password as
a source for passwords for files specified in --pages.
2012-07-29 13:22:37 -04:00
Jay Berkenbilt
f83bddf882 Update copyright to 2012 2012-07-28 22:03:36 -04:00
Jay Berkenbilt
2280c4f6d1 Update documentation and version numbers
3.0.rc1
2012-07-28 22:03:36 -04:00
Jay Berkenbilt
5878d17f0d Add QPDF_ to some variables used by the test suite
LARGE_FILE_TEST_PATH -> QPDF_LARGE_FILE_TEST_PATH
SKIP_TEST_COMPARE_IMAGES -> QPDF_SKIP_TEST_COMPARE_IMAGES
2012-07-28 19:07:37 -04:00
Jay Berkenbilt
d2e8bae6a4 Mention page selection in basic options 2012-07-28 15:02:20 -04:00
Jay Berkenbilt
f689324214 Restore coverage case
Previous commit lost coverage case for buffer-based replaceStreamData.
2012-07-25 22:32:14 -04:00
Jay Berkenbilt
316328704b Windows compilation fixes 2012-07-21 20:51:56 -04:00
Jay Berkenbilt
5a02471bb1 Command-line page merging and splitting
Implement --pages ... -- option for qpdf.  Update TODO with remaining
things to document.
2012-07-21 20:33:33 -04:00
Jay Berkenbilt
6bbea4baa0 Implement QPDFObjectHandle::parse
Move object parsing code from QPDF to QPDFObjectHandle and
parameterize the parts of it that are specific to a QPDF object.
Provide a version that can't handle indirect objects and that can be
called on an arbitrary string.

A side effect of this change is that the offset used when reporting
invalid stream length has changed, but since the new value seems like
a better value than the old one, the test suite has been updated
rather than making the code backward compatible.  This only effects
the offset reported for invalid streams that lack /Length or have an
invalid /Length key.

Updated some test code and exmaples to use QPDFObjectHandle::parse.

Supporting changes include adding a BufferInputSource constructor that
takes a string.
2012-07-21 09:06:10 -04:00
Jay Berkenbilt
a101533e0a Add command line option to copy encryption from other file
Add --copy-encryption and --encryption-file-password options to qpdf.
Also strengthen test suite for copying encryption.  The strengthened
test suite would have caught the failure to preserve AES and the
failure to update the file version, which was invalidating the
encrypted data.
2012-07-15 21:15:24 -04:00
Jay Berkenbilt
db95960ac1 Bug fix: preserve AES when copying encryption parameters 2012-07-15 19:07:59 -04:00
Jay Berkenbilt
b501251291 qpdf: push inherited attributes to page when showing images
from qpdf command-line tool
2012-07-15 16:22:28 -04:00
Jay Berkenbilt
0575d77d77 Add public QPDFWriter::copyEncryptionParameters
Method to copy encryption parameters from another file.  Adapted from
existing code to copy encryption parameters from the original file.
2012-07-14 09:14:41 -04:00
Jay Berkenbilt
ee3682f106 test_driver: accept optional second file name
This way we don't have to hard-code the name of a second file in the
test driver for tests that require one.
2012-07-14 08:48:30 -04:00
Jay Berkenbilt
1c944e4c89 Have QPDFWriter detect foreign objects while writing
Throw an exception that directs the user to QPDF::copyForeignObject.
2012-07-14 08:07:23 -04:00
Jay Berkenbilt
e7b8f297ba Support copying objects from another QPDF object
This includes QPDF::copyForeignObject and supporting foreign objects
as arguments to addPage*.
2012-07-11 15:54:33 -04:00
Jay Berkenbilt
8a217eb3a2 Add concept of reserved objects
QPDFObjectHandle::{new,is,assert}Reserved, QPDF::replaceReserved
provide a mechanism to add objects to a PDF file when there are
circular references.  This is a prerequisite to copying objects from
one PDF to another.
2012-07-10 23:34:32 -04:00
Jay Berkenbilt
43d4f79352 Fix typo in variable name 2012-07-10 23:17:26 -04:00
Jay Berkenbilt
b9aded1a00 Favor string-based newStream method 2012-07-10 23:17:26 -04:00
Jay Berkenbilt
e2dedde4bd Don't require stream data provider to know length in advance
Breaking API change: length parameter has disappeared from the
StreamDataProvider version of QPDFObjectHandle::replaceStreamData
since it is no longer necessary to compute it in advance.  This
breaking change is justified by the fact that removing the length
parameter provides the caller an opportunity to simplify the calling
code.
2012-07-07 17:33:45 -04:00