summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-11-06 14:31:26 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-11-07 14:02:18 +0100
commit635b325a64d7a271bbb6a9507c2d85332aa4d028 (patch)
tree3d122698af8a526b66d2278ed1a529507d98dafb /source
parent164ddc22ee0d5b63a81d5148f44c37dd132a9356 (diff)
downloadmupdf-635b325a64d7a271bbb6a9507c2d85332aa4d028.tar.xz
Fix writing encrypted PDF files with 'decompress' option.
Diffstat (limited to 'source')
-rw-r--r--source/pdf/pdf-write.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c
index b27f9070..6417e2fa 100644
--- a/source/pdf/pdf-write.c
+++ b/source/pdf/pdf-write.c
@@ -1769,12 +1769,12 @@ static void expandstream(fz_context *ctx, pdf_document *doc, pdf_write_state *op
addhexfilter(ctx, doc, obj);
}
- pdf_dict_put_int(ctx, obj, PDF_NAME(Length), len);
+ pdf_dict_put_int(ctx, obj, PDF_NAME(Length), pdf_encrypted_len(ctx, doc->crypt, num, gen, (int)len));
fz_write_printf(ctx, opts->out, "%d %d obj\n", num, gen);
pdf_print_encrypted_obj(ctx, opts->out, obj, opts->do_tight, doc->crypt, num, gen);
fz_write_string(ctx, opts->out, "\nstream\n");
- fz_write_data(ctx, opts->out, data, len);
+ pdf_encrypt_data(ctx, doc->crypt, num, gen, write_data, opts->out, data, len);
fz_write_string(ctx, opts->out, "\nendstream\nendobj\n\n");
}
fz_always(ctx)