1/* poppler-page.h: glib interface to poppler
2 * Copyright (C) 2004, Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef __POPPLER_PAGE_H__
20#define __POPPLER_PAGE_H__
21
22#include <glib-object.h>
23
24#include "poppler.h"
25
26#include <cairo.h>
27
28G_BEGIN_DECLS
29
30#define POPPLER_TYPE_PAGE (poppler_page_get_type())
31#define POPPLER_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_PAGE, PopplerPage))
32#define POPPLER_IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_PAGE))
33
34POPPLER_PUBLIC
35GType poppler_page_get_type(void) G_GNUC_CONST;
36
37POPPLER_PUBLIC
38void poppler_page_render(PopplerPage *page, cairo_t *cairo);
39POPPLER_PUBLIC
40void poppler_page_render_for_printing(PopplerPage *page, cairo_t *cairo);
41POPPLER_PUBLIC
42void poppler_page_render_for_printing_with_options(PopplerPage *page, cairo_t *cairo, PopplerPrintFlags options);
43POPPLER_PUBLIC
44cairo_surface_t *poppler_page_get_thumbnail(PopplerPage *page);
45POPPLER_PUBLIC
46void poppler_page_render_selection(PopplerPage *page, cairo_t *cairo, PopplerRectangle *selection, PopplerRectangle *old_selection, PopplerSelectionStyle style, PopplerColor *glyph_color, PopplerColor *background_color);
47
48POPPLER_PUBLIC
49void poppler_page_get_size(PopplerPage *page, double *width, double *height);
50POPPLER_PUBLIC
51int poppler_page_get_index(PopplerPage *page);
52POPPLER_PUBLIC
53gchar *poppler_page_get_label(PopplerPage *page);
54POPPLER_PUBLIC
55double poppler_page_get_duration(PopplerPage *page);
56POPPLER_PUBLIC
57PopplerPageTransition *poppler_page_get_transition(PopplerPage *page);
58POPPLER_PUBLIC
59gboolean poppler_page_get_thumbnail_size(PopplerPage *page, int *width, int *height);
60POPPLER_PUBLIC
61GList *poppler_page_find_text_with_options(PopplerPage *page, const char *text, PopplerFindFlags options);
62POPPLER_PUBLIC
63GList *poppler_page_find_text(PopplerPage *page, const char *text);
64POPPLER_PUBLIC
65void poppler_page_render_to_ps(PopplerPage *page, PopplerPSFile *ps_file);
66POPPLER_PUBLIC
67char *poppler_page_get_text(PopplerPage *page);
68POPPLER_PUBLIC
69char *poppler_page_get_text_for_area(PopplerPage *page, PopplerRectangle *area);
70POPPLER_PUBLIC
71char *poppler_page_get_selected_text(PopplerPage *page, PopplerSelectionStyle style, PopplerRectangle *selection);
72POPPLER_PUBLIC
73cairo_region_t *poppler_page_get_selected_region(PopplerPage *page, gdouble scale, PopplerSelectionStyle style, PopplerRectangle *selection);
74POPPLER_PUBLIC
75GList *poppler_page_get_selection_region(PopplerPage *page, gdouble scale, PopplerSelectionStyle style, PopplerRectangle *selection) G_GNUC_DEPRECATED_FOR(poppler_page_get_selected_region);
76POPPLER_PUBLIC
77void poppler_page_selection_region_free(GList *region) G_GNUC_DEPRECATED_FOR(cairo_region_destroy);
78POPPLER_PUBLIC
79GList *poppler_page_get_link_mapping(PopplerPage *page);
80POPPLER_PUBLIC
81void poppler_page_free_link_mapping(GList *list);
82POPPLER_PUBLIC
83GList *poppler_page_get_image_mapping(PopplerPage *page);
84POPPLER_PUBLIC
85void poppler_page_free_image_mapping(GList *list);
86POPPLER_PUBLIC
87cairo_surface_t *poppler_page_get_image(PopplerPage *page, gint image_id);
88POPPLER_PUBLIC
89GList *poppler_page_get_form_field_mapping(PopplerPage *page);
90POPPLER_PUBLIC
91void poppler_page_free_form_field_mapping(GList *list);
92POPPLER_PUBLIC
93GList *poppler_page_get_annot_mapping(PopplerPage *page);
94POPPLER_PUBLIC
95void poppler_page_free_annot_mapping(GList *list);
96POPPLER_PUBLIC
97void poppler_page_add_annot(PopplerPage *page, PopplerAnnot *annot);
98POPPLER_PUBLIC
99void poppler_page_remove_annot(PopplerPage *page, PopplerAnnot *annot);
100POPPLER_PUBLIC
101void poppler_page_get_crop_box(PopplerPage *page, PopplerRectangle *rect);
102POPPLER_PUBLIC
103gboolean poppler_page_get_bounding_box(PopplerPage *page, PopplerRectangle *rect);
104POPPLER_PUBLIC
105gboolean poppler_page_get_text_layout(PopplerPage *page, PopplerRectangle **rectangles, guint *n_rectangles);
106POPPLER_PUBLIC
107gboolean poppler_page_get_text_layout_for_area(PopplerPage *page, PopplerRectangle *area, PopplerRectangle **rectangles, guint *n_rectangles);
108POPPLER_PUBLIC
109GList *poppler_page_get_text_attributes(PopplerPage *page);
110POPPLER_PUBLIC
111void poppler_page_free_text_attributes(GList *list);
112POPPLER_PUBLIC
113GList *poppler_page_get_text_attributes_for_area(PopplerPage *page, PopplerRectangle *area);
114
115/* A rectangle on a page, with coordinates in PDF points. */
116#define POPPLER_TYPE_RECTANGLE (poppler_rectangle_get_type())
117/**
118 * PopplerRectangle:
119 * @x1: x coordinate of lower left corner
120 * @y1: y coordinate of lower left corner
121 * @x2: x coordinate of upper right corner
122 * @y2: y coordinate of upper right corner
123 *
124 * A #PopplerRectangle is used to describe
125 * locations on a page and bounding boxes
126 */
127struct _PopplerRectangle
128{
129 gdouble x1;
130 gdouble y1;
131 gdouble x2;
132 gdouble y2;
133};
134
135POPPLER_PUBLIC
136GType poppler_rectangle_get_type(void) G_GNUC_CONST;
137POPPLER_PUBLIC
138PopplerRectangle *poppler_rectangle_new(void);
139POPPLER_PUBLIC
140PopplerRectangle *poppler_rectangle_copy(PopplerRectangle *rectangle);
141POPPLER_PUBLIC
142void poppler_rectangle_free(PopplerRectangle *rectangle);
143POPPLER_PUBLIC
144gboolean poppler_rectangle_find_get_match_continued(const PopplerRectangle *rectangle);
145POPPLER_PUBLIC
146gboolean poppler_rectangle_find_get_ignored_hyphen(const PopplerRectangle *rectangle);
147
148/* A point on a page, with coordinates in PDF points. */
149#define POPPLER_TYPE_POINT (poppler_point_get_type())
150/**
151 * PopplerPoint:
152 * @x: x coordinate
153 * @y: y coordinate
154 *
155 * A #PopplerPoint is used to describe a location point on a page
156 */
157struct _PopplerPoint
158{
159 gdouble x;
160 gdouble y;
161};
162
163POPPLER_PUBLIC
164GType poppler_point_get_type(void) G_GNUC_CONST;
165POPPLER_PUBLIC
166PopplerPoint *poppler_point_new(void);
167POPPLER_PUBLIC
168PopplerPoint *poppler_point_copy(PopplerPoint *point);
169POPPLER_PUBLIC
170void poppler_point_free(PopplerPoint *point);
171
172/* PopplerQuadrilateral */
173
174/* A quadrilateral encompasses a word or group of contiguous words in the
175 * text underlying the annotation. The coordinates for each quadrilateral are
176 * given in the order x1 y1 x2 y2 x3 y3 x4 y4 specifying the quadrilateral’s four
177 * vertices in counterclockwise order */
178
179#define POPPLER_TYPE_QUADRILATERAL (poppler_quadrilateral_get_type())
180/**
181 * PopplerQuadrilateral:
182 * @p1: a #PopplerPoint with the first vertex coordinates
183 * @p2: a #PopplerPoint with the second vertex coordinates
184 * @p3: a #PopplerPoint with the third vertex coordinates
185 * @p4: a #PopplerPoint with the fourth vertex coordinates
186 *
187 * A #PopplerQuadrilateral is used to describe rectangle-like polygon
188 * with arbitrary inclination on a page.
189 *
190 * Since: 0.26
191 **/
192struct _PopplerQuadrilateral
193{
194 PopplerPoint p1;
195 PopplerPoint p2;
196 PopplerPoint p3;
197 PopplerPoint p4;
198};
199
200POPPLER_PUBLIC
201GType poppler_quadrilateral_get_type(void) G_GNUC_CONST;
202POPPLER_PUBLIC
203PopplerQuadrilateral *poppler_quadrilateral_new(void);
204POPPLER_PUBLIC
205PopplerQuadrilateral *poppler_quadrilateral_copy(PopplerQuadrilateral *quad);
206POPPLER_PUBLIC
207void poppler_quadrilateral_free(PopplerQuadrilateral *quad);
208
209/* A color in RGB */
210#define POPPLER_TYPE_COLOR (poppler_color_get_type())
211
212/**
213 * PopplerColor:
214 * @red: the red component of color
215 * @green: the green component of color
216 * @blue: the blue component of color
217 *
218 * A #PopplerColor describes a RGB color. Color components
219 * are values between 0 and 65535
220 */
221struct _PopplerColor
222{
223 guint16 red;
224 guint16 green;
225 guint16 blue;
226};
227
228POPPLER_PUBLIC
229GType poppler_color_get_type(void) G_GNUC_CONST;
230POPPLER_PUBLIC
231PopplerColor *poppler_color_new(void);
232POPPLER_PUBLIC
233PopplerColor *poppler_color_copy(PopplerColor *color);
234POPPLER_PUBLIC
235void poppler_color_free(PopplerColor *color);
236
237/* Text attributes. */
238#define POPPLER_TYPE_TEXT_ATTRIBUTES (poppler_text_attributes_get_type())
239/**
240 * PopplerTextAttributes:
241 * @font_name: font name
242 * @font_size: font size
243 * @is_underlined: if text is underlined
244 * @color: a #PopplerColor, the foreground color
245 * @start_index: start position this text attributes apply
246 * @end_index: end position this text attributes apply
247 *
248 * A #PopplerTextAttributes is used to describe text attributes of a range of text
249 *
250 * Since: 0.18
251 */
252struct _PopplerTextAttributes
253{
254 gchar *font_name;
255 gdouble font_size;
256 gboolean is_underlined;
257 PopplerColor color;
258
259 gint start_index;
260 gint end_index;
261};
262
263POPPLER_PUBLIC
264GType poppler_text_attributes_get_type(void) G_GNUC_CONST;
265POPPLER_PUBLIC
266PopplerTextAttributes *poppler_text_attributes_new(void);
267POPPLER_PUBLIC
268PopplerTextAttributes *poppler_text_attributes_copy(PopplerTextAttributes *text_attrs);
269POPPLER_PUBLIC
270void poppler_text_attributes_free(PopplerTextAttributes *text_attrs);
271
272/* Mapping between areas on the current page and PopplerActions */
273#define POPPLER_TYPE_LINK_MAPPING (poppler_link_mapping_get_type())
274
275/**
276 * PopplerLinkMapping:
277 * @area: a #PopplerRectangle representing an area of the page
278 * @action: a #PopplerAction
279 *
280 * A #PopplerLinkMapping structure represents the location
281 * of @action on the page
282 */
283struct _PopplerLinkMapping
284{
285 PopplerRectangle area;
286 PopplerAction *action;
287};
288
289POPPLER_PUBLIC
290GType poppler_link_mapping_get_type(void) G_GNUC_CONST;
291POPPLER_PUBLIC
292PopplerLinkMapping *poppler_link_mapping_new(void);
293POPPLER_PUBLIC
294PopplerLinkMapping *poppler_link_mapping_copy(PopplerLinkMapping *mapping);
295POPPLER_PUBLIC
296void poppler_link_mapping_free(PopplerLinkMapping *mapping);
297
298/* Page Transition */
299#define POPPLER_TYPE_PAGE_TRANSITION (poppler_page_transition_get_type())
300
301/**
302 * PopplerPageTransition:
303 * @type: the type of transtition
304 * @alignment: the dimension in which the transition effect shall occur.
305 * Only for #POPPLER_PAGE_TRANSITION_SPLIT and #POPPLER_PAGE_TRANSITION_BLINDS transition types
306 * @direction: the direction of motion for the transition effect.
307 * Only for #POPPLER_PAGE_TRANSITION_SPLIT, #POPPLER_PAGE_TRANSITION_BOX and #POPPLER_PAGE_TRANSITION_FLY
308 * transition types
309 * @duration: the duration of the transition effect
310 * @angle: the direction in which the specified transition effect shall moves,
311 * expressed in degrees counterclockwise starting from a left-to-right direction.
312 * Only for #POPPLER_PAGE_TRANSITION_WIPE, #POPPLER_PAGE_TRANSITION_GLITTER, #POPPLER_PAGE_TRANSITION_FLY,
313 * #POPPLER_PAGE_TRANSITION_COVER, #POPPLER_PAGE_TRANSITION_UNCOVER and #POPPLER_PAGE_TRANSITION_PUSH
314 * transition types
315 * @scale: the starting or ending scale at which the changes shall be drawn.
316 * Only for #POPPLER_PAGE_TRANSITION_FLY transition type
317 * @rectangular: whether the area that will be flown is rectangular and opaque.
318 * Only for #POPPLER_PAGE_TRANSITION_FLY transition type
319 *
320 * A #PopplerPageTransition structures describes a visual transition
321 * to use when moving between pages during a presentation
322 */
323struct _PopplerPageTransition
324{
325 PopplerPageTransitionType type;
326 PopplerPageTransitionAlignment alignment;
327 PopplerPageTransitionDirection direction;
328 gint duration;
329 gint angle;
330 gdouble scale;
331 gboolean rectangular;
332 gdouble duration_real;
333};
334
335POPPLER_PUBLIC
336GType poppler_page_transition_get_type(void) G_GNUC_CONST;
337POPPLER_PUBLIC
338PopplerPageTransition *poppler_page_transition_new(void);
339POPPLER_PUBLIC
340PopplerPageTransition *poppler_page_transition_copy(PopplerPageTransition *transition);
341POPPLER_PUBLIC
342void poppler_page_transition_free(PopplerPageTransition *transition);
343
344/* Mapping between areas on the current page and images */
345#define POPPLER_TYPE_IMAGE_MAPPING (poppler_image_mapping_get_type())
346
347/**
348 * PopplerImageMapping:
349 * @area: a #PopplerRectangle representing an area of the page
350 * @image_id: an image identifier
351 *
352 * A #PopplerImageMapping structure represents the location
353 * of an image on the page
354 */
355struct _PopplerImageMapping
356{
357 PopplerRectangle area;
358 gint image_id;
359};
360
361POPPLER_PUBLIC
362GType poppler_image_mapping_get_type(void) G_GNUC_CONST;
363POPPLER_PUBLIC
364PopplerImageMapping *poppler_image_mapping_new(void);
365POPPLER_PUBLIC
366PopplerImageMapping *poppler_image_mapping_copy(PopplerImageMapping *mapping);
367POPPLER_PUBLIC
368void poppler_image_mapping_free(PopplerImageMapping *mapping);
369
370/* Mapping between areas on the current page and form fields */
371#define POPPLER_TYPE_FORM_FIELD_MAPPING (poppler_form_field_mapping_get_type())
372
373/**
374 * PopplerFormFieldMapping:
375 * @area: a #PopplerRectangle representing an area of the page
376 * @field: a #PopplerFormField
377 *
378 * A #PopplerFormFieldMapping structure represents the location
379 * of @field on the page
380 */
381struct _PopplerFormFieldMapping
382{
383 PopplerRectangle area;
384 PopplerFormField *field;
385};
386
387POPPLER_PUBLIC
388GType poppler_form_field_mapping_get_type(void) G_GNUC_CONST;
389POPPLER_PUBLIC
390PopplerFormFieldMapping *poppler_form_field_mapping_new(void);
391POPPLER_PUBLIC
392PopplerFormFieldMapping *poppler_form_field_mapping_copy(PopplerFormFieldMapping *mapping);
393POPPLER_PUBLIC
394void poppler_form_field_mapping_free(PopplerFormFieldMapping *mapping);
395
396/* Mapping between areas on the current page and annots */
397#define POPPLER_TYPE_ANNOT_MAPPING (poppler_annot_mapping_get_type())
398
399/**
400 * PopplerAnnotMapping:
401 * @area: a #PopplerRectangle representing an area of the page
402 * @annot: a #PopplerAnnot
403 *
404 * A #PopplerAnnotMapping structure represents the location
405 * of @annot on the page
406 */
407struct _PopplerAnnotMapping
408{
409 PopplerRectangle area;
410 PopplerAnnot *annot;
411};
412
413POPPLER_PUBLIC
414GType poppler_annot_mapping_get_type(void) G_GNUC_CONST;
415POPPLER_PUBLIC
416PopplerAnnotMapping *poppler_annot_mapping_new(void);
417POPPLER_PUBLIC
418PopplerAnnotMapping *poppler_annot_mapping_copy(PopplerAnnotMapping *mapping);
419POPPLER_PUBLIC
420void poppler_annot_mapping_free(PopplerAnnotMapping *mapping);
421
422G_END_DECLS
423
424#endif /* __POPPLER_PAGE_H__ */
425

source code of poppler/glib/poppler-page.h