xref: /aosp_15_r20/external/pdfium/public/fpdf_doc.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1*3ac0a46fSAndroid Build Coastguard Worker // Copyright 2014 The PDFium Authors
2*3ac0a46fSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*3ac0a46fSAndroid Build Coastguard Worker // found in the LICENSE file.
4*3ac0a46fSAndroid Build Coastguard Worker 
5*3ac0a46fSAndroid Build Coastguard Worker // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6*3ac0a46fSAndroid Build Coastguard Worker 
7*3ac0a46fSAndroid Build Coastguard Worker #ifndef PUBLIC_FPDF_DOC_H_
8*3ac0a46fSAndroid Build Coastguard Worker #define PUBLIC_FPDF_DOC_H_
9*3ac0a46fSAndroid Build Coastguard Worker 
10*3ac0a46fSAndroid Build Coastguard Worker // NOLINTNEXTLINE(build/include)
11*3ac0a46fSAndroid Build Coastguard Worker #include "fpdfview.h"
12*3ac0a46fSAndroid Build Coastguard Worker 
13*3ac0a46fSAndroid Build Coastguard Worker #ifdef __cplusplus
14*3ac0a46fSAndroid Build Coastguard Worker extern "C" {
15*3ac0a46fSAndroid Build Coastguard Worker #endif  // __cplusplus
16*3ac0a46fSAndroid Build Coastguard Worker 
17*3ac0a46fSAndroid Build Coastguard Worker // Unsupported action type.
18*3ac0a46fSAndroid Build Coastguard Worker #define PDFACTION_UNSUPPORTED 0
19*3ac0a46fSAndroid Build Coastguard Worker // Go to a destination within current document.
20*3ac0a46fSAndroid Build Coastguard Worker #define PDFACTION_GOTO 1
21*3ac0a46fSAndroid Build Coastguard Worker // Go to a destination within another document.
22*3ac0a46fSAndroid Build Coastguard Worker #define PDFACTION_REMOTEGOTO 2
23*3ac0a46fSAndroid Build Coastguard Worker // URI, including web pages and other Internet resources.
24*3ac0a46fSAndroid Build Coastguard Worker #define PDFACTION_URI 3
25*3ac0a46fSAndroid Build Coastguard Worker // Launch an application or open a file.
26*3ac0a46fSAndroid Build Coastguard Worker #define PDFACTION_LAUNCH 4
27*3ac0a46fSAndroid Build Coastguard Worker // Go to a destination in an embedded file.
28*3ac0a46fSAndroid Build Coastguard Worker #define PDFACTION_EMBEDDEDGOTO 5
29*3ac0a46fSAndroid Build Coastguard Worker 
30*3ac0a46fSAndroid Build Coastguard Worker // View destination fit types. See pdfmark reference v9, page 48.
31*3ac0a46fSAndroid Build Coastguard Worker #define PDFDEST_VIEW_UNKNOWN_MODE 0
32*3ac0a46fSAndroid Build Coastguard Worker #define PDFDEST_VIEW_XYZ 1
33*3ac0a46fSAndroid Build Coastguard Worker #define PDFDEST_VIEW_FIT 2
34*3ac0a46fSAndroid Build Coastguard Worker #define PDFDEST_VIEW_FITH 3
35*3ac0a46fSAndroid Build Coastguard Worker #define PDFDEST_VIEW_FITV 4
36*3ac0a46fSAndroid Build Coastguard Worker #define PDFDEST_VIEW_FITR 5
37*3ac0a46fSAndroid Build Coastguard Worker #define PDFDEST_VIEW_FITB 6
38*3ac0a46fSAndroid Build Coastguard Worker #define PDFDEST_VIEW_FITBH 7
39*3ac0a46fSAndroid Build Coastguard Worker #define PDFDEST_VIEW_FITBV 8
40*3ac0a46fSAndroid Build Coastguard Worker 
41*3ac0a46fSAndroid Build Coastguard Worker // The file identifier entry type. See section 14.4 "File Identifiers" of the
42*3ac0a46fSAndroid Build Coastguard Worker // ISO 32000-1:2008 spec.
43*3ac0a46fSAndroid Build Coastguard Worker typedef enum {
44*3ac0a46fSAndroid Build Coastguard Worker   FILEIDTYPE_PERMANENT = 0,
45*3ac0a46fSAndroid Build Coastguard Worker   FILEIDTYPE_CHANGING = 1
46*3ac0a46fSAndroid Build Coastguard Worker } FPDF_FILEIDTYPE;
47*3ac0a46fSAndroid Build Coastguard Worker 
48*3ac0a46fSAndroid Build Coastguard Worker // Get the first child of |bookmark|, or the first top-level bookmark item.
49*3ac0a46fSAndroid Build Coastguard Worker //
50*3ac0a46fSAndroid Build Coastguard Worker //   document - handle to the document.
51*3ac0a46fSAndroid Build Coastguard Worker //   bookmark - handle to the current bookmark. Pass NULL for the first top
52*3ac0a46fSAndroid Build Coastguard Worker //              level item.
53*3ac0a46fSAndroid Build Coastguard Worker //
54*3ac0a46fSAndroid Build Coastguard Worker // Returns a handle to the first child of |bookmark| or the first top-level
55*3ac0a46fSAndroid Build Coastguard Worker // bookmark item. NULL if no child or top-level bookmark found.
56*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
57*3ac0a46fSAndroid Build Coastguard Worker FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
58*3ac0a46fSAndroid Build Coastguard Worker 
59*3ac0a46fSAndroid Build Coastguard Worker // Get the next sibling of |bookmark|.
60*3ac0a46fSAndroid Build Coastguard Worker //
61*3ac0a46fSAndroid Build Coastguard Worker //   document - handle to the document.
62*3ac0a46fSAndroid Build Coastguard Worker //   bookmark - handle to the current bookmark.
63*3ac0a46fSAndroid Build Coastguard Worker //
64*3ac0a46fSAndroid Build Coastguard Worker // Returns a handle to the next sibling of |bookmark|, or NULL if this is the
65*3ac0a46fSAndroid Build Coastguard Worker // last bookmark at this level.
66*3ac0a46fSAndroid Build Coastguard Worker //
67*3ac0a46fSAndroid Build Coastguard Worker // Note that the caller is responsible for handling circular bookmark
68*3ac0a46fSAndroid Build Coastguard Worker // references, as may arise from malformed documents.
69*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
70*3ac0a46fSAndroid Build Coastguard Worker FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
71*3ac0a46fSAndroid Build Coastguard Worker 
72*3ac0a46fSAndroid Build Coastguard Worker // Get the title of |bookmark|.
73*3ac0a46fSAndroid Build Coastguard Worker //
74*3ac0a46fSAndroid Build Coastguard Worker //   bookmark - handle to the bookmark.
75*3ac0a46fSAndroid Build Coastguard Worker //   buffer   - buffer for the title. May be NULL.
76*3ac0a46fSAndroid Build Coastguard Worker //   buflen   - the length of the buffer in bytes. May be 0.
77*3ac0a46fSAndroid Build Coastguard Worker //
78*3ac0a46fSAndroid Build Coastguard Worker // Returns the number of bytes in the title, including the terminating NUL
79*3ac0a46fSAndroid Build Coastguard Worker // character. The number of bytes is returned regardless of the |buffer| and
80*3ac0a46fSAndroid Build Coastguard Worker // |buflen| parameters.
81*3ac0a46fSAndroid Build Coastguard Worker //
82*3ac0a46fSAndroid Build Coastguard Worker // Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The
83*3ac0a46fSAndroid Build Coastguard Worker // string is terminated by a UTF16 NUL character. If |buflen| is less than the
84*3ac0a46fSAndroid Build Coastguard Worker // required length, or |buffer| is NULL, |buffer| will not be modified.
85*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT unsigned long FPDF_CALLCONV
86*3ac0a46fSAndroid Build Coastguard Worker FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark,
87*3ac0a46fSAndroid Build Coastguard Worker                       void* buffer,
88*3ac0a46fSAndroid Build Coastguard Worker                       unsigned long buflen);
89*3ac0a46fSAndroid Build Coastguard Worker 
90*3ac0a46fSAndroid Build Coastguard Worker // Experimental API.
91*3ac0a46fSAndroid Build Coastguard Worker // Get the number of chlidren of |bookmark|.
92*3ac0a46fSAndroid Build Coastguard Worker //
93*3ac0a46fSAndroid Build Coastguard Worker //   bookmark - handle to the bookmark.
94*3ac0a46fSAndroid Build Coastguard Worker //
95*3ac0a46fSAndroid Build Coastguard Worker // Returns a signed integer that represents the number of sub-items the given
96*3ac0a46fSAndroid Build Coastguard Worker // bookmark has. If the value is positive, child items shall be shown by default
97*3ac0a46fSAndroid Build Coastguard Worker // (open state). If the value is negative, child items shall be hidden by
98*3ac0a46fSAndroid Build Coastguard Worker // default (closed state). Please refer to PDF 32000-1:2008, Table 153.
99*3ac0a46fSAndroid Build Coastguard Worker // Returns 0 if the bookmark has no children or is invalid.
100*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT int FPDF_CALLCONV FPDFBookmark_GetCount(FPDF_BOOKMARK bookmark);
101*3ac0a46fSAndroid Build Coastguard Worker 
102*3ac0a46fSAndroid Build Coastguard Worker // Find the bookmark with |title| in |document|.
103*3ac0a46fSAndroid Build Coastguard Worker //
104*3ac0a46fSAndroid Build Coastguard Worker //   document - handle to the document.
105*3ac0a46fSAndroid Build Coastguard Worker //   title    - the UTF-16LE encoded Unicode title for which to search.
106*3ac0a46fSAndroid Build Coastguard Worker //
107*3ac0a46fSAndroid Build Coastguard Worker // Returns the handle to the bookmark, or NULL if |title| can't be found.
108*3ac0a46fSAndroid Build Coastguard Worker //
109*3ac0a46fSAndroid Build Coastguard Worker // FPDFBookmark_Find() will always return the first bookmark found even if
110*3ac0a46fSAndroid Build Coastguard Worker // multiple bookmarks have the same |title|.
111*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
112*3ac0a46fSAndroid Build Coastguard Worker FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title);
113*3ac0a46fSAndroid Build Coastguard Worker 
114*3ac0a46fSAndroid Build Coastguard Worker // Get the destination associated with |bookmark|.
115*3ac0a46fSAndroid Build Coastguard Worker //
116*3ac0a46fSAndroid Build Coastguard Worker //   document - handle to the document.
117*3ac0a46fSAndroid Build Coastguard Worker //   bookmark - handle to the bookmark.
118*3ac0a46fSAndroid Build Coastguard Worker //
119*3ac0a46fSAndroid Build Coastguard Worker // Returns the handle to the destination data, or NULL if no destination is
120*3ac0a46fSAndroid Build Coastguard Worker // associated with |bookmark|.
121*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_DEST FPDF_CALLCONV
122*3ac0a46fSAndroid Build Coastguard Worker FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
123*3ac0a46fSAndroid Build Coastguard Worker 
124*3ac0a46fSAndroid Build Coastguard Worker // Get the action associated with |bookmark|.
125*3ac0a46fSAndroid Build Coastguard Worker //
126*3ac0a46fSAndroid Build Coastguard Worker //   bookmark - handle to the bookmark.
127*3ac0a46fSAndroid Build Coastguard Worker //
128*3ac0a46fSAndroid Build Coastguard Worker // Returns the handle to the action data, or NULL if no action is associated
129*3ac0a46fSAndroid Build Coastguard Worker // with |bookmark|.
130*3ac0a46fSAndroid Build Coastguard Worker // If this function returns a valid handle, it is valid as long as |bookmark| is
131*3ac0a46fSAndroid Build Coastguard Worker // valid.
132*3ac0a46fSAndroid Build Coastguard Worker // If this function returns NULL, FPDFBookmark_GetDest() should be called to get
133*3ac0a46fSAndroid Build Coastguard Worker // the |bookmark| destination data.
134*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV
135*3ac0a46fSAndroid Build Coastguard Worker FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);
136*3ac0a46fSAndroid Build Coastguard Worker 
137*3ac0a46fSAndroid Build Coastguard Worker // Get the type of |action|.
138*3ac0a46fSAndroid Build Coastguard Worker //
139*3ac0a46fSAndroid Build Coastguard Worker //   action - handle to the action.
140*3ac0a46fSAndroid Build Coastguard Worker //
141*3ac0a46fSAndroid Build Coastguard Worker // Returns one of:
142*3ac0a46fSAndroid Build Coastguard Worker //   PDFACTION_UNSUPPORTED
143*3ac0a46fSAndroid Build Coastguard Worker //   PDFACTION_GOTO
144*3ac0a46fSAndroid Build Coastguard Worker //   PDFACTION_REMOTEGOTO
145*3ac0a46fSAndroid Build Coastguard Worker //   PDFACTION_URI
146*3ac0a46fSAndroid Build Coastguard Worker //   PDFACTION_LAUNCH
147*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION action);
148*3ac0a46fSAndroid Build Coastguard Worker 
149*3ac0a46fSAndroid Build Coastguard Worker // Get the destination of |action|.
150*3ac0a46fSAndroid Build Coastguard Worker //
151*3ac0a46fSAndroid Build Coastguard Worker //   document - handle to the document.
152*3ac0a46fSAndroid Build Coastguard Worker //   action   - handle to the action. |action| must be a |PDFACTION_GOTO| or
153*3ac0a46fSAndroid Build Coastguard Worker //              |PDFACTION_REMOTEGOTO|.
154*3ac0a46fSAndroid Build Coastguard Worker //
155*3ac0a46fSAndroid Build Coastguard Worker // Returns a handle to the destination data, or NULL on error, typically
156*3ac0a46fSAndroid Build Coastguard Worker // because the arguments were bad or the action was of the wrong type.
157*3ac0a46fSAndroid Build Coastguard Worker //
158*3ac0a46fSAndroid Build Coastguard Worker // In the case of |PDFACTION_REMOTEGOTO|, you must first call
159*3ac0a46fSAndroid Build Coastguard Worker // FPDFAction_GetFilePath(), then load the document at that path, then pass
160*3ac0a46fSAndroid Build Coastguard Worker // the document handle from that document as |document| to FPDFAction_GetDest().
161*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document,
162*3ac0a46fSAndroid Build Coastguard Worker                                                        FPDF_ACTION action);
163*3ac0a46fSAndroid Build Coastguard Worker 
164*3ac0a46fSAndroid Build Coastguard Worker // Get the file path of |action|.
165*3ac0a46fSAndroid Build Coastguard Worker //
166*3ac0a46fSAndroid Build Coastguard Worker //   action - handle to the action. |action| must be a |PDFACTION_LAUNCH| or
167*3ac0a46fSAndroid Build Coastguard Worker //            |PDFACTION_REMOTEGOTO|.
168*3ac0a46fSAndroid Build Coastguard Worker //   buffer - a buffer for output the path string. May be NULL.
169*3ac0a46fSAndroid Build Coastguard Worker //   buflen - the length of the buffer, in bytes. May be 0.
170*3ac0a46fSAndroid Build Coastguard Worker //
171*3ac0a46fSAndroid Build Coastguard Worker // Returns the number of bytes in the file path, including the trailing NUL
172*3ac0a46fSAndroid Build Coastguard Worker // character, or 0 on error, typically because the arguments were bad or the
173*3ac0a46fSAndroid Build Coastguard Worker // action was of the wrong type.
174*3ac0a46fSAndroid Build Coastguard Worker //
175*3ac0a46fSAndroid Build Coastguard Worker // Regardless of the platform, the |buffer| is always in UTF-8 encoding.
176*3ac0a46fSAndroid Build Coastguard Worker // If |buflen| is less than the returned length, or |buffer| is NULL, |buffer|
177*3ac0a46fSAndroid Build Coastguard Worker // will not be modified.
178*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT unsigned long FPDF_CALLCONV
179*3ac0a46fSAndroid Build Coastguard Worker FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen);
180*3ac0a46fSAndroid Build Coastguard Worker 
181*3ac0a46fSAndroid Build Coastguard Worker // Get the URI path of |action|.
182*3ac0a46fSAndroid Build Coastguard Worker //
183*3ac0a46fSAndroid Build Coastguard Worker //   document - handle to the document.
184*3ac0a46fSAndroid Build Coastguard Worker //   action   - handle to the action. Must be a |PDFACTION_URI|.
185*3ac0a46fSAndroid Build Coastguard Worker //   buffer   - a buffer for the path string. May be NULL.
186*3ac0a46fSAndroid Build Coastguard Worker //   buflen   - the length of the buffer, in bytes. May be 0.
187*3ac0a46fSAndroid Build Coastguard Worker //
188*3ac0a46fSAndroid Build Coastguard Worker // Returns the number of bytes in the URI path, including the trailing NUL
189*3ac0a46fSAndroid Build Coastguard Worker // character, or 0 on error, typically because the arguments were bad or the
190*3ac0a46fSAndroid Build Coastguard Worker // action was of the wrong type.
191*3ac0a46fSAndroid Build Coastguard Worker //
192*3ac0a46fSAndroid Build Coastguard Worker // The |buffer| may contain badly encoded data. The caller should validate the
193*3ac0a46fSAndroid Build Coastguard Worker // output. e.g. Check to see if it is UTF-8.
194*3ac0a46fSAndroid Build Coastguard Worker //
195*3ac0a46fSAndroid Build Coastguard Worker // If |buflen| is less than the returned length, or |buffer| is NULL, |buffer|
196*3ac0a46fSAndroid Build Coastguard Worker // will not be modified.
197*3ac0a46fSAndroid Build Coastguard Worker //
198*3ac0a46fSAndroid Build Coastguard Worker // Historically, the documentation for this API claimed |buffer| is always
199*3ac0a46fSAndroid Build Coastguard Worker // encoded in 7-bit ASCII, but did not actually enforce it.
200*3ac0a46fSAndroid Build Coastguard Worker // https://pdfium.googlesource.com/pdfium.git/+/d609e84cee2e14a18333247485af91df48a40592
201*3ac0a46fSAndroid Build Coastguard Worker // added that enforcement, but that did not work well for real world PDFs that
202*3ac0a46fSAndroid Build Coastguard Worker // used UTF-8. As of this writing, this API reverted back to its original
203*3ac0a46fSAndroid Build Coastguard Worker // behavior prior to commit d609e84cee.
204*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT unsigned long FPDF_CALLCONV
205*3ac0a46fSAndroid Build Coastguard Worker FPDFAction_GetURIPath(FPDF_DOCUMENT document,
206*3ac0a46fSAndroid Build Coastguard Worker                       FPDF_ACTION action,
207*3ac0a46fSAndroid Build Coastguard Worker                       void* buffer,
208*3ac0a46fSAndroid Build Coastguard Worker                       unsigned long buflen);
209*3ac0a46fSAndroid Build Coastguard Worker 
210*3ac0a46fSAndroid Build Coastguard Worker // Get the page index of |dest|.
211*3ac0a46fSAndroid Build Coastguard Worker //
212*3ac0a46fSAndroid Build Coastguard Worker //   document - handle to the document.
213*3ac0a46fSAndroid Build Coastguard Worker //   dest     - handle to the destination.
214*3ac0a46fSAndroid Build Coastguard Worker //
215*3ac0a46fSAndroid Build Coastguard Worker // Returns the 0-based page index containing |dest|. Returns -1 on error.
216*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT int FPDF_CALLCONV FPDFDest_GetDestPageIndex(FPDF_DOCUMENT document,
217*3ac0a46fSAndroid Build Coastguard Worker                                                         FPDF_DEST dest);
218*3ac0a46fSAndroid Build Coastguard Worker 
219*3ac0a46fSAndroid Build Coastguard Worker // Experimental API.
220*3ac0a46fSAndroid Build Coastguard Worker // Get the view (fit type) specified by |dest|.
221*3ac0a46fSAndroid Build Coastguard Worker //
222*3ac0a46fSAndroid Build Coastguard Worker //   dest         - handle to the destination.
223*3ac0a46fSAndroid Build Coastguard Worker //   pNumParams   - receives the number of view parameters, which is at most 4.
224*3ac0a46fSAndroid Build Coastguard Worker //   pParams      - buffer to write the view parameters. Must be at least 4
225*3ac0a46fSAndroid Build Coastguard Worker //                  FS_FLOATs long.
226*3ac0a46fSAndroid Build Coastguard Worker // Returns one of the PDFDEST_VIEW_* constants, PDFDEST_VIEW_UNKNOWN_MODE if
227*3ac0a46fSAndroid Build Coastguard Worker // |dest| does not specify a view.
228*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT unsigned long FPDF_CALLCONV
229*3ac0a46fSAndroid Build Coastguard Worker FPDFDest_GetView(FPDF_DEST dest, unsigned long* pNumParams, FS_FLOAT* pParams);
230*3ac0a46fSAndroid Build Coastguard Worker 
231*3ac0a46fSAndroid Build Coastguard Worker // Get the (x, y, zoom) location of |dest| in the destination page, if the
232*3ac0a46fSAndroid Build Coastguard Worker // destination is in [page /XYZ x y zoom] syntax.
233*3ac0a46fSAndroid Build Coastguard Worker //
234*3ac0a46fSAndroid Build Coastguard Worker //   dest       - handle to the destination.
235*3ac0a46fSAndroid Build Coastguard Worker //   hasXVal    - out parameter; true if the x value is not null
236*3ac0a46fSAndroid Build Coastguard Worker //   hasYVal    - out parameter; true if the y value is not null
237*3ac0a46fSAndroid Build Coastguard Worker //   hasZoomVal - out parameter; true if the zoom value is not null
238*3ac0a46fSAndroid Build Coastguard Worker //   x          - out parameter; the x coordinate, in page coordinates.
239*3ac0a46fSAndroid Build Coastguard Worker //   y          - out parameter; the y coordinate, in page coordinates.
240*3ac0a46fSAndroid Build Coastguard Worker //   zoom       - out parameter; the zoom value.
241*3ac0a46fSAndroid Build Coastguard Worker // Returns TRUE on successfully reading the /XYZ value.
242*3ac0a46fSAndroid Build Coastguard Worker //
243*3ac0a46fSAndroid Build Coastguard Worker // Note the [x, y, zoom] values are only set if the corresponding hasXVal,
244*3ac0a46fSAndroid Build Coastguard Worker // hasYVal or hasZoomVal flags are true.
245*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
246*3ac0a46fSAndroid Build Coastguard Worker FPDFDest_GetLocationInPage(FPDF_DEST dest,
247*3ac0a46fSAndroid Build Coastguard Worker                            FPDF_BOOL* hasXVal,
248*3ac0a46fSAndroid Build Coastguard Worker                            FPDF_BOOL* hasYVal,
249*3ac0a46fSAndroid Build Coastguard Worker                            FPDF_BOOL* hasZoomVal,
250*3ac0a46fSAndroid Build Coastguard Worker                            FS_FLOAT* x,
251*3ac0a46fSAndroid Build Coastguard Worker                            FS_FLOAT* y,
252*3ac0a46fSAndroid Build Coastguard Worker                            FS_FLOAT* zoom);
253*3ac0a46fSAndroid Build Coastguard Worker 
254*3ac0a46fSAndroid Build Coastguard Worker // Find a link at point (|x|,|y|) on |page|.
255*3ac0a46fSAndroid Build Coastguard Worker //
256*3ac0a46fSAndroid Build Coastguard Worker //   page - handle to the document page.
257*3ac0a46fSAndroid Build Coastguard Worker //   x    - the x coordinate, in the page coordinate system.
258*3ac0a46fSAndroid Build Coastguard Worker //   y    - the y coordinate, in the page coordinate system.
259*3ac0a46fSAndroid Build Coastguard Worker //
260*3ac0a46fSAndroid Build Coastguard Worker // Returns a handle to the link, or NULL if no link found at the given point.
261*3ac0a46fSAndroid Build Coastguard Worker //
262*3ac0a46fSAndroid Build Coastguard Worker // You can convert coordinates from screen coordinates to page coordinates using
263*3ac0a46fSAndroid Build Coastguard Worker // FPDF_DeviceToPage().
264*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_LINK FPDF_CALLCONV FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
265*3ac0a46fSAndroid Build Coastguard Worker                                                             double x,
266*3ac0a46fSAndroid Build Coastguard Worker                                                             double y);
267*3ac0a46fSAndroid Build Coastguard Worker 
268*3ac0a46fSAndroid Build Coastguard Worker // Find the Z-order of link at point (|x|,|y|) on |page|.
269*3ac0a46fSAndroid Build Coastguard Worker //
270*3ac0a46fSAndroid Build Coastguard Worker //   page - handle to the document page.
271*3ac0a46fSAndroid Build Coastguard Worker //   x    - the x coordinate, in the page coordinate system.
272*3ac0a46fSAndroid Build Coastguard Worker //   y    - the y coordinate, in the page coordinate system.
273*3ac0a46fSAndroid Build Coastguard Worker //
274*3ac0a46fSAndroid Build Coastguard Worker // Returns the Z-order of the link, or -1 if no link found at the given point.
275*3ac0a46fSAndroid Build Coastguard Worker // Larger Z-order numbers are closer to the front.
276*3ac0a46fSAndroid Build Coastguard Worker //
277*3ac0a46fSAndroid Build Coastguard Worker // You can convert coordinates from screen coordinates to page coordinates using
278*3ac0a46fSAndroid Build Coastguard Worker // FPDF_DeviceToPage().
279*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page,
280*3ac0a46fSAndroid Build Coastguard Worker                                                             double x,
281*3ac0a46fSAndroid Build Coastguard Worker                                                             double y);
282*3ac0a46fSAndroid Build Coastguard Worker 
283*3ac0a46fSAndroid Build Coastguard Worker // Get destination info for |link|.
284*3ac0a46fSAndroid Build Coastguard Worker //
285*3ac0a46fSAndroid Build Coastguard Worker //   document - handle to the document.
286*3ac0a46fSAndroid Build Coastguard Worker //   link     - handle to the link.
287*3ac0a46fSAndroid Build Coastguard Worker //
288*3ac0a46fSAndroid Build Coastguard Worker // Returns a handle to the destination, or NULL if there is no destination
289*3ac0a46fSAndroid Build Coastguard Worker // associated with the link. In this case, you should call FPDFLink_GetAction()
290*3ac0a46fSAndroid Build Coastguard Worker // to retrieve the action associated with |link|.
291*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document,
292*3ac0a46fSAndroid Build Coastguard Worker                                                      FPDF_LINK link);
293*3ac0a46fSAndroid Build Coastguard Worker 
294*3ac0a46fSAndroid Build Coastguard Worker // Get action info for |link|.
295*3ac0a46fSAndroid Build Coastguard Worker //
296*3ac0a46fSAndroid Build Coastguard Worker //   link - handle to the link.
297*3ac0a46fSAndroid Build Coastguard Worker //
298*3ac0a46fSAndroid Build Coastguard Worker // Returns a handle to the action associated to |link|, or NULL if no action.
299*3ac0a46fSAndroid Build Coastguard Worker // If this function returns a valid handle, it is valid as long as |link| is
300*3ac0a46fSAndroid Build Coastguard Worker // valid.
301*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK link);
302*3ac0a46fSAndroid Build Coastguard Worker 
303*3ac0a46fSAndroid Build Coastguard Worker // Enumerates all the link annotations in |page|.
304*3ac0a46fSAndroid Build Coastguard Worker //
305*3ac0a46fSAndroid Build Coastguard Worker //   page       - handle to the page.
306*3ac0a46fSAndroid Build Coastguard Worker //   start_pos  - the start position, should initially be 0 and is updated with
307*3ac0a46fSAndroid Build Coastguard Worker //                the next start position on return.
308*3ac0a46fSAndroid Build Coastguard Worker //   link_annot - the link handle for |startPos|.
309*3ac0a46fSAndroid Build Coastguard Worker //
310*3ac0a46fSAndroid Build Coastguard Worker // Returns TRUE on success.
311*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_Enumerate(FPDF_PAGE page,
312*3ac0a46fSAndroid Build Coastguard Worker                                                        int* start_pos,
313*3ac0a46fSAndroid Build Coastguard Worker                                                        FPDF_LINK* link_annot);
314*3ac0a46fSAndroid Build Coastguard Worker 
315*3ac0a46fSAndroid Build Coastguard Worker // Experimental API.
316*3ac0a46fSAndroid Build Coastguard Worker // Gets FPDF_ANNOTATION object for |link_annot|.
317*3ac0a46fSAndroid Build Coastguard Worker //
318*3ac0a46fSAndroid Build Coastguard Worker //   page       - handle to the page in which FPDF_LINK object is present.
319*3ac0a46fSAndroid Build Coastguard Worker //   link_annot - handle to link annotation.
320*3ac0a46fSAndroid Build Coastguard Worker //
321*3ac0a46fSAndroid Build Coastguard Worker // Returns FPDF_ANNOTATION from the FPDF_LINK and NULL on failure,
322*3ac0a46fSAndroid Build Coastguard Worker // if the input link annot or page is NULL.
323*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV
324*3ac0a46fSAndroid Build Coastguard Worker FPDFLink_GetAnnot(FPDF_PAGE page, FPDF_LINK link_annot);
325*3ac0a46fSAndroid Build Coastguard Worker 
326*3ac0a46fSAndroid Build Coastguard Worker // Get the rectangle for |link_annot|.
327*3ac0a46fSAndroid Build Coastguard Worker //
328*3ac0a46fSAndroid Build Coastguard Worker //   link_annot - handle to the link annotation.
329*3ac0a46fSAndroid Build Coastguard Worker //   rect       - the annotation rectangle.
330*3ac0a46fSAndroid Build Coastguard Worker //
331*3ac0a46fSAndroid Build Coastguard Worker // Returns true on success.
332*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetAnnotRect(FPDF_LINK link_annot,
333*3ac0a46fSAndroid Build Coastguard Worker                                                           FS_RECTF* rect);
334*3ac0a46fSAndroid Build Coastguard Worker 
335*3ac0a46fSAndroid Build Coastguard Worker // Get the count of quadrilateral points to the |link_annot|.
336*3ac0a46fSAndroid Build Coastguard Worker //
337*3ac0a46fSAndroid Build Coastguard Worker //   link_annot - handle to the link annotation.
338*3ac0a46fSAndroid Build Coastguard Worker //
339*3ac0a46fSAndroid Build Coastguard Worker // Returns the count of quadrilateral points.
340*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountQuadPoints(FPDF_LINK link_annot);
341*3ac0a46fSAndroid Build Coastguard Worker 
342*3ac0a46fSAndroid Build Coastguard Worker // Get the quadrilateral points for the specified |quad_index| in |link_annot|.
343*3ac0a46fSAndroid Build Coastguard Worker //
344*3ac0a46fSAndroid Build Coastguard Worker //   link_annot  - handle to the link annotation.
345*3ac0a46fSAndroid Build Coastguard Worker //   quad_index  - the specified quad point index.
346*3ac0a46fSAndroid Build Coastguard Worker //   quad_points - receives the quadrilateral points.
347*3ac0a46fSAndroid Build Coastguard Worker //
348*3ac0a46fSAndroid Build Coastguard Worker // Returns true on success.
349*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
350*3ac0a46fSAndroid Build Coastguard Worker FPDFLink_GetQuadPoints(FPDF_LINK link_annot,
351*3ac0a46fSAndroid Build Coastguard Worker                        int quad_index,
352*3ac0a46fSAndroid Build Coastguard Worker                        FS_QUADPOINTSF* quad_points);
353*3ac0a46fSAndroid Build Coastguard Worker 
354*3ac0a46fSAndroid Build Coastguard Worker // Experimental API
355*3ac0a46fSAndroid Build Coastguard Worker // Gets an additional-action from |page|.
356*3ac0a46fSAndroid Build Coastguard Worker //
357*3ac0a46fSAndroid Build Coastguard Worker //   page      - handle to the page, as returned by FPDF_LoadPage().
358*3ac0a46fSAndroid Build Coastguard Worker //   aa_type   - the type of the page object's addtional-action, defined
359*3ac0a46fSAndroid Build Coastguard Worker //               in public/fpdf_formfill.h
360*3ac0a46fSAndroid Build Coastguard Worker //
361*3ac0a46fSAndroid Build Coastguard Worker //   Returns the handle to the action data, or NULL if there is no
362*3ac0a46fSAndroid Build Coastguard Worker //   additional-action of type |aa_type|.
363*3ac0a46fSAndroid Build Coastguard Worker //   If this function returns a valid handle, it is valid as long as |page| is
364*3ac0a46fSAndroid Build Coastguard Worker //   valid.
365*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDF_GetPageAAction(FPDF_PAGE page,
366*3ac0a46fSAndroid Build Coastguard Worker                                                           int aa_type);
367*3ac0a46fSAndroid Build Coastguard Worker 
368*3ac0a46fSAndroid Build Coastguard Worker // Experimental API.
369*3ac0a46fSAndroid Build Coastguard Worker // Get the file identifer defined in the trailer of |document|.
370*3ac0a46fSAndroid Build Coastguard Worker //
371*3ac0a46fSAndroid Build Coastguard Worker //   document - handle to the document.
372*3ac0a46fSAndroid Build Coastguard Worker //   id_type  - the file identifier type to retrieve.
373*3ac0a46fSAndroid Build Coastguard Worker //   buffer   - a buffer for the file identifier. May be NULL.
374*3ac0a46fSAndroid Build Coastguard Worker //   buflen   - the length of the buffer, in bytes. May be 0.
375*3ac0a46fSAndroid Build Coastguard Worker //
376*3ac0a46fSAndroid Build Coastguard Worker // Returns the number of bytes in the file identifier, including the NUL
377*3ac0a46fSAndroid Build Coastguard Worker // terminator.
378*3ac0a46fSAndroid Build Coastguard Worker //
379*3ac0a46fSAndroid Build Coastguard Worker // The |buffer| is always a byte string. The |buffer| is followed by a NUL
380*3ac0a46fSAndroid Build Coastguard Worker // terminator.  If |buflen| is less than the returned length, or |buffer| is
381*3ac0a46fSAndroid Build Coastguard Worker // NULL, |buffer| will not be modified.
382*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT unsigned long FPDF_CALLCONV
383*3ac0a46fSAndroid Build Coastguard Worker FPDF_GetFileIdentifier(FPDF_DOCUMENT document,
384*3ac0a46fSAndroid Build Coastguard Worker                        FPDF_FILEIDTYPE id_type,
385*3ac0a46fSAndroid Build Coastguard Worker                        void* buffer,
386*3ac0a46fSAndroid Build Coastguard Worker                        unsigned long buflen);
387*3ac0a46fSAndroid Build Coastguard Worker 
388*3ac0a46fSAndroid Build Coastguard Worker // Get meta-data |tag| content from |document|.
389*3ac0a46fSAndroid Build Coastguard Worker //
390*3ac0a46fSAndroid Build Coastguard Worker //   document - handle to the document.
391*3ac0a46fSAndroid Build Coastguard Worker //   tag      - the tag to retrieve. The tag can be one of:
392*3ac0a46fSAndroid Build Coastguard Worker //                Title, Author, Subject, Keywords, Creator, Producer,
393*3ac0a46fSAndroid Build Coastguard Worker //                CreationDate, or ModDate.
394*3ac0a46fSAndroid Build Coastguard Worker //              For detailed explanations of these tags and their respective
395*3ac0a46fSAndroid Build Coastguard Worker //              values, please refer to PDF Reference 1.6, section 10.2.1,
396*3ac0a46fSAndroid Build Coastguard Worker //              'Document Information Dictionary'.
397*3ac0a46fSAndroid Build Coastguard Worker //   buffer   - a buffer for the tag. May be NULL.
398*3ac0a46fSAndroid Build Coastguard Worker //   buflen   - the length of the buffer, in bytes. May be 0.
399*3ac0a46fSAndroid Build Coastguard Worker //
400*3ac0a46fSAndroid Build Coastguard Worker // Returns the number of bytes in the tag, including trailing zeros.
401*3ac0a46fSAndroid Build Coastguard Worker //
402*3ac0a46fSAndroid Build Coastguard Worker // The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two
403*3ac0a46fSAndroid Build Coastguard Worker // bytes of zeros indicating the end of the string.  If |buflen| is less than
404*3ac0a46fSAndroid Build Coastguard Worker // the returned length, or |buffer| is NULL, |buffer| will not be modified.
405*3ac0a46fSAndroid Build Coastguard Worker //
406*3ac0a46fSAndroid Build Coastguard Worker // For linearized files, FPDFAvail_IsFormAvail must be called before this, and
407*3ac0a46fSAndroid Build Coastguard Worker // it must have returned PDF_FORM_AVAIL or PDF_FORM_NOTEXIST. Before that, there
408*3ac0a46fSAndroid Build Coastguard Worker // is no guarantee the metadata has been loaded.
409*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document,
410*3ac0a46fSAndroid Build Coastguard Worker                                                          FPDF_BYTESTRING tag,
411*3ac0a46fSAndroid Build Coastguard Worker                                                          void* buffer,
412*3ac0a46fSAndroid Build Coastguard Worker                                                          unsigned long buflen);
413*3ac0a46fSAndroid Build Coastguard Worker 
414*3ac0a46fSAndroid Build Coastguard Worker // Get the page label for |page_index| from |document|.
415*3ac0a46fSAndroid Build Coastguard Worker //
416*3ac0a46fSAndroid Build Coastguard Worker //   document    - handle to the document.
417*3ac0a46fSAndroid Build Coastguard Worker //   page_index  - the 0-based index of the page.
418*3ac0a46fSAndroid Build Coastguard Worker //   buffer      - a buffer for the page label. May be NULL.
419*3ac0a46fSAndroid Build Coastguard Worker //   buflen      - the length of the buffer, in bytes. May be 0.
420*3ac0a46fSAndroid Build Coastguard Worker //
421*3ac0a46fSAndroid Build Coastguard Worker // Returns the number of bytes in the page label, including trailing zeros.
422*3ac0a46fSAndroid Build Coastguard Worker //
423*3ac0a46fSAndroid Build Coastguard Worker // The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two
424*3ac0a46fSAndroid Build Coastguard Worker // bytes of zeros indicating the end of the string.  If |buflen| is less than
425*3ac0a46fSAndroid Build Coastguard Worker // the returned length, or |buffer| is NULL, |buffer| will not be modified.
426*3ac0a46fSAndroid Build Coastguard Worker FPDF_EXPORT unsigned long FPDF_CALLCONV
427*3ac0a46fSAndroid Build Coastguard Worker FPDF_GetPageLabel(FPDF_DOCUMENT document,
428*3ac0a46fSAndroid Build Coastguard Worker                   int page_index,
429*3ac0a46fSAndroid Build Coastguard Worker                   void* buffer,
430*3ac0a46fSAndroid Build Coastguard Worker                   unsigned long buflen);
431*3ac0a46fSAndroid Build Coastguard Worker 
432*3ac0a46fSAndroid Build Coastguard Worker #ifdef __cplusplus
433*3ac0a46fSAndroid Build Coastguard Worker }  // extern "C"
434*3ac0a46fSAndroid Build Coastguard Worker #endif  // __cplusplus
435*3ac0a46fSAndroid Build Coastguard Worker 
436*3ac0a46fSAndroid Build Coastguard Worker #endif  // PUBLIC_FPDF_DOC_H_
437