Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
7638 views
1
#ifndef MUPDF_PDF_ANNOT_H
2
#define MUPDF_PDF_ANNOT_H
3
4
enum
5
{
6
F_Invisible = 1 << (1-1),
7
F_Hidden = 1 << (2-1),
8
F_Print = 1 << (3-1),
9
F_NoZoom = 1 << (4-1),
10
F_NoRotate = 1 << (5-1),
11
F_NoView = 1 << (6-1),
12
F_ReadOnly = 1 << (7-1),
13
F_Locked = 1 << (8-1),
14
F_ToggleNoView = 1 << (9-1),
15
F_LockedContents = 1 << (10-1)
16
};
17
18
/*
19
pdf_first_annot: Return the first annotation on a page.
20
21
Does not throw exceptions.
22
*/
23
pdf_annot *pdf_first_annot(fz_context *ctx, pdf_page *page);
24
25
/*
26
pdf_next_annot: Return the next annotation on a page.
27
28
Does not throw exceptions.
29
*/
30
pdf_annot *pdf_next_annot(fz_context *ctx, pdf_page *page, pdf_annot *annot);
31
32
/*
33
pdf_bound_annot: Return the rectangle for an annotation on a page.
34
35
Does not throw exceptions.
36
*/
37
fz_rect *pdf_bound_annot(fz_context *ctx, pdf_page *page, pdf_annot *annot, fz_rect *rect);
38
39
/*
40
pdf_annot_type: Return the type of an annotation
41
*/
42
fz_annot_type pdf_annot_type(fz_context *ctx, pdf_annot *annot);
43
44
/*
45
pdf_run_annot: Interpret an annotation and render it on a device.
46
47
page: A page loaded by pdf_load_page.
48
49
annot: an annotation.
50
51
dev: Device used for rendering, obtained from fz_new_*_device.
52
53
ctm: A transformation matrix applied to the objects on the page,
54
e.g. to scale or rotate the page contents as desired.
55
*/
56
void pdf_run_annot(fz_context *ctx, pdf_page *page, pdf_annot *annot, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie);
57
58
struct pdf_annot_s
59
{
60
pdf_page *page;
61
pdf_obj *obj;
62
fz_rect rect;
63
fz_rect pagerect;
64
pdf_xobject *ap;
65
int ap_iteration;
66
fz_matrix matrix;
67
pdf_annot *next;
68
pdf_annot *next_changed;
69
int annot_type;
70
int widget_type;
71
};
72
73
fz_link_dest pdf_parse_link_dest(fz_context *ctx, pdf_document *doc, fz_link_kind kind, pdf_obj *dest);
74
char *pdf_parse_file_spec(fz_context *ctx, pdf_document *doc, pdf_obj *file_spec);
75
fz_link_dest pdf_parse_action(fz_context *ctx, pdf_document *doc, pdf_obj *action);
76
pdf_obj *pdf_lookup_dest(fz_context *ctx, pdf_document *doc, pdf_obj *needle);
77
pdf_obj *pdf_lookup_name(fz_context *ctx, pdf_document *doc, pdf_obj *which, pdf_obj *needle);
78
pdf_obj *pdf_load_name_tree(fz_context *ctx, pdf_document *doc, pdf_obj *which);
79
80
fz_link *pdf_load_link_annots(fz_context *ctx, pdf_document *, pdf_obj *annots, const fz_matrix *page_ctm);
81
82
void pdf_transform_annot(fz_context *ctx, pdf_annot *annot);
83
void pdf_load_annots(fz_context *ctx, pdf_document *, pdf_page *page, pdf_obj *annots);
84
void pdf_update_annot(fz_context *ctx, pdf_document *, pdf_annot *annot);
85
void pdf_drop_annot(fz_context *ctx, pdf_annot *link);
86
87
/*
88
pdf_create_annot: create a new annotation of the specified type on the
89
specified page. The returned pdf_annot structure is owned by the page
90
and does not need to be freed.
91
*/
92
pdf_annot *pdf_create_annot(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_annot_type type);
93
94
/*
95
pdf_delete_annot: delete an annotation
96
*/
97
void pdf_delete_annot(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_annot *annot);
98
99
/*
100
pdf_set_markup_annot_quadpoints: set the quadpoints for a text-markup annotation.
101
*/
102
void pdf_set_markup_annot_quadpoints(fz_context *ctx, pdf_document *doc, pdf_annot *annot, fz_point *qp, int n);
103
104
/*
105
pdf_set_ink_annot_list: set the details of an ink annotation. All the points of the multiple arcs
106
are carried in a single array, with the counts for each arc held in a secondary array.
107
*/
108
void pdf_set_ink_annot_list(fz_context *ctx, pdf_document *doc, pdf_annot *annot, fz_point *pts, int *counts, int ncount, float color[3], float thickness);
109
110
/*
111
pdf_set_text_annot_position: set the position on page for a text (sticky note) annotation.
112
*/
113
void pdf_set_text_annot_position(fz_context *ctx, pdf_document *doc, pdf_annot *annot, fz_point pt);
114
115
/*
116
pdf_set_annot_contents: set the contents of an annotation.
117
*/
118
void pdf_set_annot_contents(fz_context *ctx, pdf_document *doc, pdf_annot *annot, char *text);
119
120
/*
121
pdf_annot_contents: return the contents of an annotation.
122
*/
123
char *pdf_annot_contents(fz_context *ctx, pdf_document *doc, pdf_annot *annot);
124
125
/*
126
pdf_set_free_text_details: set the position, text, font and color for a free text annotation.
127
Only base 14 fonts are supported and are specified by name.
128
*/
129
void pdf_set_free_text_details(fz_context *ctx, pdf_document *doc, pdf_annot *annot, fz_point *pos, char *text, char *font_name, float font_size, float color[3]);
130
131
fz_annot_type pdf_annot_obj_type(fz_context *ctx, pdf_obj *obj);
132
133
/*
134
pdf_poll_changed_annot: enumerate the changed annotations recoreded
135
by a call to pdf_update_page.
136
*/
137
pdf_annot *pdf_poll_changed_annot(fz_context *ctx, pdf_document *idoc, pdf_page *page);
138
139
#endif
140
141