summaryrefslogtreecommitdiff
path: root/pdf/pdf_write.c
AgeCommit message (Collapse)Author
2012-08-02Forms: add document dirty flagPaul Gardiner
2012-07-18Fix broken pdf_write functionality.Robin Watts
Since I implemented linearisation, any invocation that hasn't used garbage collection has produced broken files, due to every object being marked as freed. This was because I'd forgotten to ever set the use_list markers to be 1. Fixed here.
2012-07-06Bug 693167: Solve pdfclean -ggg deleting too many objectsRobin Watts
While pdf writing, compactxref would fail to take into account that duplicated objects would have been mapped down to a lower number, and the use_list value for the upper one would be set to zero. Thanks to Zeniko for pointing out this fix.
2012-07-05Move to static inline functions from macros.Robin Watts
Instead of using macros for min/max/abs/clamp, we move to using inline functions. These are more typesafe, and should produce equivalent code on compilers that support inline (i.e. pretty much everything we care about these days). People can always do their own macro versions if they prefer.
2012-07-05Improve detection of images for pdfwrite.Robin Watts
In pdfwrite we have a flag to say "don't expand images", but this isn't always honoured because we don't know that a stream is an image (for instance the corrupt fax stream used as a thumbnail in normal_439.pdf). Here we update the code to spot that streams are likely to be images based on the filters in use, or on the presence of both Width and Height tags.
2012-06-25Warning fixes and various clean ups:Sebastian Rasmussen
Remove unused variable, silencing compiler warning. No need to initialize variables twice. Remove initialization of unread variable. Remove unnecessary check for NULL. Close output file upon error in cmapdump.
2012-05-31Add linearization to pdf_write function.Robin Watts
Extend mupdfclean to have a new -l file that writes the file linearized. This should still be considered experimental When writing a pdf file, analyse object use, flatten resource use, reorder the objects, generate a hintstream and output with linearisaton parameters. This is enough for Acrobat to accept the file as being optimised for Fast Web View. We ought to add more tables to the hintstream in some cases, but I doubt anyone actually uses it, the spec is so badly written. Certainly acrobat accepts the file as being optimised for 'Fast Web View'. Update fz_dict_put to allow for us adding a reference to the dictionary that is the sole owner of that reference already (i.e. don't drop then keep something that has a reference count of just 1). Update pdf_load_image_stream to use the stm_buf from the xref if there is one. Update pdf_close_document to discard any stm_bufs it may be holding. Update fz_dict_put to be pdf_dict_put - this was missed in a renaming ages ago and has been inconsistent since.
2012-05-23Bring xref object and stream mutation functions back from the dead.Tor Andersson
Needs more work to use the linked list of free xref slots.
2012-05-10mupdfclean - update to allow renumbering of encrypted objectsRobin Watts
mupdfclean (or more correctly, the pdf_write function) currently has a limitation, in that we cannot renumber objects when encryption is being used. This is because the object/generation number is pickled into the stream, and renumbering the object causes it to become unreadable. The solution used here is to provide extended functions that take both the object/generation number and the original object/generation number. The original object numbers are only used for setting up the encryption. pdf_write now keeps track of the original object/generation number for each object. This fix is important, if we ever want to output linearized pdf as this requires us to be able to renumber objects to a very specific order. We also make a fix in removeduplicateobjects that should only matter in the case where we fail to read an object correctly.
2012-04-28Move guts of pdfclean into new pdf_write function.Robin Watts
Expose pdf_write function through the document interface.