From 502a9f1d230821d53fe9155a590f6b5f8a80ea2a Mon Sep 17 00:00:00 2001 From: Paul Gardiner Date: Thu, 21 Jun 2018 13:31:19 +0100 Subject: 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. --- source/pdf/pdf-write.c | 4 ++-- 1 file 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); -- cgit v1.2.3