blob: 2bf574b12f0952c5885a809dc6eca64b49e46545 [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// Copyright 2014 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Tom Sepez9857e202015-05-13 17:09:26 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Tom Sepez9857e202015-05-13 17:09:26 -07007#ifndef PUBLIC_FPDF_TEXT_H_
8#define PUBLIC_FPDF_TEXT_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
10#include "fpdfview.h"
11
12// Exported Functions
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17// Function: FPDFText_LoadPage
Tom Sepez9857e202015-05-13 17:09:26 -070018// Prepare information about all characters in a page.
Tom Sepez526f6d52015-01-28 15:49:13 -080019// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070020// page - Handle to the page. Returned by FPDF_LoadPage function
21// (in FPDFVIEW module).
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070022// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -070023// A handle to the text page information structure.
24// NULL if something goes wrong.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070025// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070026// Application must call FPDFText_ClosePage to release the text page
27// information.
Tom Sepez526f6d52015-01-28 15:49:13 -080028//
Tom Sepez9857e202015-05-13 17:09:26 -070029DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070030
31// Function: FPDFText_ClosePage
Nico Weber9d8ec5a2015-08-04 13:00:21 -070032// Release all resources allocated for a text page information
33// structure.
Tom Sepez526f6d52015-01-28 15:49:13 -080034// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070035// text_page - Handle to a text page information structure.
36// Returned by FPDFText_LoadPage function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070037// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -070038// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070039//
40DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
Tom Sepez526f6d52015-01-28 15:49:13 -080041
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070042// Function: FPDFText_CountChars
Tom Sepez9857e202015-05-13 17:09:26 -070043// Get number of characters in a page.
Tom Sepez526f6d52015-01-28 15:49:13 -080044// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070045// text_page - Handle to a text page information structure.
46// Returned by FPDFText_LoadPage function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070047// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -070048// Number of characters in the page. Return -1 for error.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070049// Generated characters, like additional space characters, new line
50// characters, are also counted.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070051// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070052// Characters in a page form a "stream", inside the stream, each
53// character has an index.
54// We will use the index parameters in many of FPDFTEXT functions. The
55// first character in the page
Tom Sepez9857e202015-05-13 17:09:26 -070056// has an index value of zero.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070057//
58DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page);
59
60// Function: FPDFText_GetUnicode
Tom Sepez9857e202015-05-13 17:09:26 -070061// Get Unicode of a character in a page.
Tom Sepez526f6d52015-01-28 15:49:13 -080062// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070063// text_page - Handle to a text page information structure.
64// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -070065// index - Zero-based index of the character.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070066// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -070067// The Unicode of the particular character.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070068// If a character is not encoded in Unicode and Foxit engine can't
69// convert to Unicode,
Tom Sepez9857e202015-05-13 17:09:26 -070070// the return value will be zero.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070071//
Nico Weber9d8ec5a2015-08-04 13:00:21 -070072DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page,
73 int index);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070074
75// Function: FPDFText_GetFontSize
Tom Sepez9857e202015-05-13 17:09:26 -070076// Get the font size of a particular character.
Tom Sepez526f6d52015-01-28 15:49:13 -080077// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070078// text_page - Handle to a text page information structure.
79// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -070080// index - Zero-based index of the character.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070081// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070082// The font size of the particular character, measured in points (about
83// 1/72 inch).
Tom Sepez9857e202015-05-13 17:09:26 -070084// This is the typographic size of the font (so called "em size").
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070085//
Nico Weber9d8ec5a2015-08-04 13:00:21 -070086DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
87 int index);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070088
89// Function: FPDFText_GetCharBox
Tom Sepez9857e202015-05-13 17:09:26 -070090// Get bounding box of a particular character.
Tom Sepez526f6d52015-01-28 15:49:13 -080091// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070092// text_page - Handle to a text page information structure.
93// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -070094// index - Zero-based index of the character.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070095// left - Pointer to a double number receiving left position
96// of the character box.
97// right - Pointer to a double number receiving right position
98// of the character box.
99// bottom - Pointer to a double number receiving bottom position
100// of the character box.
101// top - Pointer to a double number receiving top position of
102// the character box.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700103// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700104// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700105// Comments:
Tom Sepez9857e202015-05-13 17:09:26 -0700106// All positions are measured in PDF "user space".
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700107//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700108DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
109 int index,
110 double* left,
111 double* right,
112 double* bottom,
113 double* top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700114
115// Function: FPDFText_GetCharIndexAtPos
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700116// Get the index of a character at or nearby a certain position on the
117// page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700118// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700119// text_page - Handle to a text page information structure.
120// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700121// x - X position in PDF "user space".
122// y - Y position in PDF "user space".
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700123// xTolerance - An x-axis tolerance value for character hit
124// detection, in point unit.
125// yTolerance - A y-axis tolerance value for character hit
126// detection, in point unit.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700127// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700128// The zero-based index of the character at, or nearby the point (x,y).
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700129// If there is no character at or nearby the point, return value will
130// be -1.
Tom Sepez9857e202015-05-13 17:09:26 -0700131// If an error occurs, -3 will be returned.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700132//
133DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700134 double x,
135 double y,
Lei Zhang38a5a392015-08-13 17:52:16 -0700136 double xTolerance,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700137 double yTolerance);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700138
139// Function: FPDFText_GetText
Tom Sepez9857e202015-05-13 17:09:26 -0700140// Extract unicode text string from the page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700141// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700142// text_page - Handle to a text page information structure.
143// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700144// start_index - Index for the start characters.
145// count - Number of characters to be extracted.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700146// result - A buffer (allocated by application) receiving the
147// extracted unicodes.
148// The size of the buffer must be able to hold the
149// number of characters plus a terminator.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700150// Return Value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700151// Number of characters written into the result buffer, including the
152// trailing terminator.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700153// Comments:
Tom Sepez9857e202015-05-13 17:09:26 -0700154// This function ignores characters without unicode information.
Tom Sepez526f6d52015-01-28 15:49:13 -0800155//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700156DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,
157 int start_index,
158 int count,
159 unsigned short* result);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700160
161// Function: FPDFText_CountRects
Tom Sepez9857e202015-05-13 17:09:26 -0700162// Count number of rectangular areas occupied by a segment of texts.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700163// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700164// text_page - Handle to a text page information structure.
165// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700166// start_index - Index for the start characters.
167// count - Number of characters.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700168// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700169// Number of rectangles. Zero for error.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700170// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700171// This function, along with FPDFText_GetRect can be used by
172// applications to detect the position
173// on the page for a text segment, so proper areas can be highlighted
174// or something.
175// FPDFTEXT will automatically merge small character boxes into bigger
176// one if those characters
Tom Sepez9857e202015-05-13 17:09:26 -0700177// are on the same line and use same font settings.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700178//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700179DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page,
180 int start_index,
181 int count);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700182
183// Function: FPDFText_GetRect
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700184// Get a rectangular area from the result generated by
185// FPDFText_CountRects.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700186// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700187// text_page - Handle to a text page information structure.
188// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700189// rect_index - Zero-based index for the rectangle.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700190// left - Pointer to a double value receiving the rectangle
191// left boundary.
192// top - Pointer to a double value receiving the rectangle
193// top boundary.
194// right - Pointer to a double value receiving the rectangle
195// right boundary.
196// bottom - Pointer to a double value receiving the rectangle
197// bottom boundary.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700198// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700199// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700200//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700201DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page,
202 int rect_index,
203 double* left,
204 double* top,
205 double* right,
206 double* bottom);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700207
208// Function: FPDFText_GetBoundedText
Tom Sepez9857e202015-05-13 17:09:26 -0700209// Extract unicode text within a rectangular boundary on the page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700210// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700211// text_page - Handle to a text page information structure.
212// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700213// left - Left boundary.
214// top - Top boundary.
215// right - Right boundary.
216// bottom - Bottom boundary.
217// buffer - A unicode buffer.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700218// buflen - Number of characters (not bytes) for the buffer,
219// excluding an additional terminator.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700220// Return Value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700221// If buffer is NULL or buflen is zero, return number of characters
222// (not bytes) of text present within
223// the rectangle, excluding a terminating NUL. Generally you should
224// pass a buffer at least one larger
225// than this if you want a terminating NUL, which will be provided if
226// space is available.
227// Otherwise, return number of characters copied into the buffer,
228// including the terminating NUL
Tom Sepez9857e202015-05-13 17:09:26 -0700229// when space for it is available.
Tom Sepez526f6d52015-01-28 15:49:13 -0800230// Comment:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700231// If the buffer is too small, as much text as will fit is copied into
232// it.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700233//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700234DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
235 double left,
236 double top,
237 double right,
238 double bottom,
239 unsigned short* buffer,
240 int buflen);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700241
242// Flags used by FPDFText_FindStart function.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700243#define FPDF_MATCHCASE \
244 0x00000001 // If not set, it will not match case by default.
245#define FPDF_MATCHWHOLEWORD \
246 0x00000002 // If not set, it will not match the whole word by default.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700247
248// Function: FPDFText_FindStart
Tom Sepez9857e202015-05-13 17:09:26 -0700249// Start a search.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700250// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700251// text_page - Handle to a text page information structure.
252// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700253// findwhat - A unicode match pattern.
254// flags - Option flags.
255// start_index - Start from this character. -1 for end of the page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700256// Return Value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700257// A handle for the search context. FPDFText_FindClose must be called
258// to release this handle.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700259//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700260DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page,
261 FPDF_WIDESTRING findwhat,
262 unsigned long flags,
263 int start_index);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700264
265// Function: FPDFText_FindNext
Tom Sepez9857e202015-05-13 17:09:26 -0700266// Search in the direction from page start to end.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700267// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700268// handle - A search context handle returned by
269// FPDFText_FindStart.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700270// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700271// Whether a match is found.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700272//
273DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle);
274
275// Function: FPDFText_FindPrev
Tom Sepez9857e202015-05-13 17:09:26 -0700276// Search in the direction from page end to start.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700277// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700278// handle - A search context handle returned by
279// FPDFText_FindStart.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700280// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700281// Whether a match is found.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700282//
283DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle);
284
285// Function: FPDFText_GetSchResultIndex
Tom Sepez9857e202015-05-13 17:09:26 -0700286// Get the starting character index of the search result.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700287// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700288// handle - A search context handle returned by
289// FPDFText_FindStart.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700290// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700291// Index for the starting character.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700292//
293DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
294
295// Function: FPDFText_GetSchCount
Tom Sepez9857e202015-05-13 17:09:26 -0700296// Get the number of matched characters in the search result.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700297// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700298// handle - A search context handle returned by
299// FPDFText_FindStart.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700300// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700301// Number of matched characters.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700302//
303DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
304
305// Function: FPDFText_FindClose
Tom Sepez9857e202015-05-13 17:09:26 -0700306// Release a search context.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700307// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700308// handle - A search context handle returned by
309// FPDFText_FindStart.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700310// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700311// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700312//
313DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle);
314
315// Function: FPDFLink_LoadWebLinks
Tom Sepez9857e202015-05-13 17:09:26 -0700316// Prepare information about weblinks in a page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700317// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700318// text_page - Handle to a text page information structure.
319// Returned by FPDFText_LoadPage function.
Tom Sepez526f6d52015-01-28 15:49:13 -0800320// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700321// A handle to the page's links information structure.
322// NULL if something goes wrong.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700323// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700324// Weblinks are those links implicitly embedded in PDF pages. PDF also
325// has a type of
326// annotation called "link", FPDFTEXT doesn't deal with that kind of
327// link.
328// FPDFTEXT weblink feature is useful for automatically detecting links
329// in the page
330// contents. For example, things like "http://www.foxitsoftware.com"
331// will be detected,
332// so applications can allow user to click on those characters to
333// activate the link,
Tom Sepez9857e202015-05-13 17:09:26 -0700334// even the PDF doesn't come with link annotations.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700335//
Tom Sepez9857e202015-05-13 17:09:26 -0700336// FPDFLink_CloseWebLinks must be called to release resources.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700337//
338DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
339
340// Function: FPDFLink_CountWebLinks
Tom Sepez9857e202015-05-13 17:09:26 -0700341// Count number of detected web links.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700342// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700343// link_page - Handle returned by FPDFLink_LoadWebLinks.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700344// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700345// Number of detected web links.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700346//
347DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
348
349// Function: FPDFLink_GetURL
Tom Sepez9857e202015-05-13 17:09:26 -0700350// Fetch the URL information for a detected web link.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700351// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700352// link_page - Handle returned by FPDFLink_LoadWebLinks.
353// link_index - Zero-based index for the link.
tsepez69141182016-04-21 10:43:39 -0700354// buffer - A unicode buffer for the result.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700355// buflen - Number of characters (not bytes) for the buffer,
tsepez69141182016-04-21 10:43:39 -0700356// including an additional terminator.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700357// Return Value:
tsepez69141182016-04-21 10:43:39 -0700358// If |buffer| is NULL or |buflen| is zero, return the number of
359// characters (not bytes) needed to buffer the result (an additional
360// terminator is included in this count).
361// Otherwise, copy the result into |buffer|, truncating at |buflen| if
362// the result is too large to fit, and return the number of characters
363// actually copied into the buffer (the additional terminator is also
364// included in this count).
365// If |link_index| does not correspond to a valid link, then the result
366// is an empty string.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700367//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700368DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page,
369 int link_index,
370 unsigned short* buffer,
371 int buflen);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700372
373// Function: FPDFLink_CountRects
Tom Sepez9857e202015-05-13 17:09:26 -0700374// Count number of rectangular areas for the link.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700375// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700376// link_page - Handle returned by FPDFLink_LoadWebLinks.
377// link_index - Zero-based index for the link.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700378// Return Value:
tsepez69141182016-04-21 10:43:39 -0700379// Number of rectangular areas for the link. If |link_index| does
380// not correspond to a valid link, then 0 is returned.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700381//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700382DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page,
383 int link_index);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700384
385// Function: FPDFLink_GetRect
Tom Sepez9857e202015-05-13 17:09:26 -0700386// Fetch the boundaries of a rectangle for a link.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700387// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700388// link_page - Handle returned by FPDFLink_LoadWebLinks.
389// link_index - Zero-based index for the link.
390// rect_index - Zero-based index for a rectangle.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700391// left - Pointer to a double value receiving the rectangle
tsepez69141182016-04-21 10:43:39 -0700392// left boundary.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700393// top - Pointer to a double value receiving the rectangle
tsepez69141182016-04-21 10:43:39 -0700394// top boundary.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700395// right - Pointer to a double value receiving the rectangle
tsepez69141182016-04-21 10:43:39 -0700396// right boundary.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700397// bottom - Pointer to a double value receiving the rectangle
tsepez69141182016-04-21 10:43:39 -0700398// bottom boundary.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700399// Return Value:
tsepez69141182016-04-21 10:43:39 -0700400// None. If |link_index| does not correspond to a valid link, then
401// |left|, |top|, |right|, and |bottom| remain unmodified.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700402//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700403DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page,
404 int link_index,
405 int rect_index,
406 double* left,
407 double* top,
408 double* right,
409 double* bottom);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700410
411// Function: FPDFLink_CloseWebLinks
Tom Sepez9857e202015-05-13 17:09:26 -0700412// Release resources used by weblink feature.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700413// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700414// link_page - Handle returned by FPDFLink_LoadWebLinks.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700415// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700416// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700417//
418DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);
419
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700420#ifdef __cplusplus
Tom Sepez9857e202015-05-13 17:09:26 -0700421}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700422#endif
423
Tom Sepez9857e202015-05-13 17:09:26 -0700424#endif // PUBLIC_FPDF_TEXT_H_