summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-write.c
AgeCommit message (Collapse)Author
2017-11-22Add usage for missing options to pdf-write.Sebastian Rasmussen
2017-11-22Skip unnecessary newline when writing ASCII streams.Tor Andersson
2017-11-08Silence warning.Tor Andersson
2017-11-08Bug 689699: Avoid buffer overrun.Robin Watts
When cleaning a pdf file, various lists (of pdf_xref_len length) are defined early on. If we trigger a repair during the clean, this can cause pdf_xref_len to increase causing an overrun. Fix this by watching for changes in the length, and checking accesses to the list for validity. This also appears to fix bugs 698700-698703.
2017-11-08Bug 698689: Don't create a hint stream for a file with 0 pages.Robin Watts
2017-11-01Add separate fz_close_output step.Tor Andersson
Closing flushes output and may throw exceptions. Dropping frees the state and never throws exceptions.
2017-11-01Use int64_t for public file API offsets.Tor Andersson
Don't mess with conditional compilation with LARGEFILE -- always expose 64-bit file offsets in our public API.
2017-10-12Some more consts.Tor Andersson
2017-10-05Remove unused code.Sebastian Rasmussen
2017-09-08Remove unnecessary fz_try()/fz_catch().Sebastian Rasmussen
2017-09-07Use dict_put_drop/array_push_drop wherever possible.Sebastian Rasmussen
2017-09-07Initialize variables to appease clang scan-build.Sebastian Rasmussen
2017-08-31Always add newline before 'endstream' keyword for PDF/A compliance.Philipp Knechtges
2017-08-31Adjust PDF header for PDF/A compliance.Philipp Knechtges
Remove superfluous '%' character in the comment with binary bytes.
2017-08-31Do not deflate metadata (necessary for PDF/A compliance).Philipp Knechtges
2017-07-06pdf: Drop object upon error while renumbering objects.Sebastian Rasmussen
2017-06-22Add const to pdf_toname.Tor Andersson
2017-05-31Avoid double literals causing casts to float.Sebastian Rasmussen
2017-04-27Include required system headers.Tor Andersson
2017-03-23Introduce fz_new_derived_...Robin Watts
Instead of having fz_new_XXXX(ctx, type, ...) macros that call fz_new_XXXX_of_size etc, use fz_new_derived_... Clearer naming, and doesn't clash with fz_new_document_writer.
2017-03-23Add fz_new_writer function.Robin Watts
Moves document_writers into the same style as fz_new_{image,document,page} etc.
2017-03-22Rename fz_putc/puts/printf to fz_write_*.Tor Andersson
Rename fz_write to fz_write_data. Rename fz_write_buffer_* and fz_buffer_printf to fz_append_*. Be consistent in naming: fz_write_* calls write to fz_output. fz_append_* calls append to fz_buffer. Update documentation.
2017-01-17Fix typos.Sebastian Rasmussen
2016-12-27Strip extraneous blank lines.Tor Andersson
2016-12-16pdf: Don't allow incremental writes on a new document.Tor Andersson
2016-12-12Make more pdf functions private.Tor Andersson
2016-12-12Change pdf_dict_put_val to pdf_dict_put_val_null.Tor Andersson
It's only used to 'fix' duff indirect references when cleaning PDF files. Writing general values into dictionaries should be done by key, not by internal index.
2016-11-23Fix pdf-write bug when ascii encoding.Robin Watts
2016-11-14Make fz_buffer structure private to fitz.Robin Watts
Move the definition of the structure contents into new fitz-imp.h file. Make all code outside of fitz access the buffer through the defined API. Add a convenience API for people that want to get buffers as null terminated C strings.
2016-09-08Make fz_option_eq() available outside of pdf-writer.Sebastian Rasmussen
2016-09-05mutool clean: Fixes seen as part of bug 697092 investigation.Robin Watts
Firstly, we avoid compressing streams if they get bigger. Secondly, we ensure that we always update the Length field. Seen as part of the investigation into bug 697092, though not the actual cause. Thanks to Tor for the latter part of the fix.
2016-09-01pdf: Load/open streams by indirect reference object when possible.Tor Andersson
2016-08-02Parse more fz_document_writer() options.Sebastian Rasmussen
2016-07-08Separate close and drop functionality for devices and writers.Tor Andersson
Closing a device or writer may throw exceptions, but much of the foreign language bindings (JNI and JS) depend on drop to never throw an exception (exceptions in finalizers are bad).
2016-07-06Fix garbage collection and page grafting for indirect reference chains.Tor Andersson
The mark & sweep pass of garbage collection, and resolving indirect objects when grafting objects was following the full chain of indirect references. In the unusual case where a numbered object is itself only an indirect reference to another object, this intermediate numbered object would be missed both when marking for garbage collection, and when copying objects for grafting. Add a function to resolve only one step for these two uses. The following is an example of a file that would break during garbage collection if we follow full indirect reference chains: %PDF-1.3 1 0 obj <</Type/Catalog /Foo[2 0 R 3 0 R]>> endobj 2 0 obj 4 0 R endobj 3 0 obj 5 0 R endobj 4 0 obj <</Length 1>> stream A endstream endobj 5 0 obj <</Length 1>> stream B endstream endobj
2016-07-06pdf: Drop generation number from public interfaces.Tor Andersson
The generation number is only needed for decryption, and is assumed to be zero or irrelevant for all other uses. Store the original object number and generation in the xref slot, so that we can decrypt them even when the objects have been renumbered, without needing to pass the original object number around through the stream loading APIs.
2016-06-17Add device space transform state to draw device.Tor Andersson
Allows us to remove the out parameter 'transform' from fz_begin_page.
2016-06-17Use 'size_t' instead of int as appropriate.Robin Watts
This silences the many warnings we get when building for x64 in windows. This does not address any of the warnings we get in thirdparty libraries - in particular harfbuzz. These look (at a quick glance) harmless though.
2016-06-16Add PNG output for mutool convert.Tor Andersson
2016-06-16Return options struct argument from pdf_parse_write_options.Tor Andersson
Makes it easier to chain function calls.
2016-06-16Fix crash due to double closing output in pdf_save_document.Robin Watts
Broken due to refactoring. Thanks to Michael for spotting this.
2016-06-14Fix typos in various parts of the code.Sebastian Rasmussen
2016-06-13Add pdf_write_document.Robin Watts
Allow us to write a document to an fz_output as opposed to just a filename. We cannot write digital signatures in this method though. Will ponder that in a later commit.
2016-06-13Bug 696822: Refuse to save a pdf file incrementally if it would break.Robin Watts
If a file cannot be saved incrementally, then don't accept that as an option. In practise this means if someone asks to save a file incrementally, and it was repaired, or it uses encryption then throw an error. Add a new function to ask if it's safe to save a file incrementally, and use that in the appropriate places.
2016-05-13murun: Add document writer object.Tor Andersson
2016-05-13Add pdf write support to mutool convert.Tor Andersson
2016-05-13Add long output option parsing.Tor Andersson
Use comma-separated list of flags and key/value pairs, for example: "linearize,resolution=72,colorspace=gray"
2016-04-27Tweak pdf-write option handling.Tor Andersson
The handling of not-decompressing images/fonts was geared towards pdfclean usage; but now that we can create new PDF files, it makes more sense to ask for images and fonts to be compressed, rather than asking for them not to be decompressed with quirky interaction with the 'expand' and 'deflate' flags. If -f or -i are set, we will never decompress images, and we will compress them if they are uncompressed. If -d is set, we will first decompress all streams (module -f or -i). If -z is set, we will then compress all uncompressed streams.
2016-04-27Fix 696649: remove fz_rethrow_message calls.Tor Andersson
2016-04-26Update mutool clean sanitize to clean annotations too.Robin Watts