summaryrefslogtreecommitdiff
path: root/include/mupdf/pdf
AgeCommit message (Collapse)Author
2018-11-13Use fz_image.imagemask field when adding PDF image resources.Tor Andersson
Don't pass the information as a separate argument.
2018-11-12Remove bitrotted and not working PDF portfolio code.Tor Andersson
Extracting embedded files can be trivially done with 'mutool show' or a simple mutool run script. The portfolio creation code is incomplete, and would require a lot of work and testing with Adobe in order to be useful.
2018-11-12Clean up pdf-portfolio.cTor Andersson
Remove pointless paranoia checks. Move the check whether it has already been loaded into load_portfolio().
2018-11-12Fix 697728: Use UTF-8 strings in PDF portfolio functions.Tor Andersson
2018-11-12Remove confusing flag define.Tor Andersson
What's the difference between PDF_OBJ_FLAG_MARK and PDF_FLAGS_MARKED? PDF_OBJ_FLAG_MARK is used to flag an xref entry as one that we want to keep cached with the pdf_mark_xref/pdf_clear_xref_to_mark functions. PDF_FLAGS_MARKED is used to detect unwanted recursion in PDF structures. Renaming the xref_entry.flags field to xref_entry.marked should remove this source of potential confusion.
2018-11-07Fix 700053: Add 'decrypt' option to pdf_save_document.Tor Andersson
This option is exposed as the -D flag to mutool clean. Allow saving a document without encryption. The next step is to allow saving a document with new encryption, but this may require a fair amount of rejigging since the PDF write code to keep separate doc->crypt objects for decryption and encryption.
2018-10-23Remove extra blank lines.Tor Andersson
2018-09-19Add accessor for field text label.Tor Andersson
2018-08-28Avoid use of fixed size buffers for the digest when document signingPaul Gardiner
The signer object now has an extra method that informs the caller of the maximum size the digest might be. This is used to allocate space for the digest within the file and to size some of the buffers used in the code. The openssl-based inplementation of the signer object has been updated to perform a test digest generation so as to find the size needed. We believe that the digest size is indendent of the hashed data.
2018-08-22Remove the old 'nested depth' tracking.Tor Andersson
This was used to prevent infinite cycles in the Type3 font CharProcs, but the previous commits forbids all cycles in order to prevent memory leaks due to cyclic reference counts.
2018-08-10Use proper name space for form field flag constants.Tor Andersson
2018-08-10Remove functions that implement duplicate functionality.Tor Andersson
pdf_get_inheritable also looks in trailer/Root/AcroForm for missing keys, but this behavior is not supported by anything in the specification.
2018-08-10Rejig pdf_update_page and pdf_update_annot.Tor Andersson
The intent is for a user to iterate over the annotations on a page calling pdf_update_annot for each one. If this function returns true, then the annotation has changed since the last time it was called, and the user needs to re-render. pdf_update_page is a simple loop over the annotations on a page, for use if you only care about page level granularity. Users should no longer look at or change the pdf_annot.has_new_ap field.
2018-07-17Disallow incremental updating for documents that have hybrid xrefsPaul Gardiner
Alter pdf_can_be_saved_incrementally to return false when a hybrid xref file has been opened. This doesn't enforce the behaviour, but will ensure it for apps that determine their behaviour via this test function. Once changes have been saved to such a file, it is no longer hybrid and so further saving steps can use incremental updates. This change was made because we were previously unable to sign hybrid xref documents in a way that was satisfactory to Adobe Reader. Adobe Reader reorganises hybrid xref files, thus invalidating any signature.
2018-07-17Fix memory leaks in document signing functionsPaul Gardiner
2018-07-06Add pdf_dict_get_rect and pdf_dict_get_matrix helpers.Tor Andersson
2018-07-05Add digital signature appearance synthesis.Tor Andersson
The pdf_update_signature_appearance function must be called directly by the signing code when it signs the document; as only the signing code has all the text that needs to be written into the appearance.
2018-07-05Purge unused functions.Tor Andersson
2018-07-05Pass rects by value: device and document interface.Tor Andersson
2018-07-05Pass matrices by value: device and document interface.Tor Andersson
2018-07-05Pass rect and matrix by value in geometry functions.Tor Andersson
Several things irk me about passing values as const pointers: * They can be NULL, which is not a valid value. * They require explicit temporary variables for storage. * They don't compose easily in a legible manner, requiring weird pointer passing semantics where the variable being assigned is hidden as an argument in the innermost function call. * We can't change the value through the pointer, requiring yet more local variables to hold copies of the input value. In the device interface where we pass a matrix to a function, we often find ourselves making a local copy of the matrix so we can concatenate other transforms to it. This copying is a lot of unnecessary busywork that I hope to eventually avoid by laying the groundwork with this commit. This is a rather large API change, so I apologize for the inconvenience, but I hope the end result and gain in legibility will be worth the pain.
2018-07-05Return true if any annots have new APs in pdf_update_page.Tor Andersson
2018-07-05Use real WinAnsi encoding when writing appearance stream text.Tor Andersson
2018-07-05Support background and border color in Widget/Tx and Widget/Ch.Tor Andersson
2018-07-04Rename pdf_get_annot_contents to pdf_annot_contents.Tor Andersson
Since the function no longer returns ownership of the string, use the common naming convention.
2018-06-22Use fz_quad type in structured text and selection/highlighting.Tor Andersson
2018-06-22Keep copy of decoded utf8 text string in pdf_obj.Tor Andersson
Removes the need to alloc/free text strings in the API, allowing for simple functions like pdf_dict_get_text_string.
2018-06-22Call AA/F formatting when synthesizing appearance stream.Tor Andersson
2018-06-22Remove rich text properties when editing annotation contents or styles.Tor Andersson
We do not support rich text content; remove the properties rather than leave them untouched and out of sync with the simple contents and styles.
2018-06-22Create appearance streams for annotations.Tor Andersson
Now handles more annotation types, and does not use the pdf-write device. Handles many of the usual annotation properties, such as border width, color, interior color, line ending styles. * Ink * Highlight, Underline, Strike-Out, Squiggly * Line (with arrow-heads) * Polygon * PolyLine * Square * Circle * Caret * Text (needs better icons) * FileAttachment (needs better icons) * Sound (needs better icons) * Stamp * FreeText Partially complete: * Widget (treats everything like a plain text field) Not done, but on the to-do list: * /BS style (solid/dashed/bevel/inset/underline) * /BS dash pattern Not done and not on the list: * Movie * Screen * Printer's Mark * Trap Network * Watermark * /Border corner radii (ignored by acrobat) * /BE cloudy border effect
2018-06-22Remember the md5 digest in the fz_font struct.Tor Andersson
2018-06-22Add pdf_dict_get_name function.Tor Andersson
2018-06-02Rework XObject form creation/updating.Tor Andersson
2018-05-16Purge unused functions.Tor Andersson
2018-04-27Add pdf_dict_get_int, etc.Tor Andersson
2018-04-25Support creating both serif and sans-serif CJK fonts in mutool create.Tor Andersson
Also support Vertical WMode.
2018-04-25Remove document argument from pdf_new_primitive functions.Tor Andersson
Also remove useless pdf_new_null and pdf_new_bool functions. Use the PDF_NULL, PDF_TRUE, and PDF_FALSE macros instead.
2018-04-25Purge unused function: pdf_new_obj_from_str.Tor Andersson
2018-04-25Tweak ordering of constant pdf_obj enums to make PDF_NULL == NULL.Tor Andersson
2018-04-24Remove need for namedump by using macros and preprocessor.Tor Andersson
Add a PDF_NAME(Foo) macro that evaluates to a pdf_obj for /Foo. Use the C preprocessor to create the enum values and string table from one include file instead of using a separate code generator tool.
2018-03-22Add pdf_add_new_dict family of functions.Tor Andersson
Create a new empty dictionary, add it to the xref and return a new indirect reference object that points to it. This indirect reference needs to be dropped, since it was created with a function using the 'new' keyword.
2018-03-22Add pdf_dict_put_dict family of functions.Tor Andersson
pdf_dict_put_dict creates a new empty dictionary, inserts it into the parent dictionary, and returns a borrowed reference to it. These functions should simplify document creation by removing the need to wrap creation with try/catch for reference counting cleanup.
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-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-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-07Distinguish between simple and CID font resources in cache.Tor Andersson