summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2018-07-04 14:53:38 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-07-05 15:32:35 +0200
commite717674eba31ed19ca1078652843a22f24a96180 (patch)
tree26af439d7205771893665c5bfd517db07cbe3684
parent4cebff9641f7a1b6af7310f698e2af8481929386 (diff)
downloadmupdf-e717674eba31ed19ca1078652843a22f24a96180.tar.xz
Fix document signing adding unnecessary incremental updates
When a document is signed multiple times, an incremental update is needed for each, the multiple updates sometimes written to the file as a single saving operation. Within pdf_sign_signature it is the call to pdf_signature_set_value that marks the current section of the xref to which changes are recorded as "full", so that subsequent changes will trigger the creation of a new section. Within pdf_sign_signature we were creating the signature's appearance stream after the call to pdf_signature_set_value and hence triggering an extra unnecessary setction. This commit moves the pdf_signature_set_value to after the creation of the appearance stream, so that we need only as many new xref sections as there are signings.
-rw-r--r--source/pdf/pdf-signature.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/pdf/pdf-signature.c b/source/pdf/pdf-signature.c
index cfb623d9..aaa2c5e1 100644
--- a/source/pdf/pdf-signature.c
+++ b/source/pdf/pdf-signature.c
@@ -69,8 +69,6 @@ void pdf_sign_signature(fz_context *ctx, pdf_document *doc, pdf_widget *widget,
pdf_obj *wobj = ((pdf_annot *)widget)->obj;
fz_rect rect = fz_empty_rect;
- pdf_signature_set_value(ctx, doc, wobj, signer);
-
rect = pdf_to_rect(ctx, pdf_dict_get(ctx, wobj, PDF_NAME(Rect)));
/* Create an appearance stream only if the signature is intended to be visible */
@@ -98,6 +96,8 @@ void pdf_sign_signature(fz_context *ctx, pdf_document *doc, pdf_widget *widget,
dn_str = fz_string_from_buffer(ctx, fzbuf);
pdf_update_signature_appearance(ctx, (pdf_annot *)widget, dn->cn, dn_str, NULL);
}
+
+ pdf_signature_set_value(ctx, doc, wobj, signer);
}
fz_always(ctx)
{