summaryrefslogtreecommitdiff
path: root/source/pdf
AgeCommit message (Collapse)Author
2016-01-21Drop const from fz_colorspace.Tor Andersson
It's an opaque immutable structure, that we don't expect to ever want to change after creation. Therefore the const keyword is not useful, and is only line noise.
2016-01-21Drop the const on fz_font.Tor Andersson
The font is an immutable opaque structure, no need to add the const keyword since users aren't expected or expecting to change it.
2016-01-20Various formatting cleanups.Tor Andersson
2016-01-15pdf: Consume entire token before lexing numbers.Tor Andersson
"0.00-70" should be parsed as one token, not two tokens as we did.
2016-01-13Add lots of consts.Robin Watts
In general, we should use 'const fz_blah' in device calls whenever the callee should not alter the fz_blah. Push this through. This shows up various places where we fz_keep and fz_drop these const things. I've updated the fz_keep and fz_drops with appropriate casts to remove the consts. We may need to do the union dance to avoid the consts for some compilers, but will only do that if required. I think this is nicer overall, even allowing for the const<->no const problems.
2016-01-08pdf: Add function to look up the page for a named destination.Tor Andersson
2016-01-08pdf: Fix pdf_annot memory leak.Tor Andersson
2016-01-08Tweak lex_number to avoid (or minimise) underflowRobin Watts
Keeps operations in the int domain as long as possible, and only resorts to floats if required.
2016-01-06Squash some warningsRobin Watts
2016-01-06js: Fix error handling bugs and one scoping bug.Tor Andersson
js_pcall was leaving crap on the stack in case of errors. AFSimple_Calculate needs access to the doc object, but cannot use the usual 'this' binding since it's a function. Add a global reference to the doc object MuPDF_Doc.
2016-01-05Separate pdf_drop_annots (that drops lists) and fz_drop_annot.Tor Andersson
2016-01-05Stylistic naming cleanups.Tor Andersson
2016-01-05Clean up trailing whitespace.Tor Andersson
2016-01-05Remove fz_page argument from fz_annot function calls.Tor Andersson
2015-12-28Drop 'jsimp' abstraction and use mujs directly.Tor Andersson
2015-12-28Rename fz_image_get_pixmap to fz_get_pixmap_from_image.Tor Andersson
2015-12-18Remove fz_save_document and use pdf_save_document directly instead.Tor Andersson
In preparation of adding pdf_write_document that writes a document to a fz_output stream.
2015-12-15Rename fz_buffer_cat to fz_append_buffer.Tor Andersson
2015-12-15Rename fz_write_x to fz_save_pixmap_as_x or fz_save_bitmap_as_x.Tor Andersson
Separate naming of functions that save complete files to disk from functions that write data to streams.
2015-12-11Remove text clip accumulation.Tor Andersson
We can now group all clipped text into one fz_text object and simplify the device interface.
2015-12-11Keep spans of multiple fonts and sizes in one fz_text object.Tor Andersson
2015-12-11Use fz_output instead of FILE* for most of our output needs.Tor Andersson
Use fz_output in debug printing functions. Use fz_output in pdfshow. Use fz_output in fz_trace_device instead of stdout. Use fz_output in pdf-write.c. Rename fz_new_output_to_filename to fz_new_output_with_path. Add seek and tell to fz_output. Remove unused functions like fz_fprintf. Fix typo in pdf_print_obj.
2015-10-21Fix signatures for files created with pdf_create_document.Simon Reinhardt
See Bug 696284. Do not set disallow_new_increments in pdf_create_document, as this breaks following calls to pdf_sign_signature. See also the comments in bug 696251.
2015-10-19Fix 695582: add knockout group for text that is both stroke and fill.Tor Andersson
2015-10-15Fix 696241: fix bracketing of begin_group/end_group for text objects.Tor Andersson
2015-10-14Remove unused variable.Michael Vrhel
2015-10-14Add proper support for when a combobox widget has options that are 2-element ↵Michael Vrhel
arrays The list box and combo box can have values that are 2-element arrays. The first element is the "export" value and the second element is the value that should be shown in the list box UI. This fix ensures that we get the proper value to show in the UI. Also, it adds the option to get the export values. These are needed if you wish to update the field dictionary's V (value) entry, which is the currently selected values(s). This fix works well with gsview. The other viewers will now display the proper content in their UI, (unlike before this fix) but may need a bit more work to ensure that the proper V (value) is updated with changes in the selections. In addition, we add selection rectangles to the selected list box items.
2015-10-14Fix incremental xref stream.Simon Reinhardt
When writing incremental xref streams, the opts->use_list entry of the last object, i.e. of the xref stream object itself, was left uninitialized. This resulted in a random value, 0 or 1, being written into the xref stream. Also, always write a newline before the endstream keyword, as that shall be done for xref streams and should be done for all other streams.
2015-10-14Fix pdf_create_document.Simon Reinhardt
In pdf_create_document set disallow_new_increments to 1. Without this, the calls to pdf_new_ref in pdf_create_document create an incremental xref section. The following call to pdf_set_populating_xref_trailer then does not set the trailer of the final xref section.
2015-10-14pdf: Handle surrogate pairs in pdf_to_utf8.Tor Andersson
2015-10-14pdf: Flush text if content stream processing is cut short by errors.Tor Andersson
2015-10-02Don't stretch CJK substitute fonts.Tor Andersson
2015-10-02Fix 696148: Always create a glyph width table.Tor Andersson
Respect default widths when creating the glyph width table.
2015-10-02Bug 696131: Detect some overflow conditionsRobin Watts
When lexing a number, do NOT check for overflow. This causes loss of data in some files. The current implementation matches Acrobat. When lexing a startxref offset, check for overflow. If found, throw an error.
2015-10-02Bug 696129: Be more forgiving of broken files.Robin Watts
The PDF spec says that old format xrefs should start with: xref\n<start> <len> The example file in question has: xref <start> <len> which confuses our parsing code. Update the parse code to avoid using fz_read_line, and to instead work on a char level. Also, downgrade the error given when the first object is not free to be a warning. Now we do 'just in time' repair, we are probably better able to cope.
2015-10-02Reference count fz_outline struct.Robin Watts
2015-10-01Bug 696146: Improve pdf_repair to find /Root in new style XRefs.Robin Watts
The current code never looks for /Root objects in dictionaries as it parses them. This means that 'New style' files end up without any Roots after repair. The new code therefore updates pdf_repair_obj to look for Root objects in the same way it looks for encrypt and id objects. These go into the list of found roots. The Root object almost certainly has indirections within it, so it is vital that the 'doc' pointer gets set. This means we have to make a slight adjustment to pdf_repair_obj so that the dict is parsed with a doc pointer. In turn this means we need to manually ensure that none of the other information read from the dict during the repair operation will cause indirections to be resolved. This is achieved by checking for !pdf_is_indirect at various points.
2015-09-28Bug 696170: Fix typo.Robin Watts
sizeof(16) is not 16 :) Thanks to David Binderman for pointing this out.
2015-09-28Bug 696182: Fix Revision 6 PDF encryption.Robin Watts
Take on 2 patches from Zeniko to solve problems with the latest version of PDF encryption. Many thanks.
2015-09-25Abort repairing if we cannot find any objects.Tor Andersson
2015-09-01Default to invert_cmyk_jpeg for all formats other than PDF.Tor Andersson
2015-08-27Support several levels of incremental xrefPaul Gardiner
This fixes bug #696123 by allowing multiple signatures each to be written to the document in a separate incemental update. Add count num_incremental_sections to keep track of the number of incremental sections. Add xref_base, which can be set between 0 and num_incremental_sections inclusive to access different versions of the document. Add disallow_new_increments flag that stops new incremental sections being provoked by the creation of an xref stream. Move the unsaved_sigs list from the document structure to the xref structure. With this commit in place, the lists will never grow beyond length one, but we've maintained the list structure in case other cases need supporting in the future. Add an end offset field to the xref structure, so that during completion of signatures the document length of the various incremental versions of the document are available. Factor out functions for storing unsaved signatures and for checking if an object is an unsaved signature. Do deep copy of objects that require the holding of several versions.
2015-08-27Move objects to the incremental xref before changing themPaul Gardiner
This is work towards supporting several levels of incremental xref, which in turn is work towards bug #696123. When several levels are present, the operation will make a copy of the object and that needs to be done before any change to the object.
2015-08-27In pdf_write_document, factor out init/fin of pdf_write_optionsPaul Gardiner
This is work towards bug #696123
2015-08-27Fix bug in setting of opts->ofs_listPaul Gardiner
In the incremental case, we should update ofs_list only when actually writing an object to file. This is work towards bug #696123.
2015-08-27Add a deep-copy function for pdf objectsPaul Gardiner
This is work towards supporting several levels of incremental xref, which in turn, is work towards bug #696123. When several levels of incremental xref are present there can be objects that appear at multiple levels and differ between those levels. This deep-copy function will be used to create new copies before the new version is altered.
2015-08-27Ensure the unsaved signatures list is held in ascending orderPaul Gardiner
This is work towards bug #696123. It does not fix the bug because, in fact, saving multiple signatures in one go is not permitted (they need to use several incremental saves), but we may as well have the order correctly held.
2015-08-20Remove duplicate inclusions of headers.Sebastian Rasmussen
These headers are already included by mupdf/fitz/system.h.
2015-07-31Use new fz_read_int functions.Tor Andersson
2015-07-28Reset xref object entry when repairing pdf objects.Sebastian Rasmussen
When attempting to load pdf objects and a valid pdf object is found but it has the wrong number, mark the xref object entry as being free before attempting to repair the xref. This ensures that if the wanted object cannot be found in the document then the missing object will be considered to be null. Previously it was still assumed to be around, but the object pointer was NULL triggering an assert in pdf_load_object().