summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gardiner <paul@Pauls-Mac.site>2018-06-21 13:31:19 +0100
committerPaul Gardiner <paul@Pauls-Mac.site>2018-06-21 15:01:36 +0100
commit502a9f1d230821d53fe9155a590f6b5f8a80ea2a (patch)
tree1d7104eefbb73e5dba79709b4cf4d8600f4176c2
parent43dec68e7f2d577c66c0fd6b8071562e5edb9cdb (diff)
downloadmupdf-502a9f1d230821d53fe9155a590f6b5f8a80ea2a.tar.xz
Allow signature saving using pdf_write_document
It is safe to save a document with unsaved signatures to an fz_output, provided it supports fz_stream_from_output.
-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 12d0f605..0a66365e 100644
--- a/source/pdf/pdf-write.c
+++ b/source/pdf/pdf-write.c
@@ -3112,8 +3112,8 @@ void pdf_write_document(fz_context *ctx, pdf_document *doc, fz_output *out, pdf_
fz_throw(ctx, FZ_ERROR_GENERIC, "Can't do incremental writes with garbage collection");
if (in_opts->do_incremental && in_opts->do_linear)
fz_throw(ctx, FZ_ERROR_GENERIC, "Can't do incremental writes with linearisation");
- if (pdf_has_unsaved_sigs(ctx, doc))
- fz_throw(ctx, FZ_ERROR_GENERIC, "Can't write pdf that has unsaved sigs to a fz_output!");
+ if (pdf_has_unsaved_sigs(ctx, doc) && !out->as_stream)
+ fz_throw(ctx, FZ_ERROR_GENERIC, "Can't write pdf that has unsaved sigs to a fz_output unless it supports fz_stream_from_output!");
prepare_for_save(ctx, doc, in_opts);