From 3f0004acad7da3fcac4687844cb36e2b1ee855b0 Mon Sep 17 00:00:00 2001 From: Paul Gardiner Date: Fri, 14 Feb 2014 14:09:41 +0000 Subject: Add function for creating form fields (widgets) This feature is being implemented mostly for the purpose of permitting the addition to a page of invisible signatures. Also change pdf_create_annot to make freshly created annotations printable by default. --- include/mupdf/pdf/annot.h | 14 ++++++++++++++ include/mupdf/pdf/field.h | 1 + include/mupdf/pdf/widget.h | 5 +++++ 3 files changed, 20 insertions(+) (limited to 'include') diff --git a/include/mupdf/pdf/annot.h b/include/mupdf/pdf/annot.h index 417f5fe3..8519a6fa 100644 --- a/include/mupdf/pdf/annot.h +++ b/include/mupdf/pdf/annot.h @@ -1,6 +1,20 @@ #ifndef MUPDF_PDF_ANNOT_H #define MUPDF_PDF_ANNOT_H +enum +{ + F_Invisible = 1 << (1-1), + F_Hidden = 1 << (2-1), + F_Print = 1 << (3-1), + F_NoZoom = 1 << (4-1), + F_NoRotate = 1 << (5-1), + F_NoView = 1 << (6-1), + F_ReadOnly = 1 << (7-1), + F_Locked = 1 << (8-1), + F_ToggleNoView = 1 << (9-1), + F_LockedContents = 1 << (10-1) +}; + /* pdf_first_annot: Return the first annotation on a page. diff --git a/include/mupdf/pdf/field.h b/include/mupdf/pdf/field.h index d31051a2..246ddc89 100644 --- a/include/mupdf/pdf/field.h +++ b/include/mupdf/pdf/field.h @@ -21,6 +21,7 @@ enum pdf_obj *pdf_get_inheritable(pdf_document *doc, pdf_obj *obj, char *key); int pdf_get_field_flags(pdf_document *doc, pdf_obj *obj); int pdf_field_type(pdf_document *doc, pdf_obj *field); +void pdf_set_field_type(pdf_document *doc, pdf_obj *obj, int type); char *pdf_field_value(pdf_document *doc, pdf_obj *field); int pdf_field_set_value(pdf_document *doc, pdf_obj *field, char *text); char *pdf_field_border_style(pdf_document *doc, pdf_obj *field); diff --git a/include/mupdf/pdf/widget.h b/include/mupdf/pdf/widget.h index 2c94c828..9f2745cc 100644 --- a/include/mupdf/pdf/widget.h +++ b/include/mupdf/pdf/widget.h @@ -49,6 +49,11 @@ pdf_widget *pdf_first_widget(pdf_document *doc, pdf_page *page); */ pdf_widget *pdf_next_widget(pdf_widget *previous); +/* + pdf_create_widget: create a new widget of a specific type +*/ +pdf_widget *pdf_create_widget(pdf_document *doc, pdf_page *page, int type, char *fieldname); + /* pdf_widget_get_type: find out the type of a widget. -- cgit v1.2.3