summaryrefslogtreecommitdiff
path: root/source/pdf
AgeCommit message (Collapse)Author
2013-08-28fix various typosSimon Bünzli
2013-08-28Fix bad interaction between incremental update and object streamsPaul Gardiner
The symptoms were that, created annoations were in some cases not saved. Some updated objects withing the document were not being moved into the incremental-save xref section. That in turn was due to nodes within the hierarchy of those objects not having their parent_num field set. The objects falling foul of this problem were those held in object streams. When any one object from a stream is cached, the whole stream is read and all other objects from that stream are also cached, but only the initial one has its parent_num set. This patch ensures that all objects from a stream are accounted for. In fact, for the initially-requested object, we now set parent_num twice, but that is harmless and the code to avoid doing so wouls be an unnecessary complication.
2013-08-27A few updates to signing supportPaul Gardiner
2013-08-24Support named destinations in remote link annotations.Sebastian Rasmussen
Previously there was a bug when parsing GoToR link annotations that had a named destination. mupdf incorrectly attempted to resolve the destination in the current document. Now the destination name is present in the link objects returned to the application so it can resolve any names for GoToR links in the remote document instead.
2013-08-24Link annotation code rearranged for aesthetic reasons.Sebastian Rasmussen
2013-08-23Look up glyphs by the 'uniXXXX' form if the glyph list duplicates all fail.Tor Andersson
2013-08-22Add support for writing of xref streamsPaul Gardiner
Use of the feature is currently enabled only in the case that a file that already contains xref streams is being updated incrementally. To do so in that case is necessary because an old-style xref is then not permitted. This fixes bug #694527
2013-08-13Signature creationPaul Gardiner
2013-08-13Remove unnecessary parameterPaul Gardiner
2013-08-13Insert the extra layers required for a signature-appearance streamPaul Gardiner
2013-08-13Add support for creating signature-field appearance streamsPaul Gardiner
2013-08-07Use ascender and descender to determine line skipPaul Gardiner
We should use the leading, if present, and if not present we should probably use a value a little greater than the sum of the ascender and descender, but this is definitely a step in the right direction and improves the look of filled-in forms.
2013-08-02Correctly account for alterations to xobject matrix and bboxPaul Gardiner
2013-08-02Handle more color cases in DA handlingPaul Gardiner
2013-08-02Improve naming consistencyPaul Gardiner
2013-07-30For freetext annotations, distinguish device and page space correctly.Paul Gardiner
2013-07-30Change pdf_measure_text to account for the borders around charactersPaul Gardiner
Prevously the true bounds of the glyph were used which didn't account for the total area blocked out by a character
2013-07-29Add support for freetext annotationsPaul Gardiner
This initial commit doesn't entirely complete the task: 1) There are a couple of ucs<->winansi conversions left out, 2) The text displayed by the appearance string can slightly overflow the annotation rectangle.
2013-07-29A few updates to the pdf devicePaul Gardiner
Ensure that only base14 fonts are used Set BaseFont using the name from the font Use WinAnsiEncoding Derive the font size from the trm matrix
2013-07-26Silence 'set but not used' warnings.Tor Andersson
2013-07-26Clean up whitespace.Tor Andersson
2013-07-24Fix leak of pdf_field_value.Robin Watts
pdf_js_setup_event strdups the field value, then nothing ever uses it again.
2013-07-22Collect together all code to do with appearance-stream creationPaul Gardiner
2013-07-19Initial work on progressive loadingRobin Watts
We are testing this using a new -p flag to mupdf that sets a bitrate at which data will appear to arrive progressively as time goes on. For example: mupdf -p 102400 pdf_reference17.pdf Details of the scheme used here are presented in docs/progressive.txt
2013-07-12Set /Parent entry when inserting a page into the page tree.Tor Andersson
2013-07-12Throw exception on invalid page objects when looking up page numbers.Tor Andersson
Also handle exceptions when parsing link destinations.
2013-07-11Silence a few warnings.Tor Andersson
2013-07-11Fix pdf_count_pages_before_kid to cope with /Page with /Count in.Robin Watts
2013-07-11Remove depth counter from page/resources lookups.Robin Watts
Instead of just relying on a depth count (which can easily be fooled by poor but valid files) use mark/unmark based schemes for pdf_lookup_inherited_page_item and pdf_lookup_page_number.
2013-07-11Hoist count skipping up to before we recurse.Tor Andersson
2013-07-11Implement dynamic page tree lookups.Tor Andersson
No more caching a flattened page tree in doc->page_objs/refs. No more flattening of page resources, rotation and boxes. Smart page number lookup by following Parent links. Naive implementation of insert and delet page that doesn't rebalance the trees. Requires existing page tree to hook into, cannot be used to create a page tree from scratch.
2013-07-04Update pdf_write_document to support incremental updatePaul Gardiner
2013-07-03Avoid fz_throw/message on every annotation without appearance.Robin Watts
Annotations can sometimes not have appearance streams (such as Links). Avoid spewing messages to the console about this. Also avoids overhead of throw/catch each time.
2013-07-03Rename pdf_set_objects_parent_num to pdf_set_obj_parentRobin Watts
2013-07-03Avoid spurious, broken-annotation warning when appearance stream missingPaul Gardiner
2013-07-02Fix "mutool clean -ggg" operation.Robin Watts
When moving an object from one xref to a new xref, ensure firstly that we only drop each object once (by setting it to NULL) and secondly that it has the correct parent pointer.
2013-07-01Bug 694382: Fix use-after-free due to type3 fonts.Robin Watts
Thanks to zeniko for spotting the problem here. Type 3 fonts contain a reference to the resources objects required to render the glyphs. Traditionally these have been freed when the font is freed. Unfortunately, after recent changes, freeing a PDF object requires the pdf_document concerned to still exist. While in most cases the type 3 resources are not used after we have converted the type3 glyphs to display lists, this is not always the case. For uncachable Type 3 glyphs (such as those that do not completely define elements in the graphics state that they use, such as color or line width), we end up running the glyphs at interpretation time. [ Interpretation time = when doing a direct render on the main thread, or when creating a display list - so also on the main thread. No multi-threading issues with file access here. ] The fix implemented here is for each pdf document to keep a list of the type3 fonts it has created, and to 'decouple' them from the document when the document is destroyed. The sole effect of this decoupling is to remove the resources (and the PDF operator buffers) from the font. These are only ever used during interpretation, and no further interpretations are possible without the document being alive anyway, so this should have no net effect on operation, other than allowing cleanup to proceed cleanly later on.
2013-07-01Fix android app crashing after savePaul Gardiner
Make pdf_specifics callable with a NULL doc, as was fz_interact, which it replaces.
2013-06-28Add array_insert_drop and array_delete functions.Tor Andersson
Also add index argument to array_insert.
2013-06-28Ensure altered objects are moved to the incremental xref sectionPaul Gardiner
2013-06-28Optimise xref-section extension and improve linked list creationPaul Gardiner
2013-06-27Move to using a flags bit rather than "Dirty" dict entries.Robin Watts
Correct the naming scheme for pdf_obj_xxx functions.
2013-06-27Bug 694382: Fix problems arising from recent pdf_obj changes.Robin Watts
Thanks to zeniko for spotting these problems. When we close a document, purge the glyph cache to ensure that no type3 glyphs hang around with pointers to pdf_obj's that are now gone. Pass doc to pdf_new_obj_from_str rather than NULL. We believe that the reason this needed to be NULL is no longer valid. Also, revert to using an int for ref counts. In a quick test of our regression suite we only found 2 files that ever made a refcount > 256 (and they never got larger than 768), but the potential is there for issues. Reverting to an int until we can think of a better idea.
2013-06-26Ensure monotonicity of xref-section sizePaul Gardiner
2013-06-26Silence compiler warnings.Tor Andersson
2013-06-25Rework storing internal flags in PDF objects.Robin Watts
Before we render a page we need to evaluate whether we need transparency or not. To establish this, we recursively walk the resources looking for certain markers (blend modes, alpha levels, smasks etc). To avoid doing this repeatedly we'd like to stash the results somewhere. Currently we write a '.useBM' entry into the top level dictionary object, but with the recent changes to support incremental update this is not ideal - it has the effect of forcing all resources into the new section of the xref. So we avoid that horrible hack and use a different one; we make use of the new flags word in the pdf_obj structure. 1 bit is used to indicate whether we have stashed a (boolean) value here, and another bit is used to indicate what that value was.
2013-06-25Ensure that xref_sections always grow over time.Robin Watts
Never allow a new xref_section to be smaller than a previous one, as this makes pdf_xref_len(xref) get unexpectedly smaller.
2013-06-25Fix potential memory leakPaul Gardiner
2013-06-25Rid the world of "pdf_document *xref".Robin Watts
For historical reasons lots of the code uses "xref" when talking about a pdf document. Now pdf_xref is a separate type this has become confusing, so replace 'xref' with 'doc' for clarity.
2013-06-25Update pdf_obj's to have a pdf_document field.Robin Watts
Remove the fz_context field to avoid the structure growing.