Skip to content

Commit 22f3400

Browse files
committed
PDF: fix pdf_clone_for_view_only (fixes issue #257)
1 parent 9c573cd commit 22f3400

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mupdf/source/pdf/pdf-annot.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ pdf_create_annot_ex(pdf_document *doc, const fz_rect *rect, pdf_obj *base_obj, f
619619
}
620620

621621
#define ANNOT_OC_VIEW_ONLY \
622-
"<< /OCGs << /Usage << /Print << /PrintState /OFF >> /Export << /ExportState /OFF >> >> >> >>"
622+
"<< /Type /OCMD /OCGs << /Type /OCG /Usage << /Print << /PrintState /OFF >> /Export << /ExportState /OFF >> >> >> >>"
623623

624624
static pdf_obj *
625625
pdf_clone_for_view_only(pdf_document *doc, pdf_obj *obj)
@@ -629,6 +629,8 @@ pdf_clone_for_view_only(pdf_document *doc, pdf_obj *obj)
629629

630630
fz_try(ctx)
631631
{
632+
if (!doc->ocg)
633+
doc->ocg = fz_calloc(doc->ctx, 1, sizeof(*doc->ocg));
632634
pdf_dict_puts_drop(obj, "OC", pdf_new_obj_from_str(doc, ANNOT_OC_VIEW_ONLY));
633635
}
634636
fz_catch(ctx)

0 commit comments

Comments
 (0)