diff options
author | Paul Gardiner <paulg.artifex@glidos.net> | 2012-08-07 15:15:10 +0100 |
---|---|---|
committer | Paul Gardiner <paulg.artifex@glidos.net> | 2012-08-07 15:15:10 +0100 |
commit | 2a8a6d46868b7a78cab1abc0ab4ef95ad9036914 (patch) | |
tree | 799fecd7c1c1486dfaae44aff4c847293b040e51 | |
parent | d5486af650977320a7469df5877c7c84068f1b83 (diff) | |
download | mupdf-2a8a6d46868b7a78cab1abc0ab4ef95ad9036914.tar.xz |
When updating an xobject's contents also reset the Length
-rw-r--r-- | pdf/pdf_xobject.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/pdf/pdf_xobject.c b/pdf/pdf_xobject.c index 6af7d951..3777602d 100644 --- a/pdf/pdf_xobject.c +++ b/pdf/pdf_xobject.c @@ -226,6 +226,24 @@ pdf_new_xobject(pdf_document *xref, fz_rect *bbox, fz_matrix *mat) void pdf_update_xobject_contents(pdf_document *xref, pdf_xobject *form, fz_buffer *buffer) { - pdf_dict_dels(form->contents, "Filter"); - pdf_update_stream(xref, pdf_to_num(form->contents), buffer); + fz_context *ctx = xref->ctx; + pdf_obj *len = NULL; + + fz_var(len); + + fz_try(ctx) + { + len = pdf_new_int(ctx, buffer->len); + pdf_dict_dels(form->contents, "Filter"); + pdf_dict_puts(form->contents, "Length", len); + pdf_update_stream(xref, pdf_to_num(form->contents), buffer); + } + fz_always(ctx) + { + pdf_drop_obj(len); + } + fz_catch(ctx) + { + fz_rethrow(ctx); + } } |