2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-08 21:22:25 +00:00
Commit Graph

1006 Commits

Author SHA1 Message Date
Jay Berkenbilt
d31a7b76e7 Improve message for stream decoding error
Tweak the message so that we inform the user that we are mitigating
data loss.
2017-09-12 16:03:48 -04:00
Jay Berkenbilt
eaacf94005 Update C API with new QPDFWriter methods 2017-09-12 14:30:39 -04:00
Jay Berkenbilt
6d46346eb9 Detect integer overflow/underflow 2017-08-29 12:28:32 -04:00
Jay Berkenbilt
e999bbae43 Fix memory leak with bad jpeg data 2017-08-28 22:16:45 -04:00
Jay Berkenbilt
c6872d2c70 Clean up circular references in QPDF_Stream 2017-08-28 22:16:31 -04:00
Jay Berkenbilt
728dc9e6d8 Fix error caught by clang 2017-08-26 21:51:17 -04:00
Jay Berkenbilt
ad527a64f9 Parse iteratively to avoid stack overflow (fixes #146) 2017-08-25 21:56:45 -04:00
Jay Berkenbilt
e452d9dca6 Spell check 2017-08-22 14:22:20 -04:00
Jay Berkenbilt
fabff0f3ec Limit token length during xref recovery
While scanning the file looking for objects, limit the length of
tokens we allow. This prevents us from getting caught up in reading a
file character by character while digging through large streams.
2017-08-22 14:13:10 -04:00
Jay Berkenbilt
ce435222b2 Push QPDFWriter member variables into a nested class 2017-08-21 22:04:07 -04:00
Jay Berkenbilt
a8c93bd324 Push QPDF member variables into a nested class
Pushing member variables into a nested class enables addition of new
member variables without breaking binary compatibility.
2017-08-21 21:35:11 -04:00
Jay Berkenbilt
8288a4eb3a Update copyright to 2017 2017-08-21 21:18:47 -04:00
Jay Berkenbilt
8ab52fa558 Combine writePCLm with writeStandard
Reduce code duplication
2017-08-21 21:05:48 -04:00
Jay Berkenbilt
9f60a864a0 Combine PCLm header into writeHeader 2017-08-21 21:05:47 -04:00
Jay Berkenbilt
4b908ade70 Update header documentation and ChangeLog entry for PCLm 2017-08-21 21:05:44 -04:00
Sahil Arora
b19210fa7d QPDFWriter: Add setPCLm() and writePCLm() methods
* Add support for PCLm using setPCLm() and writePCLm() methods in
  QPDFWriter.hh and QPDFWriter.cc
* Add a function writePCLmHeader() for PCLm header in QPDFWriter
2017-08-21 18:55:02 -04:00
Jay Berkenbilt
ddc6cf0cf6 Precheck streams by default
There is no need for a --precheck-streams option. We can do the
precheck without imposing any penalty, only re-encoding the stream if
it fails the first time.
2017-08-21 17:44:22 -04:00
Jay Berkenbilt
9744414c66 Enable finer grained control of stream decoding
This commit adds several API methods that enable control over which
types of filters QPDF will attempt to decode. It also adds support for
/RunLengthDecode and /DCTDecode filters for both encoding and
decoding.
2017-08-21 17:44:22 -04:00
Jay Berkenbilt
ae90d2c485 Implement Pl_DCT pipeline
Additional testing is added in later commits to be supported by
additional changes in the library.
2017-08-21 17:44:02 -04:00
Jay Berkenbilt
2d2f619665 Implement Pl_RunLength pipeline 2017-08-19 14:50:55 -04:00
Jay Berkenbilt
cfa2eb97fb Add page rotation (fixes #132) 2017-08-12 22:57:38 -04:00
Jay Berkenbilt
30f109e244 Read xref table without PCRE
Also accept more errors than before.
2017-08-10 21:30:32 -04:00
Jay Berkenbilt
ca5b1d267a Improve stream length recovery
Eliminate PCRE and find endobj not preceded by endstream. Be more lax
about placement of endstream and endobj.
2017-08-10 21:30:32 -04:00
Jay Berkenbilt
03aa9679ac Find starxref without PCRE 2017-08-10 21:30:32 -04:00
Jay Berkenbilt
1765c6ec20 Find header without PCRE 2017-08-10 21:30:32 -04:00
Jay Berkenbilt
296b679d6e Implement findFirst and findLast in InputSource
Preparing to refactor some pattern searching code to use these instead
of their own memchr loops. This should simplify the code that replaces
PCRE.
2017-08-10 21:30:32 -04:00
Jay Berkenbilt
ef8ae5449d Allow QPDFTokenizer::readToken to return bad tokens
Sometimes we want to ignore bad tokens rather than having them throw
an exception. A coverage case is commented out here and added in a
later commit.
2017-08-10 19:01:41 -04:00
Jay Berkenbilt
c5dc6d8067 Remove unused PointerHolder interface
Also fix a bug resulting from incorrect use of PointerHolder because
of this unused parameter.
2017-08-10 19:01:38 -04:00
Jay Berkenbilt
8fe261d8b4 QUtil::strcasecmp 2017-08-05 10:22:33 -04:00
Jay Berkenbilt
2d5b854468 Allow reading command-line args from files (fixes #16) 2017-07-29 22:23:21 -04:00
Jay Berkenbilt
5993c3e83c Detect input file = output file (fixes #29) 2017-07-29 20:58:01 -04:00
Jay Berkenbilt
f37d399d82 Add newline-before-endstream option (fixes #103) 2017-07-29 12:21:38 -04:00
Jay Berkenbilt
b389268f16 Better handle split content streams (fixes #73)
When parsing content streams, allow content to be split arbitrarily
across stream boundaries.
2017-07-29 12:19:04 -04:00
Jay Berkenbilt
4647acbe3c Clarify documentation on copyForeignObject (fixes #69)
Be explicit about the need to keep the source QPDF object around.
2017-07-29 12:19:04 -04:00
Jay Berkenbilt
3a1ff5ded9 Add option to preserve unreferenced objects 2017-07-28 19:19:11 -04:00
Jay Berkenbilt
7f8892525f Add precheck streams capability
When requested, QPDFWriter will do more aggress prechecking of streams
to make sure it can actually succeed in decoding them before
attempting to do so. This will allow preservation of raw data even
when the raw data is corrupted relative to the specified filters.
2017-07-27 23:42:27 -04:00
Jay Berkenbilt
a4fd4b91c6 Convert stream filtering errors to warnings 2017-07-27 18:43:07 -04:00
Jay Berkenbilt
40f00122b8 Convert object parsing errors to warnings
QPDFObjectHandle::parseInternal now issues warnings instead of
throwing exceptions for all error conditions that it finds (except
internal logic errors) and has stronger recovery for things like
invalid tokens and malformed dictionaries. This should improve qpdf's
ability to recover from a wide range of broken files that currently
cause it to fail.
2017-07-27 18:20:31 -04:00
Jay Berkenbilt
dd8dad74f4 Move lexer helper functions to QUtil 2017-07-27 13:59:56 -04:00
Jay Berkenbilt
701b518d5c Detect recursion loops resolving objects (fixes #51)
During parsing of an object, sometimes parts of the object have to be
resolved. An example is stream lengths. If such an object directly or
indirectly points to the object being parsed, it can cause an infinite
loop. Guard against all cases of re-entrant resolution of objects.
2017-07-26 06:24:07 -04:00
Jay Berkenbilt
315092dd98 Avoid xref reconstruction infinite loop (fixes #100)
This is CVE-2017-9209.
2017-07-26 06:24:07 -04:00
Jay Berkenbilt
bd6c845619 Fix typo in comment 2017-07-26 06:24:07 -04:00
Thorsten Schöning
7c08aa4280 Include QPDFExc.hh for use in std::list 2016-01-24 12:07:03 -05:00
Thorsten Schöning
e0201c12cc Include QPDFObjectHandle for use in std::list
QPDFObjectHandle was used as forward declaration, but C++-Builder 10
Seattle can't use it in std::list in such cases because the type is
undefined.
2016-01-24 12:04:25 -05:00
Jay Berkenbilt
e0e9d64674 Remove some ABI compatibility private methods
Since we have to bump soname, remove some private methods that were
just there for binary compatibility
2015-11-10 12:22:40 -05:00
Jay Berkenbilt
0496ab1a6e Fix spelling errors 2015-10-31 18:56:43 -04:00
Jay Berkenbilt
b8bdef0ad1 Implement deterministic ID
For non-encrypted files, determinstic ID generation uses file contents
instead of timestamp and file name. At a small runtime cost, this
enables generation of the same /ID if the same inputs are converted in
the same way multiple times.
2015-10-31 18:56:42 -04:00
Jay Berkenbilt
f77acbdbba Copyright 2015 2015-05-24 17:26:49 -04:00
Jay Berkenbilt
857bb208d3 include time.h in QUtil.hh
QUtil.hh needs time.h to get time_t on some platforms. Thanks Peter
Korsgaard <peter@korsgaard.com>
2015-05-24 16:26:05 -04:00
Jay Berkenbilt
a11549a566 Detect loops in /Pages structure
Pushing inherited objects to pages and getting all pages were both
prone to stack overflow infinite loops if there were loops in the
Pages dictionary. There is a general weakness in the code in that any
part of the code that traverses the Pages structure would be prone to
this and would have to implement its own loop detection. A more robust
fix may provide some general method for handling the Pages structure,
but it's probably not worth doing.

Note: addition of *Internal2 private functions was done rather than
changing signatures of existing methods to avoid breaking
compatibility.
2015-02-21 19:47:11 -05:00
Jay Berkenbilt
225b018290 Update Copyright to 2014 2014-01-14 15:40:02 -05:00
Jay Berkenbilt
235d8f28f8 Increase random data provider support
Add a method to get the current random data provider, and document and
test the method for resetting it.
2013-12-16 16:21:28 -05:00
Jay Berkenbilt
5e3bad2f86 Refactor random data generation
Add new RandomDataProvider object and implement existing random number
generation in terms of that.  This enables end users to supply their
own random data providers.
2013-12-14 15:17:35 -05:00
Jay Berkenbilt
f010e07c0c Add missing #include of <string> 2013-10-28 20:59:58 -04:00
Jay Berkenbilt
4229457068 Security: use a secure random number generator
If not available, give an error.  The user may also configure qpdf to
use an insecure random number generator.
2013-10-18 10:45:12 -04:00
Jay Berkenbilt
cee2592ed1 Change API/ABI and withdraw 4.2.0
4.2.0 was binary incompatible in spite of there being no deletions or
changes to any public methods.  As such, we have to bump the ABI and
are fixing some API breakage while we're at it.

Previous 4.3.0 target is now 5.1.0.
2013-07-10 11:30:13 -04:00
Jay Berkenbilt
a3576a7359 Bug fix: handle generation > 0 when generating object streams
Rework QPDFWriter to always track old object IDs and QPDFObjGen
instead of int, thus not discarding the generation number.  Switch to
QPDF::getCompressibleObjGen() to properly handle the case of an old
object eligible for compression that has a generation of other than
zero.
2013-06-14 14:58:09 -04:00
Jay Berkenbilt
96eb965115 Use QPDFObjectHandle::getObjGen() where appropriate
In internal code and examples, replace calls to getObjectID() and
getGeneration() with calls to getObjGen() where possible.
2013-06-14 14:58:09 -04:00
Jay Berkenbilt
5039da0b91 Add QPDFObjectHandle::getObjGen()
This is safer than getObjectID() and getGeneration() for many uses.
2013-06-14 14:58:09 -04:00
Jay Berkenbilt
d88231e01e Promote QPDF::ObjGen to top-level object QPDFObjGen 2013-06-14 14:58:08 -04:00
Jay Berkenbilt
3803e9cc4a Export terminateParsing in the DLL
Windows fix: QPDFObject::ParserCallbacks::terminateParsing() was not
declared with QPDF_DLL.
2013-03-11 12:37:32 -04:00
Jay Berkenbilt
9d4f52c014 Clarify documentation on encrypted files
Explicitly state how QPDF handles empty passwords when writing files.
Apparently some libraries treat the empty string as the owner password
as an instruction to generate a random password.
2013-03-11 12:37:32 -04:00
Jay Berkenbilt
29f5830325 Fix getTypeCode and getTypeName work for indirect objects
Remove const qualifier from getTypeCode and get getTypeName methods of
QPDFObjectHandle, make them work properly for indirect objects, and
exercise them much better in the test suite.
2013-03-05 13:35:46 -05:00
Jay Berkenbilt
119f2a4b68 Add method to terminate content stream parsing 2013-03-05 13:35:46 -05:00
Jay Berkenbilt
ac4deac187 Call QUtil::safe_fopen in place of fopen
fopen was previuosly called wrapped by QUtil::fopen_wrapper, but
QUtil::safe_fopen does this itself, which is less cumbersome.
2013-03-05 13:35:46 -05:00
Jay Berkenbilt
a51ae10b8d Remove all calls to sprintf 2013-03-05 13:35:46 -05:00
Jay Berkenbilt
30027481f7 Remove all old-style casts from C++ code 2013-03-04 16:45:16 -05:00
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
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
1d88955fa6 Added new QPDFObjectHandle types Keyword and InlineImage
These object types are to facilitate content stream parsing.
2013-01-20 15:35:39 -05:00
Jay Berkenbilt
a04a835849 Clarify methods to get user password
With newer encryption formats, it is no longer possible to recover the
user password using the owner password.
2013-01-03 20:45:53 -05:00
Jay Berkenbilt
f8306913ba Update "C" API with functions for new features 2012-12-31 10:32:32 -05:00
Jay Berkenbilt
9eb5982fa3 Avoid modifying trailer when writing
When preparing the trailer for writing to the new file, trim a copy of
the trailer instead of the original file's trailer.
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
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
4eccb9d87b Add random number functions to QUtil 2012-12-31 10:32:32 -05:00
Jay Berkenbilt
8f5de08c2a Comment about non-const Pipeline data 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
3101955ac0 Add V5 parameters to EncryptionData 2012-12-31 05:36:50 -05:00
Jay Berkenbilt
68447bb556 change EncryptionData 2012-12-31 05:36:50 -05:00
Jay Berkenbilt
04c203ae06 Eliminate flattenScalarReferences 2012-12-31 05:36:48 -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
137dc7acb9 Refactor: move resolution of literal to its own method 2012-08-11 09:22:59 -04:00
Jay Berkenbilt
32051283b9 Fix spelling errors 2012-07-29 14:44:12 -04:00
Jay Berkenbilt
f83bddf882 Update copyright to 2012 2012-07-28 22:03:36 -04:00
Tobias Hoffmann
9c00874e77 added QPDFObjectHandle::replaceStreamData(std::string data). 2012-07-25 03:02:46 +02:00
Jay Berkenbilt
316328704b Windows compilation fixes 2012-07-21 20:51:56 -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
f3e267fce2 Move readToken from QPDF to QPDFTokenizer 2012-07-21 09:06:10 -04:00
Jay Berkenbilt
15eaed5c52 Refactor: pull *InputSource out of QPDF
InputSource, FileInputSource, and BufferInputSource are now top-level
classes instead of privately nested inside QPDF.
2012-07-21 09:06:06 -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
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
11b194a1d0 Update getPageImages() comment to mention pushInheritedAttributesToPage() 2012-07-11 15:56:50 -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
Tobias Hoffmann
8720446b23 Added assertNumber and assertScalar to QPDFObjectHandle 2012-07-07 18:55:08 -04:00
Tobias Hoffmann
a8266ccb0e Added public assert{Type} methods to QPDFObjectHandle 2012-07-07 18:53:38 -04:00
Tobias Hoffmann
39bbaa86e3 Build this->all_pages while traversing with pushInheritedAttributesToPage 2012-07-07 17:45:10 -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
Jay Berkenbilt
8705e2e8fc Add QPDFWriter method to output to FILE* 2012-07-05 21:24:04 -04:00
Tobias Hoffmann
abb53ac369 Limited inheritance to the attributes explicitly listed in the PDF spec
Previous versions of qpdf incorrectly passed arbitrary objects from
/Pages objects down to individual pages in direct contradition with
the PDF specification.  These are now left in /Pages.  When
intermediate /Pages nodes are being discarded as when the /Pages tree
is being flattened, a warning is issued when unknown keys are
encountered.
2012-07-04 23:04:55 -04:00
Tobias Hoffmann
7770a1b036 Added public method QPDF::pushInheritedAttributesToPage
Refactored optimizePagesTree to pushInheritedAttributesToPage and made
public
2012-07-04 16:24:03 -04:00
Tobias Hoffmann
235188df85 Fixed wording error in comment 2012-07-04 14:51:53 -04:00
Jay Berkenbilt
5f59c32f87 Add a few minor enhancements to recent work
Test coverage case for new newStream method
Expose decimal_places argument for double-based newReal

All enhancements suggested by Tobias.
2012-06-27 10:43:27 -04:00
Tobias Hoffmann
f07e3370f0 Add Pl_Concatenate filter 2012-06-27 10:20:38 -04:00
Tobias Hoffmann
43c404b45a Add QPDFObjectHandle::newStream(QPDF *, std::string const&)
This makes the code simpler than having to create a buffer of a fixed
size and copy the string to it.
2012-06-27 10:19:57 -04:00
Tobias Hoffmann
75054c0b94 Add QPDFObjectHandle::newReal(double) 2012-06-27 10:19:01 -04:00
Jay Berkenbilt
2266c6232b Rework InputSource::readLine to make it much more efficient
This rework makes xref reconstruction run much faster and use much
less memory.
2012-06-27 06:48:06 -04:00
Jay Berkenbilt
736bafbb9c Rename seek functions in QUtil 2012-06-26 23:10:10 -04:00
Jay Berkenbilt
8318d81ada Fix and test support for files >= 4 GB 2012-06-24 15:56:50 -04:00
Jay Berkenbilt
781c313058 Change QPDF_Integer from int to long long
This makes it possible to store offsets that are larger than 2 GB in
the trailer dictionary.
2012-06-24 15:20:01 -04:00
Jay Berkenbilt
4f305488d8 Improve the FILE* version of QPDF::processFile 2012-06-23 18:23:06 -04:00
Jay Berkenbilt
ffb96ee17e Add pdf-from-scratch example 2012-06-23 09:05:06 -04:00
Jay Berkenbilt
b6bdc0f595 Add factory methods for creating empty arrays and dictionaries.
Also updated pdf_from_scratch test driver to use the new factories,
and made some cosmetic improvements and documentation updates for the
emptyPDF() method.
2012-06-22 09:46:33 -04:00
Jay Berkenbilt
a0768e4190 Add QPDF::emptyPDF() and pdf_from_scratch test code 2012-06-21 23:09:05 -04:00
Jay Berkenbilt
81e8752362 Use qpdf_offset_t in place of off_t in public APIs.
off_t is used internally only when needed to talk to standard
libraries.  This requires that the "long long" type be supported by
the compiler.
2012-06-21 21:23:24 -04:00
Jay Berkenbilt
d1ebe30ff6 Add QPDFObjectHandle::shallowCopy() 2012-06-21 16:15:09 -04:00
Jay Berkenbilt
eb802cfa8c Implement page manipulation APIs 2012-06-21 15:01:02 -04:00
Jay Berkenbilt
df493c352f Refactor optimizePagesTree
Split optimizePagesTree into a simpler top-level routine and a
recursive internal routine.
2012-06-21 15:01:02 -04:00
Tobias Hoffmann
5d3f93be29 Added first version of pages API. 2012-06-21 15:01:02 -04:00
Tobias Hoffmann
405a549f8c Make QPDFObjectHandle::assertPageObject() public.
The method is helpful in other places, like the upcoming QPDF::addPage, too.
2012-06-21 15:01:02 -04:00
Tobias Hoffmann
47a846a7e0 Added method to clear pages cache. 2012-06-21 15:01:02 -04:00
Jay Berkenbilt
f59ff6fcc2 fix include order for off_t 2012-06-21 14:11:22 -04:00
Jay Berkenbilt
bc1c4bb578 Add QPDF::processFile that takes an open FILE* 2012-06-21 08:00:35 -04:00
Tobias Hoffmann
db7474e0fa Added additional array mutators
Added methods to append to arrays, insert items into arrays, and
replace array contents with a vector of items.
2012-06-20 15:29:44 -04:00
Jay Berkenbilt
5d4cad9c02 ABI change: fix use of off_t, size_t, and integer types
Significantly improve the code's use of off_t for file offsets, size_t
for memory sizes, and integer types in cases where there has to be
compatibility with external interfaces.  Rework sections of the code
that would have prevented qpdf from working on files larger than 2 (or
maybe 4) GB in size.
2012-06-20 15:20:26 -04:00
Jay Berkenbilt
b856379370 Portability issues: off_t, unlink
New header qpdf/Types.h attempts to make sure size_t and off_t are
defined on any platform and in a way that would work with large file
support.  Additionally, missing header files are included to get
unlink.
2012-06-20 15:18:14 -04:00
Jay Berkenbilt
2757b9b05f export new methods 2011-08-11 15:55:06 -04:00
Jay Berkenbilt
76b1659177 enhance PointerHolder so that it can explicitly be told to use delete [] instead of delete, thus making it useful to run valgrind over qpdf during its test suite 2011-08-11 11:57:37 -04:00
Jay Berkenbilt
14fe2e6de3 qpdf_set_info_key, qpdf_get_info_key 2011-08-11 10:48:37 -04:00
Jay Berkenbilt
759c56e1fe implement ability to save PDF to memory, also update ChangeLog 2011-08-10 16:34:29 -04:00
Jay Berkenbilt
655c55f848 implement methods to get dictionary and array contents as map and vector 2011-08-10 13:33:58 -04:00
Jay Berkenbilt
7dc197ef88 implement replace and swap 2011-08-10 12:42:48 -04:00
Jay Berkenbilt
c551b972f6 update version to 2.2.3, update copyright to 2011
git-svn-id: svn+q:///qpdf/trunk@1051 71b93d88-0707-0410-a8cf-f5a4172ac649
2011-04-30 19:19:30 +00:00
Jay Berkenbilt
b36f62a326 add qpdf_read_memory to C API
git-svn-id: svn+q:///qpdf/trunk@1044 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-10-04 15:24:10 +00:00
Jay Berkenbilt
a72ce95c92 setOutputStreams
git-svn-id: svn+q:///qpdf/trunk@1035 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-10-01 11:02:35 +00:00
Jay Berkenbilt
9f444ffef3 add QPDF::processMemoryFile and API additions to support it
git-svn-id: svn+q:///qpdf/trunk@1034 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-10-01 10:20:38 +00:00
Jay Berkenbilt
ce8b1ba6a5 convert file to a PointerHolder<InputSource> so it could be either a file or a buffer; also fix a bug in BufferInputSource::seek
git-svn-id: svn+q:///qpdf/trunk@1030 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-09-24 19:10:08 +00:00
Jay Berkenbilt
aa035961b3 add * and -> operators
git-svn-id: svn+q:///qpdf/trunk@1029 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-09-24 19:09:22 +00:00
Jay Berkenbilt
bd7261da9b getRawStreamData()
git-svn-id: svn+q:///qpdf/trunk@1010 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-09 23:33:40 +00:00
Jay Berkenbilt
2dbc1006fb addPageContents
git-svn-id: svn+q:///qpdf/trunk@995 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-05 21:06:49 +00:00
Jay Berkenbilt
6f2bd7eb3a newStream
git-svn-id: svn+q:///qpdf/trunk@991 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-05 20:20:52 +00:00
Jay Berkenbilt
11df7809af add pipeline-based stream data replacement function
git-svn-id: svn+q:///qpdf/trunk@990 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-05 19:04:22 +00:00
Jay Berkenbilt
998a6cbee9 remove stream_data_handler; it wouldn't work as designed. replacement data implemented but not tested
git-svn-id: svn+q:///qpdf/trunk@988 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-02 22:40:52 +00:00
Jay Berkenbilt
9a06fc541c ready to implement replacement stream data
git-svn-id: svn+q:///qpdf/trunk@987 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-02 22:17:01 +00:00
Jay Berkenbilt
00ed5af502 remove use of float for version comparison
git-svn-id: svn+q:///qpdf/trunk@984 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-08-02 16:18:46 +00:00
Jay Berkenbilt
9496b2cb20 fix memory leak
git-svn-id: svn+q:///qpdf/trunk@976 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-06-06 13:32:08 +00:00
Jay Berkenbilt
84353451a3 refactor to isolate pad calculation
git-svn-id: svn+q:///qpdf/trunk@956 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-04-18 23:01:31 +00:00
Jay Berkenbilt
bcd621e208 update copyrights for 2010
git-svn-id: svn+q:///qpdf/trunk@935 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-01-25 01:23:20 +00:00
Jay Berkenbilt
26a3c3a1c4 update for fixes to linearization padding calculations
git-svn-id: svn+q:///qpdf/trunk@933 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-01-25 01:16:28 +00:00
Jay Berkenbilt
a80d9d176d add C interface for getting software version
git-svn-id: svn+q:///qpdf/trunk@903 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-24 13:23:20 +00:00
Jay Berkenbilt
ace2a031b5 prepare 2.1.rc1 for release
git-svn-id: svn+q:///qpdf/trunk@901 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-24 04:47:17 +00:00
Jay Berkenbilt
b1702fb16c more tweaking of C error interface
git-svn-id: svn+q:///qpdf/trunk@894 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-23 16:50:22 +00:00
Jay Berkenbilt
7f5d78c2d1 improve C error handling interface
git-svn-id: svn+q:///qpdf/trunk@884 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-23 15:27:30 +00:00
Jay Berkenbilt
75ea1971fa include copyright notice in public headers
git-svn-id: svn+q:///qpdf/trunk@883 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-23 14:59:50 +00:00
Jay Berkenbilt
3c84d496f0 avoid having to include zlib.h in Pl_Flate.hh
git-svn-id: svn+q:///qpdf/trunk@882 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-23 14:58:09 +00:00
Jay Berkenbilt
f5d772773e make line buffering os-specific
git-svn-id: svn+q:///qpdf/trunk@852 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-21 02:30:15 +00:00
Jay Berkenbilt
27ee889c0e tweak dll stuff again
git-svn-id: svn+q:///qpdf/trunk@851 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-21 01:45:13 +00:00
Jay Berkenbilt
95753c6b53 typo
git-svn-id: svn+q:///qpdf/trunk@850 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-21 00:29:07 +00:00
Jay Berkenbilt
748ab301d4 go back to function-based DLL_EXPORT rather than class-based to avoid creation of export files with executables under msvc
git-svn-id: svn+q:///qpdf/trunk@849 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-21 00:27:24 +00:00
Jay Berkenbilt
bf6e4ecf00 remove off_t from C API
git-svn-id: svn+q:///qpdf/trunk@846 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-20 02:40:08 +00:00
Jay Berkenbilt
436ebf6017 oops -- put stdexcept back
git-svn-id: svn+q:///qpdf/trunk@845 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-20 02:35:28 +00:00
Jay Berkenbilt
f5c17421a5 revert off_t
git-svn-id: svn+q:///qpdf/trunk@844 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-20 02:16:19 +00:00
Jay Berkenbilt
ef156afd1e QUtil
git-svn-id: svn+q:///qpdf/trunk@843 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-20 02:11:04 +00:00
Jay Berkenbilt
dfb8a30565 try memory
git-svn-id: svn+q:///qpdf/trunk@842 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-20 02:09:37 +00:00
Jay Berkenbilt
80f19cd573 try stdlib.h
git-svn-id: svn+q:///qpdf/trunk@841 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-20 02:08:38 +00:00
Jay Berkenbilt
f0557a96fd try io.h
git-svn-id: svn+q:///qpdf/trunk@840 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-20 02:06:31 +00:00
Jay Berkenbilt
398354b6f0 update C API for error retrieval
git-svn-id: svn+q:///qpdf/trunk@830 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-20 00:24:44 +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
b67a3c15e7 DLL.hh -> DLL.h, move public enumerated types into Constants.h and use them both for C and C++ interfaces
git-svn-id: svn+q:///qpdf/trunk@828 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-19 20:17:14 +00:00
Jay Berkenbilt
734ac1e1d2 deal with stream-specific crypt filters
git-svn-id: svn+q:///qpdf/trunk@827 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-19 01:58:31 +00:00
Jay Berkenbilt
a8715c495b add C API for R4 encryption
git-svn-id: svn+q:///qpdf/trunk@825 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-19 00:36:51 +00:00
Jay Berkenbilt
09175e4578 more testing, bug fix for linearized aes encrypted files
git-svn-id: svn+q:///qpdf/trunk@824 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-19 00:17:11 +00:00
Jay Berkenbilt
b873dc9c59 implemented writing R4/V4 encryption except that the output files don't open in Adobe reader 9.1.3.
git-svn-id: svn+q:///qpdf/trunk@816 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-18 02:03:18 +00:00
Jay Berkenbilt
e25910b59a reading crypt filters is largely implemented but not fully tested
git-svn-id: svn+q:///qpdf/trunk@812 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-17 23:37:55 +00:00
Jay Berkenbilt
c13bc66de8 checkpoint -- partially implemented /V=4 encryption
git-svn-id: svn+q:///qpdf/trunk@811 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-17 18:54:51 +00:00
Jay Berkenbilt
846c9f6bcc checkpoint -- started doing some R4 encryption support
git-svn-id: svn+q:///qpdf/trunk@807 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-17 03:14:47 +00:00
Jay Berkenbilt
f71eb2af91 fix class-level DLL_EXPORT
git-svn-id: svn+q:///qpdf/trunk@797 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-12 01:18:19 +00:00
Jay Berkenbilt
44cbd3d4b4 do DLL_EXPORT only in header files and only at the class or top-level function level
git-svn-id: svn+q:///qpdf/trunk@796 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-12 01:15:55 +00:00
Jay Berkenbilt
c2023db265 Implement changes suggested by Zarko and our subsequent conversations:
- Add a way to set the minimum PDF version
 - Add a way to force the PDF version
 - Have isEncrypted return true if an /Encrypt dictionary exists even
   when we can't read the file
 - Allow qpdf_init_write to be called multiple times
 - Update some comments in headers


git-svn-id: svn+q:///qpdf/trunk@748 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-05 00:42:48 +00:00
Jay Berkenbilt
ad03b51b3d typo in comment
git-svn-id: svn+q:///qpdf/trunk@745 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-04 23:55:02 +00:00
Jay Berkenbilt
8d7bb3ff50 add methods for getting encryption data
git-svn-id: svn+q:///qpdf/trunk@733 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 20:05:38 +00:00
Jay Berkenbilt
fe6771e0e5 add many new tests to exercise C api
git-svn-id: svn+q:///qpdf/trunk@727 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 16:01:45 +00:00
Jay Berkenbilt
84ec83e925 basic implementation of C API
git-svn-id: svn+q:///qpdf/trunk@725 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 14:39:04 +00:00
Jay Berkenbilt
02333ba1e9 checkpoint -- first crack at C API, minor refactoring of encryption functions
git-svn-id: svn+q:///qpdf/trunk@720 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 03:11:29 +00:00
Jay Berkenbilt
30426ea923 don't dll export inline functions
git-svn-id: svn+q:///qpdf/trunk@714 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 02:00:48 +00:00
Jay Berkenbilt
82ea3dd3a7 don't dll export inline functions
git-svn-id: svn+q:///qpdf/trunk@712 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 01:56:41 +00:00
Jay Berkenbilt
f3d7c26de1 removed qexc; non-compatible ABI change
git-svn-id: svn+q:///qpdf/trunk@709 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-26 18:36:04 +00:00
Jay Berkenbilt
492db82f6f more dll exports
git-svn-id: svn+q:///qpdf/trunk@697 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-26 15:15:33 +00:00
Jay Berkenbilt
e2d7dd3c76 add DLL.hh created 2009-08-06 12:32
git-svn-id: svn+q:///qpdf/trunk@691 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-26 13:51:45 +00:00
Jay Berkenbilt
1e74c03acd stick DLL_EXPORT in front of every public method of every public class
git-svn-id: svn+q:///qpdf/trunk@688 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-08-06 19:00:25 +00:00
Jay Berkenbilt
fe18385ffa clean up windows portability code, make remaining test suite pass
git-svn-id: svn+q:///qpdf/trunk@686 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-07-15 04:26:32 +00:00
Jay Berkenbilt
a1c0aaf03a windows fixes
git-svn-id: svn+q:///qpdf/trunk@684 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-07-15 03:47:44 +00:00
Jay Berkenbilt
a9987ab570 Fix a few compiler errors reported correctly my MSVC 9.0.
Fix libtests test suites to pass on Windows, mostly by dealing with
ascii vs. binary and NL vs. CRNL change ($td->NORMALIZE_NEWLINES).
Convert some test suites to use fread instead of read.
PCRE.hh: define PCRE_STATIC if on Windows.
Provide cross-platform function for getting current time instead of
using time(0).


git-svn-id: svn+q:///qpdf/trunk@678 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-07-12 22:52:13 +00:00
Jay Berkenbilt
f62bec3ee5 update test suite to handle original object ID comments
git-svn-id: svn+q:///qpdf/trunk@663 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-03-09 16:27:13 +00:00
Jay Berkenbilt
599daddb47 decode streams on check, always exit abnormally when warnings are detected
git-svn-id: svn+q:///qpdf/trunk@660 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-03-08 19:00:19 +00:00
Jay Berkenbilt
91cb7c0a58 fix many typos in comments and strings
git-svn-id: svn+q:///qpdf/trunk@651 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-02-21 02:54:31 +00:00
Jay Berkenbilt
4499e04b57 better recovery for appended files with damaged cross-reference tables
git-svn-id: svn+q:///qpdf/trunk@649 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-02-21 02:31:32 +00:00
Jay Berkenbilt
9f93c89ee5 update copyright, release 2.0.3
git-svn-id: svn+q:///qpdf/trunk@644 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-02-15 16:31:12 +00:00
Jay Berkenbilt
62bff4861f fix potential 64-bit issues
git-svn-id: svn+q:///qpdf/trunk@613 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-05-05 02:22:40 +00:00
Jay Berkenbilt
9a0b88bf77 update release date to actual date
git-svn-id: svn+q:///qpdf/trunk@599 71b93d88-0707-0410-a8cf-f5a4172ac649
2008-04-29 12:55:25 +00:00