blob: 5c241527ebd4018c6c4bb1d79476297bd8790998 [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
Dan Sinclair85c8e7f2016-11-21 13:50:32 -050010// NOLINTNEXTLINE(build/include)
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070011#include "fpdfview.h"
12
13// Exported Functions
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18// Function: FPDFText_LoadPage
Tom Sepez9857e202015-05-13 17:09:26 -070019// Prepare information about all characters in a page.
Tom Sepez526f6d52015-01-28 15:49:13 -080020// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070021// page - Handle to the page. Returned by FPDF_LoadPage function
22// (in FPDFVIEW module).
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070023// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -070024// A handle to the text page information structure.
25// NULL if something goes wrong.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070026// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070027// Application must call FPDFText_ClosePage to release the text page
28// information.
Tom Sepez526f6d52015-01-28 15:49:13 -080029//
Tom Sepez9857e202015-05-13 17:09:26 -070030DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070031
32// Function: FPDFText_ClosePage
Nico Weber9d8ec5a2015-08-04 13:00:21 -070033// Release all resources allocated for a text page information
34// structure.
Tom Sepez526f6d52015-01-28 15:49:13 -080035// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070036// text_page - Handle to a text page information structure.
37// Returned by FPDFText_LoadPage function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070038// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -070039// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070040//
41DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
Tom Sepez526f6d52015-01-28 15:49:13 -080042
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070043// Function: FPDFText_CountChars
Tom Sepez9857e202015-05-13 17:09:26 -070044// Get number of characters in a page.
Tom Sepez526f6d52015-01-28 15:49:13 -080045// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070046// text_page - Handle to a text page information structure.
47// Returned by FPDFText_LoadPage function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070048// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -070049// Number of characters in the page. Return -1 for error.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070050// Generated characters, like additional space characters, new line
51// characters, are also counted.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070052// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070053// Characters in a page form a "stream", inside the stream, each
54// character has an index.
55// We will use the index parameters in many of FPDFTEXT functions. The
56// first character in the page
Tom Sepez9857e202015-05-13 17:09:26 -070057// has an index value of zero.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070058//
59DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page);
60
61// Function: FPDFText_GetUnicode
Tom Sepez9857e202015-05-13 17:09:26 -070062// Get Unicode of a character in a page.
Tom Sepez526f6d52015-01-28 15:49:13 -080063// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070064// text_page - Handle to a text page information structure.
65// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -070066// index - Zero-based index of the character.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070067// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -070068// The Unicode of the particular character.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070069// If a character is not encoded in Unicode and Foxit engine can't
70// convert to Unicode,
Tom Sepez9857e202015-05-13 17:09:26 -070071// the return value will be zero.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070072//
Nico Weber9d8ec5a2015-08-04 13:00:21 -070073DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page,
74 int index);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070075
76// Function: FPDFText_GetFontSize
Tom Sepez9857e202015-05-13 17:09:26 -070077// Get the font size of a particular character.
Tom Sepez526f6d52015-01-28 15:49:13 -080078// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070079// text_page - Handle to a text page information structure.
80// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -070081// index - Zero-based index of the character.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070082// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070083// The font size of the particular character, measured in points (about
84// 1/72 inch).
Tom Sepez9857e202015-05-13 17:09:26 -070085// This is the typographic size of the font (so called "em size").
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070086//
Nico Weber9d8ec5a2015-08-04 13:00:21 -070087DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
88 int index);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070089
90// Function: FPDFText_GetCharBox
Tom Sepez9857e202015-05-13 17:09:26 -070091// Get bounding box of a particular character.
Tom Sepez526f6d52015-01-28 15:49:13 -080092// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070093// text_page - Handle to a text page information structure.
94// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -070095// index - Zero-based index of the character.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070096// left - Pointer to a double number receiving left position
97// of the character box.
98// right - Pointer to a double number receiving right position
99// of the character box.
100// bottom - Pointer to a double number receiving bottom position
101// of the character box.
102// top - Pointer to a double number receiving top position of
103// the character box.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700104// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700105// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700106// Comments:
Tom Sepez9857e202015-05-13 17:09:26 -0700107// All positions are measured in PDF "user space".
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700108//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700109DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
110 int index,
111 double* left,
112 double* right,
113 double* bottom,
114 double* top);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700115
116// Function: FPDFText_GetCharIndexAtPos
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700117// Get the index of a character at or nearby a certain position on the
118// page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700119// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700120// text_page - Handle to a text page information structure.
121// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700122// x - X position in PDF "user space".
123// y - Y position in PDF "user space".
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700124// xTolerance - An x-axis tolerance value for character hit
125// detection, in point unit.
126// yTolerance - A y-axis tolerance value for character hit
127// detection, in point unit.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700128// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700129// The zero-based index of the character at, or nearby the point (x,y).
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700130// If there is no character at or nearby the point, return value will
131// be -1.
Tom Sepez9857e202015-05-13 17:09:26 -0700132// If an error occurs, -3 will be returned.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700133//
134DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700135 double x,
136 double y,
Lei Zhang38a5a392015-08-13 17:52:16 -0700137 double xTolerance,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700138 double yTolerance);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700139
140// Function: FPDFText_GetText
Tom Sepez9857e202015-05-13 17:09:26 -0700141// Extract unicode text string from the page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700142// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700143// text_page - Handle to a text page information structure.
144// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700145// start_index - Index for the start characters.
146// count - Number of characters to be extracted.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700147// result - A buffer (allocated by application) receiving the
148// extracted unicodes.
149// The size of the buffer must be able to hold the
150// number of characters plus a terminator.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700151// Return Value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700152// Number of characters written into the result buffer, including the
153// trailing terminator.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700154// Comments:
Tom Sepez9857e202015-05-13 17:09:26 -0700155// This function ignores characters without unicode information.
Tom Sepez526f6d52015-01-28 15:49:13 -0800156//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700157DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,
158 int start_index,
159 int count,
160 unsigned short* result);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700161
162// Function: FPDFText_CountRects
Tom Sepez9857e202015-05-13 17:09:26 -0700163// Count number of rectangular areas occupied by a segment of texts.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700164// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700165// text_page - Handle to a text page information structure.
166// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700167// start_index - Index for the start characters.
168// count - Number of characters.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700169// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700170// Number of rectangles. Zero for error.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700171// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700172// This function, along with FPDFText_GetRect can be used by
173// applications to detect the position
174// on the page for a text segment, so proper areas can be highlighted
175// or something.
176// FPDFTEXT will automatically merge small character boxes into bigger
177// one if those characters
Tom Sepez9857e202015-05-13 17:09:26 -0700178// are on the same line and use same font settings.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700179//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700180DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page,
181 int start_index,
182 int count);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700183
184// Function: FPDFText_GetRect
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700185// Get a rectangular area from the result generated by
186// FPDFText_CountRects.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700187// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700188// text_page - Handle to a text page information structure.
189// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700190// rect_index - Zero-based index for the rectangle.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700191// left - Pointer to a double value receiving the rectangle
192// left boundary.
193// top - Pointer to a double value receiving the rectangle
194// top boundary.
195// right - Pointer to a double value receiving the rectangle
196// right boundary.
197// bottom - Pointer to a double value receiving the rectangle
198// bottom boundary.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700199// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700200// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700201//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700202DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page,
203 int rect_index,
204 double* left,
205 double* top,
206 double* right,
207 double* bottom);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700208
209// Function: FPDFText_GetBoundedText
Tom Sepez9857e202015-05-13 17:09:26 -0700210// Extract unicode text within a rectangular boundary on the page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700211// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700212// text_page - Handle to a text page information structure.
213// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700214// left - Left boundary.
215// top - Top boundary.
216// right - Right boundary.
217// bottom - Bottom boundary.
218// buffer - A unicode buffer.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700219// buflen - Number of characters (not bytes) for the buffer,
220// excluding an additional terminator.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700221// Return Value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700222// If buffer is NULL or buflen is zero, return number of characters
223// (not bytes) of text present within
224// the rectangle, excluding a terminating NUL. Generally you should
225// pass a buffer at least one larger
226// than this if you want a terminating NUL, which will be provided if
227// space is available.
228// Otherwise, return number of characters copied into the buffer,
229// including the terminating NUL
Tom Sepez9857e202015-05-13 17:09:26 -0700230// when space for it is available.
Tom Sepez526f6d52015-01-28 15:49:13 -0800231// Comment:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700232// If the buffer is too small, as much text as will fit is copied into
233// it.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700234//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700235DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
236 double left,
237 double top,
238 double right,
239 double bottom,
240 unsigned short* buffer,
241 int buflen);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700242
243// Flags used by FPDFText_FindStart function.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700244#define FPDF_MATCHCASE \
245 0x00000001 // If not set, it will not match case by default.
246#define FPDF_MATCHWHOLEWORD \
247 0x00000002 // If not set, it will not match the whole word by default.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700248
249// Function: FPDFText_FindStart
Tom Sepez9857e202015-05-13 17:09:26 -0700250// Start a search.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700251// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700252// text_page - Handle to a text page information structure.
253// Returned by FPDFText_LoadPage function.
Tom Sepez9857e202015-05-13 17:09:26 -0700254// findwhat - A unicode match pattern.
255// flags - Option flags.
256// start_index - Start from this character. -1 for end of the page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700257// Return Value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700258// A handle for the search context. FPDFText_FindClose must be called
259// to release this handle.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700260//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700261DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page,
262 FPDF_WIDESTRING findwhat,
263 unsigned long flags,
264 int start_index);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700265
266// Function: FPDFText_FindNext
Tom Sepez9857e202015-05-13 17:09:26 -0700267// Search in the direction from page start to end.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700268// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700269// handle - A search context handle returned by
270// FPDFText_FindStart.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700271// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700272// Whether a match is found.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700273//
274DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle);
275
276// Function: FPDFText_FindPrev
Tom Sepez9857e202015-05-13 17:09:26 -0700277// Search in the direction from page end to start.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700278// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700279// handle - A search context handle returned by
280// FPDFText_FindStart.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700281// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700282// Whether a match is found.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700283//
284DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle);
285
286// Function: FPDFText_GetSchResultIndex
Tom Sepez9857e202015-05-13 17:09:26 -0700287// Get the starting character index of the search result.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700288// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700289// handle - A search context handle returned by
290// FPDFText_FindStart.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700291// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700292// Index for the starting character.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700293//
294DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
295
296// Function: FPDFText_GetSchCount
Tom Sepez9857e202015-05-13 17:09:26 -0700297// Get the number of matched characters in the search result.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700298// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700299// handle - A search context handle returned by
300// FPDFText_FindStart.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700301// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700302// Number of matched characters.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700303//
304DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
305
306// Function: FPDFText_FindClose
Tom Sepez9857e202015-05-13 17:09:26 -0700307// Release a search context.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700308// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700309// handle - A search context handle returned by
310// FPDFText_FindStart.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700311// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700312// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700313//
314DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle);
315
316// Function: FPDFLink_LoadWebLinks
Tom Sepez9857e202015-05-13 17:09:26 -0700317// Prepare information about weblinks in a page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700318// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700319// text_page - Handle to a text page information structure.
320// Returned by FPDFText_LoadPage function.
Tom Sepez526f6d52015-01-28 15:49:13 -0800321// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700322// A handle to the page's links information structure.
323// NULL if something goes wrong.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700324// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700325// Weblinks are those links implicitly embedded in PDF pages. PDF also
326// has a type of
327// annotation called "link", FPDFTEXT doesn't deal with that kind of
328// link.
329// FPDFTEXT weblink feature is useful for automatically detecting links
330// in the page
331// contents. For example, things like "http://www.foxitsoftware.com"
332// will be detected,
333// so applications can allow user to click on those characters to
334// activate the link,
Tom Sepez9857e202015-05-13 17:09:26 -0700335// even the PDF doesn't come with link annotations.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700336//
Tom Sepez9857e202015-05-13 17:09:26 -0700337// FPDFLink_CloseWebLinks must be called to release resources.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700338//
339DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
340
341// Function: FPDFLink_CountWebLinks
Tom Sepez9857e202015-05-13 17:09:26 -0700342// Count number of detected web links.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700343// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700344// link_page - Handle returned by FPDFLink_LoadWebLinks.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700345// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700346// Number of detected web links.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700347//
348DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
349
350// Function: FPDFLink_GetURL
Tom Sepez9857e202015-05-13 17:09:26 -0700351// Fetch the URL information for a detected web link.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700352// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700353// link_page - Handle returned by FPDFLink_LoadWebLinks.
354// link_index - Zero-based index for the link.
tsepez69141182016-04-21 10:43:39 -0700355// buffer - A unicode buffer for the result.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700356// buflen - Number of characters (not bytes) for the buffer,
tsepez69141182016-04-21 10:43:39 -0700357// including an additional terminator.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700358// Return Value:
tsepez69141182016-04-21 10:43:39 -0700359// If |buffer| is NULL or |buflen| is zero, return the number of
360// characters (not bytes) needed to buffer the result (an additional
361// terminator is included in this count).
362// Otherwise, copy the result into |buffer|, truncating at |buflen| if
363// the result is too large to fit, and return the number of characters
364// actually copied into the buffer (the additional terminator is also
365// included in this count).
366// If |link_index| does not correspond to a valid link, then the result
367// is an empty string.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700368//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700369DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page,
370 int link_index,
371 unsigned short* buffer,
372 int buflen);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700373
374// Function: FPDFLink_CountRects
Tom Sepez9857e202015-05-13 17:09:26 -0700375// Count number of rectangular areas for the link.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700376// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700377// link_page - Handle returned by FPDFLink_LoadWebLinks.
378// link_index - Zero-based index for the link.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700379// Return Value:
tsepez69141182016-04-21 10:43:39 -0700380// Number of rectangular areas for the link. If |link_index| does
381// not correspond to a valid link, then 0 is returned.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700382//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700383DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page,
384 int link_index);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700385
386// Function: FPDFLink_GetRect
Tom Sepez9857e202015-05-13 17:09:26 -0700387// Fetch the boundaries of a rectangle for a link.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700388// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700389// link_page - Handle returned by FPDFLink_LoadWebLinks.
390// link_index - Zero-based index for the link.
391// rect_index - Zero-based index for a rectangle.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700392// left - Pointer to a double value receiving the rectangle
tsepez69141182016-04-21 10:43:39 -0700393// left boundary.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700394// top - Pointer to a double value receiving the rectangle
tsepez69141182016-04-21 10:43:39 -0700395// top boundary.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700396// right - Pointer to a double value receiving the rectangle
tsepez69141182016-04-21 10:43:39 -0700397// right boundary.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700398// bottom - Pointer to a double value receiving the rectangle
tsepez69141182016-04-21 10:43:39 -0700399// bottom boundary.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700400// Return Value:
tsepez69141182016-04-21 10:43:39 -0700401// None. If |link_index| does not correspond to a valid link, then
402// |left|, |top|, |right|, and |bottom| remain unmodified.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700403//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700404DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page,
405 int link_index,
406 int rect_index,
407 double* left,
408 double* top,
409 double* right,
410 double* bottom);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700411
412// Function: FPDFLink_CloseWebLinks
Tom Sepez9857e202015-05-13 17:09:26 -0700413// Release resources used by weblink feature.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700414// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700415// link_page - Handle returned by FPDFLink_LoadWebLinks.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700416// Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -0700417// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700418//
419DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);
420
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700421#ifdef __cplusplus
Tom Sepez9857e202015-05-13 17:09:26 -0700422}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700423#endif
424
Tom Sepez9857e202015-05-13 17:09:26 -0700425#endif // PUBLIC_FPDF_TEXT_H_