Request resynthesis for all annotations when a field is marked dirty.
authorRobin Watts <[email protected]>
Mon, 2 Aug 2021 11:07:10 +0000 (12:07 +0100)
committerRobin Watts <[email protected]>
Mon, 2 Aug 2021 15:36:55 +0000 (16:36 +0100)
When resynthesising an annotation, we consider the field being
dirty as enough reason to resynthesise it. As such, whenever a
field is marked as dirty, we should trigger a resynthesis, so
that fields don't change later on when resynthesise are triggered
for other reasons.

calc2.pdf fails to update properly (type 123 x 45 = for example)
without this fix, so clearly we are not currently triggering a
resythesis when we should be.

Credit to Sebastian for spotting this.

source/pdf/pdf-form.c

index cf9fe7bbfb605b1f4dcf4108cdee9aa3040c7b56..9d1e36b8a2c339ddf07ebd835978ab7d3369356b 100644 (file)
@@ -83,6 +83,7 @@ static pdf_obj *find_head_of_field_group(fz_context *ctx, pdf_obj *obj)
 
 static void pdf_field_mark_dirty(fz_context *ctx, pdf_obj *field)
 {
+       pdf_document *doc = pdf_get_bound_document(ctx, field);
        pdf_obj *kids = pdf_dict_get(ctx, field, PDF_NAME(Kids));
        if (kids)
        {
@@ -91,6 +92,8 @@ static void pdf_field_mark_dirty(fz_context *ctx, pdf_obj *field)
                        pdf_field_mark_dirty(ctx, pdf_array_get(ctx, kids, i));
        }
        pdf_dirty_obj(ctx, field);
+       if (doc)
+               doc->resynth_required = 1;
 }
 
 static void update_field_value(fz_context *ctx, pdf_document *doc, pdf_obj *obj, const char *text)