1 /* poppler.h: glib interface to poppler
2  * Copyright (C) 2004, Red Hat, Inc.
3  * Copyright (C) 2021 André Guerreiro <aguerreiro1985@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef __POPPLER_GLIB_H__
21 #define __POPPLER_GLIB_H__
22 
23 #include <glib-object.h>
24 
25 #include "poppler-macros.h"
26 
27 G_BEGIN_DECLS
28 
29 POPPLER_PUBLIC
30 GQuark poppler_error_quark(void);
31 
32 #define POPPLER_ERROR poppler_error_quark()
33 
34 /**
35  * PopplerError:
36  * @POPPLER_ERROR_INVALID: Generic error when a document operation fails
37  * @POPPLER_ERROR_ENCRYPTED: Document is encrypted
38  * @POPPLER_ERROR_OPEN_FILE: File could not be opened for writing when saving document
39  * @POPPLER_ERROR_BAD_CATALOG: Failed to read the document catalog
40  * @POPPLER_ERROR_DAMAGED: Document is damaged
41  *
42  * Error codes returned by #PopplerDocument
43  */
44 typedef enum
45 {
46     POPPLER_ERROR_INVALID,
47     POPPLER_ERROR_ENCRYPTED,
48     POPPLER_ERROR_OPEN_FILE,
49     POPPLER_ERROR_BAD_CATALOG,
50     POPPLER_ERROR_DAMAGED
51 } PopplerError;
52 
53 /**
54  * PopplerPageTransitionType:
55  * @POPPLER_PAGE_TRANSITION_REPLACE: the new page replace the old one
56  * @POPPLER_PAGE_TRANSITION_SPLIT: two lines sweep across the screen, revealing the new page
57  * @POPPLER_PAGE_TRANSITION_BLINDS: multiple lines, evenly spaced across the screen, synchronously
58  * sweep in the same direction to reveal the new page
59  * @POPPLER_PAGE_TRANSITION_BOX: a rectangular box sweeps inward from the edges of the page or
60  * outward from the center revealing the new page
61  * @POPPLER_PAGE_TRANSITION_WIPE: a single line sweeps across the screen from one edge to the other
62  * revealing the new page
63  * @POPPLER_PAGE_TRANSITION_DISSOLVE: the old page dissolves gradually to reveal the new one
64  * @POPPLER_PAGE_TRANSITION_GLITTER: similar to #POPPLER_PAGE_TRANSITION_DISSOLVE, except that the effect
65  * sweeps across the page in a wide band moving from one side of the screen to the other
66  * @POPPLER_PAGE_TRANSITION_FLY: changes are flown out or in to or from a location that is offscreen
67  * @POPPLER_PAGE_TRANSITION_PUSH: the old page slides off the screen while the new page slides in
68  * @POPPLER_PAGE_TRANSITION_COVER: the new page slides on to the screen covering the old page
69  * @POPPLER_PAGE_TRANSITION_UNCOVER: the old page slides off the screen uncovering the new page
70  * @POPPLER_PAGE_TRANSITION_FADE: the new page gradually becomes visible through the old one
71  *
72  * Page transition types
73  */
74 typedef enum
75 {
76     POPPLER_PAGE_TRANSITION_REPLACE,
77     POPPLER_PAGE_TRANSITION_SPLIT,
78     POPPLER_PAGE_TRANSITION_BLINDS,
79     POPPLER_PAGE_TRANSITION_BOX,
80     POPPLER_PAGE_TRANSITION_WIPE,
81     POPPLER_PAGE_TRANSITION_DISSOLVE,
82     POPPLER_PAGE_TRANSITION_GLITTER,
83     POPPLER_PAGE_TRANSITION_FLY,
84     POPPLER_PAGE_TRANSITION_PUSH,
85     POPPLER_PAGE_TRANSITION_COVER,
86     POPPLER_PAGE_TRANSITION_UNCOVER,
87     POPPLER_PAGE_TRANSITION_FADE
88 } PopplerPageTransitionType;
89 
90 /**
91  * PopplerPageTransitionAlignment:
92  * @POPPLER_PAGE_TRANSITION_HORIZONTAL: horizontal dimension
93  * @POPPLER_PAGE_TRANSITION_VERTICAL: vertical dimension
94  *
95  * Page transition alignment types for #POPPLER_PAGE_TRANSITION_SPLIT
96  * and #POPPLER_PAGE_TRANSITION_BLINDS transition types
97  */
98 typedef enum
99 {
100     POPPLER_PAGE_TRANSITION_HORIZONTAL,
101     POPPLER_PAGE_TRANSITION_VERTICAL
102 } PopplerPageTransitionAlignment;
103 
104 /**
105  * PopplerPageTransitionDirection:
106  * @POPPLER_PAGE_TRANSITION_INWARD: inward from the edges of the page
107  * @POPPLER_PAGE_TRANSITION_OUTWARD: outward from the center of the page
108  *
109  * Page transition direction types for #POPPLER_PAGE_TRANSITION_SPLIT,
110  * #POPPLER_PAGE_TRANSITION_BOX and #POPPLER_PAGE_TRANSITION_FLY transition types
111  */
112 typedef enum
113 {
114     POPPLER_PAGE_TRANSITION_INWARD,
115     POPPLER_PAGE_TRANSITION_OUTWARD
116 } PopplerPageTransitionDirection;
117 
118 /**
119  * PopplerSelectionStyle:
120  * @POPPLER_SELECTION_GLYPH: glyph is the minimum unit for selection
121  * @POPPLER_SELECTION_WORD: word is the minimum unit for selection
122  * @POPPLER_SELECTION_LINE: line is the minimum unit for selection
123  *
124  * Selection styles
125  */
126 typedef enum
127 {
128     POPPLER_SELECTION_GLYPH,
129     POPPLER_SELECTION_WORD,
130     POPPLER_SELECTION_LINE
131 } PopplerSelectionStyle;
132 
133 /**
134  * PopplerPrintFlags:
135  * @POPPLER_PRINT_DOCUMENT: print main document contents
136  * @POPPLER_PRINT_MARKUP_ANNOTS: print document and markup annotations
137  * @POPPLER_PRINT_STAMP_ANNOTS_ONLY: print document and only stamp annotations
138  * @POPPLER_PRINT_ALL: print main document contents and all markup annotations
139  *
140  * Printing flags
141  *
142  * Since: 0.16
143  */
144 typedef enum /*< flags >*/
145 {
146     POPPLER_PRINT_DOCUMENT = 0,
147     POPPLER_PRINT_MARKUP_ANNOTS = 1 << 0,
148     POPPLER_PRINT_STAMP_ANNOTS_ONLY = 1 << 1,
149     POPPLER_PRINT_ALL = POPPLER_PRINT_MARKUP_ANNOTS
150 } PopplerPrintFlags;
151 
152 /**
153  * PopplerFindFlags:
154  * @POPPLER_FIND_DEFAULT: use default search settings
155  * @POPPLER_FIND_CASE_SENSITIVE: do case sensitive search
156  * @POPPLER_FIND_BACKWARDS: search backwards
157  * @POPPLER_FIND_WHOLE_WORDS_ONLY: search only whole words
158  * @POPPLER_FIND_IGNORE_DIACRITICS: do diacritics insensitive search,
159  * i.e. ignore accents, umlauts, diaeresis,etc. while matching. This
160  * option will be ignored if the search term is not pure ascii. Since 0.73.
161  * @POPPLER_FIND_MULTILINE: allows to match on text spanning from
162  * end of a line to the next line. (Currently it won't match on text spanning
163  * more than two lines.) Automatically ignores hyphen at end of line, and
164  * allows whitespace in search term to match on newline char. Since: 21.05.0.
165  *
166  * Flags using while searching text in a page
167  *
168  * Since: 0.22
169  */
170 typedef enum /*< flags >*/
171 {
172     POPPLER_FIND_DEFAULT = 0,
173     POPPLER_FIND_CASE_SENSITIVE = 1 << 0,
174     POPPLER_FIND_BACKWARDS = 1 << 1,
175     POPPLER_FIND_WHOLE_WORDS_ONLY = 1 << 2,
176     POPPLER_FIND_IGNORE_DIACRITICS = 1 << 3,
177     POPPLER_FIND_MULTILINE = 1 << 4
178 } PopplerFindFlags;
179 
180 typedef struct _PopplerDocument PopplerDocument;
181 typedef struct _PopplerIndexIter PopplerIndexIter;
182 typedef struct _PopplerFontsIter PopplerFontsIter;
183 typedef struct _PopplerLayersIter PopplerLayersIter;
184 typedef struct _PopplerPoint PopplerPoint;
185 typedef struct _PopplerRectangle PopplerRectangle;
186 typedef struct _PopplerTextAttributes PopplerTextAttributes;
187 typedef struct _PopplerColor PopplerColor;
188 typedef struct _PopplerLinkMapping PopplerLinkMapping;
189 typedef struct _PopplerPageTransition PopplerPageTransition;
190 typedef struct _PopplerImageMapping PopplerImageMapping;
191 typedef struct _PopplerFormFieldMapping PopplerFormFieldMapping;
192 typedef struct _PopplerAnnotMapping PopplerAnnotMapping;
193 typedef struct _PopplerPage PopplerPage;
194 typedef struct _PopplerFontInfo PopplerFontInfo;
195 typedef struct _PopplerLayer PopplerLayer;
196 typedef struct _PopplerPSFile PopplerPSFile;
197 typedef union _PopplerAction PopplerAction;
198 typedef struct _PopplerDest PopplerDest;
199 typedef struct _PopplerActionLayer PopplerActionLayer;
200 typedef struct _PopplerFormField PopplerFormField;
201 typedef struct _PopplerAttachment PopplerAttachment;
202 typedef struct _PopplerMovie PopplerMovie;
203 typedef struct _PopplerMedia PopplerMedia;
204 typedef struct _PopplerAnnot PopplerAnnot;
205 typedef struct _PopplerAnnotMarkup PopplerAnnotMarkup;
206 typedef struct _PopplerAnnotText PopplerAnnotText;
207 typedef struct _PopplerAnnotTextMarkup PopplerAnnotTextMarkup;
208 typedef struct _PopplerAnnotFreeText PopplerAnnotFreeText;
209 typedef struct _PopplerAnnotFileAttachment PopplerAnnotFileAttachment;
210 typedef struct _PopplerAnnotMovie PopplerAnnotMovie;
211 typedef struct _PopplerAnnotScreen PopplerAnnotScreen;
212 typedef struct _PopplerAnnotCalloutLine PopplerAnnotCalloutLine;
213 typedef struct _PopplerAnnotLine PopplerAnnotLine;
214 typedef struct _PopplerAnnotCircle PopplerAnnotCircle;
215 typedef struct _PopplerAnnotSquare PopplerAnnotSquare;
216 typedef struct _PopplerQuadrilateral PopplerQuadrilateral;
217 typedef struct _PopplerStructureElement PopplerStructureElement;
218 typedef struct _PopplerStructureElementIter PopplerStructureElementIter;
219 typedef struct _PopplerTextSpan PopplerTextSpan;
220 typedef struct _PopplerPageRange PopplerPageRange;
221 typedef struct _PopplerSignatureInfo PopplerSignatureInfo;
222 
223 /**
224  * PopplerBackend:
225  * @POPPLER_BACKEND_UNKNOWN: Unknown backend
226  * @POPPLER_BACKEND_SPLASH: Splash backend
227  * @POPPLER_BACKEND_CAIRO: Cairo backend
228  *
229  * Backend codes returned by poppler_get_backend().
230  */
231 typedef enum
232 {
233     POPPLER_BACKEND_UNKNOWN,
234     POPPLER_BACKEND_SPLASH,
235     POPPLER_BACKEND_CAIRO
236 } PopplerBackend;
237 
238 POPPLER_PUBLIC
239 PopplerBackend poppler_get_backend(void);
240 POPPLER_PUBLIC
241 const char *poppler_get_version(void);
242 
243 G_END_DECLS
244 
245 #include "poppler-features.h"
246 #include "poppler-document.h"
247 #include "poppler-page.h"
248 #include "poppler-layer.h"
249 #include "poppler-action.h"
250 #include "poppler-form-field.h"
251 #include "poppler-enums.h"
252 #include "poppler-attachment.h"
253 #include "poppler-annot.h"
254 #include "poppler-date.h"
255 #include "poppler-movie.h"
256 #include "poppler-media.h"
257 #include "poppler-structure-element.h"
258 
259 #endif /* __POPPLER_GLIB_H__ */
260