summaryrefslogtreecommitdiff
path: root/pdf/pdf_annot.c
diff options
context:
space:
mode:
authorPaul Gardiner <paulg.artifex@glidos.net>2013-01-31 15:36:32 +0000
committerPaul Gardiner <paulg.artifex@glidos.net>2013-01-31 15:36:32 +0000
commitb029492aa4662a18e74eae8f9ee53941299de72a (patch)
tree56fd6bc6977e63d9d7448e16935a3eb596b5f519 /pdf/pdf_annot.c
parent226446aa467e868eddeefaa6136769c24153adc4 (diff)
downloadmupdf-b029492aa4662a18e74eae8f9ee53941299de72a.tar.xz
Create annotations in indirect-object form
Diffstat (limited to 'pdf/pdf_annot.c')
-rw-r--r--pdf/pdf_annot.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/pdf/pdf_annot.c b/pdf/pdf_annot.c
index b93fa258..3ba37da7 100644
--- a/pdf/pdf_annot.c
+++ b/pdf/pdf_annot.c
@@ -515,10 +515,13 @@ pdf_create_annot(pdf_document *doc, pdf_page *page, fz_annot_type type)
fz_context *ctx = doc->ctx;
pdf_annot *annot = NULL;
pdf_obj *annot_obj = pdf_new_dict(ctx, 0);
+ pdf_obj *ind_obj = NULL;
fz_var(annot);
+ fz_var(ind_obj);
fz_try(ctx)
{
+ int ind_obj_num;
fz_rect rect = {0.0, 0.0, 0.0, 0.0};
char *type_str = "";
pdf_obj *annot_arr = pdf_dict_gets(page->me, "Annots");
@@ -553,7 +556,10 @@ pdf_create_annot(pdf_document *doc, pdf_page *page, fz_annot_type type)
Insert the object in the hierarchy and the structure in the
page's array.
*/
- pdf_array_push(annot_arr, annot_obj);
+ ind_obj_num = pdf_create_object(doc);
+ pdf_update_object(doc, ind_obj_num, annot_obj);
+ ind_obj = pdf_new_indirect(ctx, ind_obj_num, 0, doc);
+ pdf_array_push(annot_arr, ind_obj);
/*
Linking must be done before any call that might throw because
@@ -567,6 +573,7 @@ pdf_create_annot(pdf_document *doc, pdf_page *page, fz_annot_type type)
fz_always(ctx)
{
pdf_drop_obj(annot_obj);
+ pdf_drop_obj(ind_obj);
}
fz_catch(ctx)
{