summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-write.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-09-27 17:09:08 +0100
committerRobin Watts <robin.watts@artifex.com>2013-09-27 17:09:08 +0100
commitd8d60e939c571969723e92003888e8040eec31a4 (patch)
tree3f44782928c078d847b12ed83431452980eeff28 /source/pdf/pdf-write.c
parente6ad4dbd07ecffdb764a58977a013c862263355b (diff)
downloadmupdf-d8d60e939c571969723e92003888e8040eec31a4.tar.xz
preserve /Encrypt for documents with streamed xrefs
If /Encrypt is not present on an updated xref of an encrypted document, that document can no longer be opened. This is required for incremental saving. Note: Streams aren't encrypted by pdf_write_document and can't thus currently be appended to an encrypted document. In that case, saving non-incrementally will produce a working (non-encrypted) document.
Diffstat (limited to 'source/pdf/pdf-write.c')
-rw-r--r--source/pdf/pdf-write.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c
index 3ae6796e..579204ca 100644
--- a/source/pdf/pdf-write.c
+++ b/source/pdf/pdf-write.c
@@ -1919,6 +1919,13 @@ static void writexrefstream(pdf_document *doc, pdf_write_options *opts, int from
obj = pdf_dict_gets(pdf_trailer(doc), "ID");
if (obj)
pdf_dict_puts(dict, "ID", obj);
+
+ if (opts->do_incremental)
+ {
+ obj = pdf_dict_gets(pdf_trailer(doc), "Encrypt");
+ if (obj)
+ pdf_dict_puts(dict, "Encrypt", obj);
+ }
}
pdf_dict_puts_drop(dict, "Size", pdf_new_int(doc, to));