summaryrefslogtreecommitdiff
path: root/source/pdf
AgeCommit message (Collapse)Author
2018-03-22Load most annotations, even if they are missing appearances.Tor Andersson
Filter out Link and Popup annotations. Links are not comments, popup annotations are auxiliary information for other annotations, so neither of these types should be present in our list of annotations, but all other annotations should be there, whether they have appearance streams or not. Ensure has_new_ap is zero when first loaded, and changed if either the active AP object is changed or the current AP content stream is updated.
2018-03-22Fix 699085: Use at most 16 bytes from MD5 digests.Sebastian Rasmussen
Previously crypt->len / 8 could be 0..32. In the case of crypt->len == 256 this meant that when an 16 byte MD5 was computed, uninitalized key data would be accessed because 32 bytes of key data was accessed. Now crypt->len / 8 is limited to 0..16. So when the 16 byte MD5 is computed and later accessed only the initialized part of the key data is accessed. Because crypt->len / 8 is now limited to 0..16 the key data buffer can also be shrunk to 16 bytes without risking the code stepping over its boundaries.
2018-03-22Rearrange user password authentication code.Sebastian Rasmussen
pdf_authenticate_user_password() now looks similar to pdf_compute_user_password(), easing readability.
2018-03-22Fix leak of form object when updating text appearance.Sebastian Rasmussen
2018-03-16Fix 699026: Create missing font resource.Tor Andersson
If a widget DR is missing the font name given in the DA, create a new simple font for it.
2018-03-16Simplify PDF font creation code.Tor Andersson
Don't create a useless pdf_font_desc when writing font resources. Simplify reference counting by using fewer intermediate variables.
2018-03-16Add simple fonts with 8-bit greek and cyrillic encodings.Tor Andersson
Use KOI8-U for Cyrillic, and ISO 8859-7 for Greek. Use with 'mutool create' using an extra argument to the %%Font directive: %%Font TmRmC Times-Roman Cyrillic BT /TmRmC 16 Tf 10 10 Td <fa c4 d2 c1 d7 d3 d4 d7 d5 ca d4 c5 21> Tj ET The alternatives are "Latin", "Greek", and "Cyrillic".
2018-03-16Add simple CJK font creation.Tor Andersson
Create a non-embedded CJK font using UTF-16 encoding. This can be used in mutool create like so: %%CJKFont Ming GB1 BT /Ming 10 Tf 100 100 Td <4F60 597D> Tj ET
2018-03-16Use convenience function in pdf_set_annot_contents.Tor Andersson
2018-03-16Add simpler annotation line ending style accessors.Tor Andersson
2018-03-16Add annotation quadding accessor.Tor Andersson
2018-03-16Add annotation opacity accessor.Tor Andersson
2018-03-16Only use BS/W for border width.Tor Andersson
The Border property is long since deprecated.
2018-03-16Do not warn if there are no JBIG2 globals.Sebastian Rasmussen
2018-03-15PDF stream filtering; fix pattern/xobject resource handling.Robin Watts
Patterns and XObjects can have their own resource dictionaries. If they do, use those in preference to the page ones when filtering.
2018-03-07Distinguish between simple and CID font resources in cache.Tor Andersson
2018-02-27Remove pdf_xobject wrapper struct.Tor Andersson
Just use the pdf_obj directly. Revise ap_iteration and split annot->dirty into separate flags. One flag for needs_new_ap, and one for has_new_ap (to be used by clients who may have cached a rendered annotation).
2018-02-27Use fz_point for pdf_set_annot_ink_list and vertices too.Tor Andersson
2018-02-27Improve line ending style accessors.Tor Andersson
2018-02-27Add annotation QuadPoints creation functions.Tor Andersson
2018-02-27Add annotation Line access functions.Tor Andersson
2018-02-27Add annotation Vertices creation functions.Tor Andersson
2018-02-27Add annotation InkList creation functions.Tor Andersson
2018-02-27Get border width from BS/W if Border is missing.Tor Andersson
2018-02-27Return correct default icon names for optional annotation property.Tor Andersson
2018-02-27Don't set a (useless) rectangle when creating annotations.Tor Andersson
2018-02-27Remove typedef in favor of explicit enum keyword.Tor Andersson
Avoids the silliness of fz_annot_type pdf_annot_type().
2018-02-27Fix bug in pdf_annot_icon_name.Tor Andersson
2018-02-27Print newline at end of pdf_debug_obj.Tor Andersson
2018-02-27Don't use constants larger than will fit in a signed int in enum.Tor Andersson
2018-02-27Use text encoding for pdf_choice_widget options and values.Tor Andersson
Adds a requirement on the caller to free the returned strings.
2018-02-27Use proper encoding for pdf_field_value and update_field_value.Tor Andersson
2018-02-27Recognize Adobe illustrator files as PDF format.Tor Andersson
2018-02-14Bug 698890: Remember to end groups when showing images.Sebastian Rasmussen
2018-02-13Avoid revisiting the same page tree node repeatedly.Sebastian Rasmussen
Only attempt to progress to new page tree nodes if a new node to process has actually been found. Previously if e.g. doc.findPage(1) was called in murun for a single page document the error message was "cycle in page tree" because the single page tree node was visited twice. Now the error message is "cannot find page 1 in page tree", which is more accurate.
2018-02-13Add fz_begin_layer/fz_end_layer.Robin Watts
Call these from the PDF interpreter. Make the DisplayList and Trace devices cope. Use these in the SVG output device.
2018-02-13Use indirect references when pre-loading image resources.Tor Andersson
Don't use directly loaded objects; since the image code assumes that you always use an indirect reference to the dictionary/stream.
2018-02-12jbig2 globals are streams, this implies indirect references.Sebastian Rasmussen
Previously mupdf would attempt to load any indirect reference, whether it was a stream or not.
2018-02-12Bug 698998: Avoid recursion when opening jbig2 image streams.Sebastian Rasmussen
Previously the JBIG2 globals object might be indirect and if that reference pointed to the object containing the stream itself then mupdf would recurse until running out of error stack. Thanks to oss-fuzz for reporting.
2018-02-12Expose detailed PDF permissions.Tor Andersson
2018-02-12Fix changed annotations not marked as dirtyPaul Gardiner
Events such as mouse up/down can cause a change to the appearance of a widget annotation. That the change has happened is flagged by incrementing the iteration count of the appearance stream. The widget is then recognised as dirty when the ap_iteration value, stored in the pdf_widget structure, differs from the appearance stream's actual iteration. This commit removes a line of code that wrongly reset the iteration to 1 each time load_or_create_form was called, hence masking the widget being dirty.
2018-02-08Bug 698996: Disallow "" as owner password unless user password also "".Robin Watts
2018-02-08Fix 698991: The pdf_is_stream call is too generous.Tor Andersson
It should only return true for indirect references that are actually streams, not just any array/dict that is contained in a stream object.
2018-02-08Fix 698918: Use encryption when doing initial object formatting to count the ↵Tor Andersson
length.
2018-02-06Include limits.h where INT_MAX/INT_MIN/PATH_MAX/UINT_MAX are used.Sebastian Rasmussen
2018-02-06Bug 698986: Remember to fz_var() variable dropped in fz_catch().Sebastian Rasmussen
2018-02-06Bug 698990: Start new run of font width only if not at end.Sebastian Rasmussen
Previously, while at the very last glyph mupdf would allocate a new array for a run of distinct glyph widths and then not drop it while leaving the function. Now a new run of font widths is only started if not at the very last glyph.
2018-02-06Make sure to drop colorspace upon exception drawing contents.Sebastian Rasmussen
2018-02-02Bug 698891: Keep colorspace for luminosity transparency group.Sebastian Rasmussen
This was forgotten when a gray colorspace was used as a fallback in case a colorspace was never set. Thanks to oss-fuzz for reporting.
2018-02-02Signature support: decouple mupdf from the pkcs7 implementationPaul Gardiner
The mupdf build included an implimentation of the pkcs7 functions that are needed for signing documents and verifying signatures, the implementation being either an openssl-based one, or a stub that returned errors. This commit removes the pkcs7 functions from the main mupdf library. For the sake of verification, there wasn't really a need for the pkcs7 functions to be part of mupdf. It was only the checking function that used them. The checking function is now provided as a helper, outside of the main build. The openssl-based pkcs7 functions area also supplied as a helper. Users wishing to verify signatures can either use the checking function directly, or use the source on which to base their own. Document signing requires more integration between mupdf and pkcs7 because part of the process is performed at time of signing and part when saving the document. Mupdf already had a pdf_pkcs7_signer object that kept information between the two phases. That object has now been extended to include the pkcs7 functions involved in signing, and the signing function now requires such an object, rather than a file path to a certificate. The openssl-based pkcs7 helper provides a function that, given the path to a certificate, will return a pdf_pkcs7_signer object. The intention is that different implementations can be produced for different platforms, based on cryptographic routines built into the operationg system. In each case, for the sake of document signing, the routines would be wrapped up as a pdf_pkcs7_signer object.