summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-05-24 12:14:04 +0200
committerRobin Watts <robin.watts@artifex.com>2018-06-22 16:48:45 +0100
commit2e4cabe774d46dda735164e137f0ed11885bbec5 (patch)
tree0b7a29081c51d17c5b2a95814c3398c91d2004df
parent0bf88278d160b93a6103c36e885a5db4980e92d6 (diff)
downloadmupdf-2e4cabe774d46dda735164e137f0ed11885bbec5.tar.xz
Remove rich text properties when editing annotation contents or styles.
We do not support rich text content; remove the properties rather than leave them untouched and out of sync with the simple contents and styles.
-rw-r--r--include/mupdf/pdf/name-table.h2
-rw-r--r--source/pdf/pdf-annot-edit.c9
2 files changed, 11 insertions, 0 deletions
diff --git a/include/mupdf/pdf/name-table.h b/include/mupdf/pdf/name-table.h
index cffd08cf..bff67b0d 100644
--- a/include/mupdf/pdf/name-table.h
+++ b/include/mupdf/pdf/name-table.h
@@ -102,6 +102,7 @@ PDF_MAKE_NAME("DL", DL)
PDF_MAKE_NAME("DOS", DOS)
PDF_MAKE_NAME("DP", DP)
PDF_MAKE_NAME("DR", DR)
+PDF_MAKE_NAME("DS", DS)
PDF_MAKE_NAME("DV", DV)
PDF_MAKE_NAME("DW", DW)
PDF_MAKE_NAME("DW2", DW2)
@@ -325,6 +326,7 @@ PDF_MAKE_NAME("Q", Q)
PDF_MAKE_NAME("QuadPoints", QuadPoints)
PDF_MAKE_NAME("R", R)
PDF_MAKE_NAME("RBGroups", RBGroups)
+PDF_MAKE_NAME("RC", RC)
PDF_MAKE_NAME("RClosedArrow", RClosedArrow)
PDF_MAKE_NAME("RGB", RGB)
PDF_MAKE_NAME("RI", RI)
diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c
index 55821e4f..decf5027 100644
--- a/source/pdf/pdf-annot-edit.c
+++ b/source/pdf/pdf-annot-edit.c
@@ -270,6 +270,7 @@ void
pdf_set_annot_contents(fz_context *ctx, pdf_annot *annot, const char *text)
{
pdf_dict_put_text_string(ctx, annot->obj, PDF_NAME(Contents), text);
+ pdf_dict_del(ctx, annot->obj, PDF_NAME(RC)); /* not supported */
pdf_dirty_annot(ctx, annot);
}
@@ -496,6 +497,10 @@ pdf_set_annot_border(fz_context *ctx, pdf_annot *annot, float w)
if (!pdf_is_dict(ctx, bs))
bs = pdf_dict_put_dict(ctx, annot->obj, PDF_NAME(BS), 1);
pdf_dict_put_real(ctx, bs, PDF_NAME(W), w);
+
+ pdf_dict_del(ctx, annot->obj, PDF_NAME(Border)); /* deprecated */
+ pdf_dict_del(ctx, annot->obj, PDF_NAME(BE)); /* not supported */
+
pdf_dirty_annot(ctx, annot);
}
@@ -1352,5 +1357,9 @@ pdf_set_annot_default_appearance(fz_context *ctx, pdf_annot *annot, const char *
pdf_print_default_appearance(ctx, buf, sizeof buf, font, size, color);
pdf_dict_put_string(ctx, annot->obj, PDF_NAME(DA), buf, strlen(buf));
+
+ pdf_dict_del(ctx, annot->obj, PDF_NAME(DS)); /* not supported */
+ pdf_dict_del(ctx, annot->obj, PDF_NAME(RC)); /* not supported */
+
pdf_dirty_annot(ctx, annot);
}