blob: 158f8215a45569e036eb84cc7fde083dd31c17b3 [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 Sepez1ed8a212015-05-11 15:25:39 -07007// NOTE: External docs refer to this file as "fpdfview.h", so do not rename
8// despite lack of consitency with other public files.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
Tom Sepez9857e202015-05-13 17:09:26 -070010#ifndef PUBLIC_FPDFVIEW_H_
11#define PUBLIC_FPDFVIEW_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070012
13#if defined(_WIN32) && !defined(__WINDOWS__)
14#include <windows.h>
15#endif
16
Bo Xubb5ef882014-11-06 16:13:33 -080017// TODO: remove the #define when XFA is officially in pdfium
18#define PDF_USE_XFA
19
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070020// Data types
Tom Sepez9857e202015-05-13 17:09:26 -070021typedef void* FPDF_MODULEMGR;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070022
23// PDF types
Tom Sepez9857e202015-05-13 17:09:26 -070024typedef void* FPDF_DOCUMENT;
25typedef void* FPDF_PAGE;
26typedef void* FPDF_WIDGET;
27typedef void* FPDF_STRINGHANDLE;
Nico Weber9d8ec5a2015-08-04 13:00:21 -070028typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc)
Tom Sepez9857e202015-05-13 17:09:26 -070029typedef void* FPDF_PATH;
30typedef void* FPDF_CLIPPATH;
31typedef void* FPDF_BITMAP;
32typedef void* FPDF_FONT;
33typedef void* FPDF_TEXTPAGE;
34typedef void* FPDF_SCHHANDLE;
35typedef void* FPDF_PAGELINK;
36typedef void* FPDF_HMODULE;
37typedef void* FPDF_DOCSCHHANDLE;
38typedef void* FPDF_BOOKMARK;
39typedef void* FPDF_DEST;
40typedef void* FPDF_ACTION;
41typedef void* FPDF_LINK;
42typedef void* FPDF_PAGERANGE;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070043
44// Basic data types
Tom Sepez9857e202015-05-13 17:09:26 -070045typedef void* FPDF_LPVOID;
46typedef void const* FPDF_LPCVOID;
47typedef int FPDF_RESULT;
48typedef int FPDF_BOOL;
49typedef int FPDF_ERROR;
50typedef unsigned long FPDF_DWORD;
51typedef float FS_FLOAT;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070052
Bo Xu9114e832014-07-14 13:22:47 -070053// Duplex types
54typedef enum _FPDF_DUPLEXTYPE_ {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070055 DuplexUndefined = 0,
56 Simplex,
57 DuplexFlipShortEdge,
58 DuplexFlipLongEdge
Bo Xu9114e832014-07-14 13:22:47 -070059} FPDF_DUPLEXTYPE;
60
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070061// String types
Tom Sepez9857e202015-05-13 17:09:26 -070062typedef unsigned short FPDF_WCHAR;
63typedef unsigned char const* FPDF_LPCBYTE;
64typedef char const* FPDF_LPCSTR;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070065
Nico Weber9d8ec5a2015-08-04 13:00:21 -070066// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE
67// encoded), and platform dependent string
Tom Sepez9857e202015-05-13 17:09:26 -070068typedef const char* FPDF_BYTESTRING;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070069
Nico Weber9d8ec5a2015-08-04 13:00:21 -070070typedef const unsigned short*
71 FPDF_WIDESTRING; // Foxit PDF SDK always use UTF-16LE encoding wide string,
72// each character use 2 bytes (except surrogation), with low byte first.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070073
Bo Xufdc00a72014-10-28 23:03:33 -070074#ifndef _FPDF_DEF_STR_
75#define _FPDF_DEF_STR_
76/** @brief Structure for byte string.
77 *
78 * @note In SDK, a byte string commonly means a UTF-16LE format string.
79 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -070080typedef struct _FPDF_BSTR {
81 /**
82 * @brief String buffer.
83 */
84 char* str;
85 /**
86 * @brief Length of a string, in bytes.
87 */
88 int len;
Bo Xufdc00a72014-10-28 23:03:33 -070089} FPDF_BSTR;
90
91#endif
92
Nico Weber9d8ec5a2015-08-04 13:00:21 -070093// For Windows programmers: for most case it's OK to treat FPDF_WIDESTRING as
94// Windows unicode string,
95// however, special care needs to be taken if you expect to process
96// Unicode larger than 0xffff.
97// For Linux/Unix programmers: most compiler/library environment uses 4 bytes
98// for a Unicode character,
99// you have to convert between FPDF_WIDESTRING and system wide string by
100// yourself.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700101
102#ifdef _WIN32_WCE
103typedef const unsigned short* FPDF_STRING;
104#else
105typedef const char* FPDF_STRING;
106#endif
107
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700108/** @brief Matrix for transformation. */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700109typedef struct _FS_MATRIX_ {
110 float a; /**< @brief Coefficient a.*/
111 float b; /**< @brief Coefficient b.*/
112 float c; /**< @brief Coefficient c.*/
113 float d; /**< @brief Coefficient d.*/
114 float e; /**< @brief Coefficient e.*/
115 float f; /**< @brief Coefficient f.*/
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700116} FS_MATRIX;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700117
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700118/** @brief Rectangle area(float) in device or page coordination system. */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700119typedef struct _FS_RECTF_ {
120 /**@{*/
121 /** @brief The x-coordinate of the left-top corner. */
122 float left;
123 /** @brief The y-coordinate of the left-top corner. */
124 float top;
125 /** @brief The x-coordinate of the right-bottom corner. */
126 float right;
127 /** @brief The y-coordinate of the right-bottom corner. */
128 float bottom;
129 /**@}*/
130} * FS_LPRECTF, FS_RECTF;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700131/** @brief Const Pointer to ::FS_RECTF structure.*/
Tom Sepez9857e202015-05-13 17:09:26 -0700132typedef const FS_RECTF* FS_LPCRECTF;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700133
134#if defined(_WIN32) && defined(FPDFSDK_EXPORTS)
135// On Windows system, functions are exported in a DLL
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700136#define DLLEXPORT __declspec(dllexport)
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700137#define STDCALL __stdcall
138#else
139#define DLLEXPORT
140#define STDCALL
141#endif
142
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700143// Exported Functions
144#ifdef __cplusplus
145extern "C" {
146#endif
147
148// Function: FPDF_InitLibrary
Tom Sepez9857e202015-05-13 17:09:26 -0700149// Initialize the FPDFSDK library
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700150// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700151// None
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700152// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700153// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700154// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700155// You have to call this function before you can call any PDF
156// processing functions.
John Abd-El-Malek207299b2014-12-15 12:13:45 -0800157DLLEXPORT void STDCALL FPDF_InitLibrary();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700158
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700159// Function: FPDF_DestroyLibary
Tom Sepez9857e202015-05-13 17:09:26 -0700160// Release all resources allocated by the FPDFSDK library.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700161// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700162// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700163// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700164// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700165// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700166// You can call this function to release all memory blocks allocated by
167// the library.
168// After this function called, you should not call any PDF processing
169// functions.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700170DLLEXPORT void STDCALL FPDF_DestroyLibrary();
171
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700172// Policy for accessing the local machine time.
173#define FPDF_POLICY_MACHINETIME_ACCESS 0
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700174
175// Function: FPDF_SetSandBoxPolicy
Tom Sepez9857e202015-05-13 17:09:26 -0700176// Set the policy for the sandbox environment.
177// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700178// policy - The specified policy for setting, for
179// example:FPDF_POLICY_MACHINETIME_ACCESS.
Tom Sepez9857e202015-05-13 17:09:26 -0700180// enable - True for enable, False for disable the policy.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700181// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700182// None.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700183DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy,
184 FPDF_BOOL enable);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700185
Tom Sepez3c3201f2015-05-20 10:20:35 -0700186// Function: FPDF_LoadDocument
187// Open and load a PDF document.
188// Parameters:
189// file_path [in] - Path to the PDF file (including extension).
190// password [in] - A string used as the password for PDF file.
191// If no password needed, empty or NULL can be used.
192// Return value:
193// A handle to the loaded document, or NULL on failure.
194// Comments:
195// Loaded document can be closed by FPDF_CloseDocument().
196// If this function fails, you can use FPDF_GetLastError() to retrieve
197// the reason why it failed.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700198// The application should call ::FPDF_LoadXFA function after PDF
199// document loaded
Tom Sepez3c3201f2015-05-20 10:20:35 -0700200// to support XFA fields in fpdfformfill.h file.
Tom Sepez9857e202015-05-13 17:09:26 -0700201DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700202 FPDF_BYTESTRING password);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700203
204// Function: FPDF_LoadMemDocument
Tom Sepez9857e202015-05-13 17:09:26 -0700205// Open and load a PDF document from memory.
206// Parameters:
207// data_buf - Pointer to a buffer containing the PDF document.
208// size - Number of bytes in the PDF document.
209// password - A string used as the password for PDF file.
210// If no password needed, empty or NULL can be used.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700211// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700212// A handle to the loaded document. If failed, NULL is returned.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700213// Comments:
Tom Sepez9857e202015-05-13 17:09:26 -0700214// The memory buffer must remain valid when the document is open.
215// Loaded document can be closed by FPDF_CloseDocument.
216// If this function fails, you can use FPDF_GetLastError() to retrieve
217// the reason why it fails.
Bo Xufdc00a72014-10-28 23:03:33 -0700218// Notes:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700219// The application should call ::FPDF_LoadXFA function after PDF
220// document loaded
Tom Sepez9857e202015-05-13 17:09:26 -0700221// to support XFA fields in fpdfformfill.h file.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700222//
Tom Sepez9857e202015-05-13 17:09:26 -0700223DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700224 int size,
225 FPDF_BYTESTRING password);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700226
227// Structure for custom file access.
228typedef struct {
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700229 // File length, in bytes.
230 unsigned long m_FileLen;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700231
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700232 // A function pointer for getting a block of data from specific position.
233 // Position is specified by byte offset from beginning of the file.
234 // The position and size will never go out range of file length.
235 // It may be possible for FPDFSDK to call this function multiple times for
236 // same position.
237 // Return value: should be non-zero if successful, zero for error.
238 int (*m_GetBlock)(void* param,
239 unsigned long position,
240 unsigned char* pBuf,
241 unsigned long size);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700242
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700243 // A custom pointer for all implementation specific data.
244 // This pointer will be used as the first parameter to m_GetBlock callback.
245 void* m_Param;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700246} FPDF_FILEACCESS;
247
Bo Xufdc00a72014-10-28 23:03:33 -0700248/**
249 * @brief Structure for file reading or writing (I/O).
250 *
251 * @note This is a handler and should be implemented by callers.
252 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700253typedef struct _FPDF_FILEHANDLER {
254 /**
255 * @brief User-defined data.
256 * @note Callers can use this field to track controls.
257 */
258 FPDF_LPVOID clientData;
259 /**
260 * @brief Callback function to release the current file stream object.
261 *
262 * @param[in] clientData Pointer to user-defined data.
263 *
264 * @return None.
265 */
266 void (*Release)(FPDF_LPVOID clientData);
267 /**
268 * @brief Callback function to retrieve the current file stream size.
269 *
270 * @param[in] clientData Pointer to user-defined data.
271 *
272 * @return Size of file stream.
273 */
274 FPDF_DWORD (*GetSize)(FPDF_LPVOID clientData);
275 /**
276 * @brief Callback function to read data from the current file stream.
277 *
278 * @param[in] clientData Pointer to user-defined data.
279 * @param[in] offset Offset position starts from the beginning of file
280 * stream. This parameter indicates reading position.
281 * @param[in] buffer Memory buffer to store data which are read from
282 * file stream. This parameter should not be <b>NULL</b>.
283 * @param[in] size Size of data which should be read from file
284 * stream, in bytes. The buffer indicated by the parameter <i>buffer</i>
285 * should be enough to store specified data.
286 *
287 * @return 0 for success, other value for failure.
288 */
289 FPDF_RESULT (*ReadBlock)(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPVOID buffer, FPDF_DWORD size);
290 /**
291 * @brief Callback function to write data into the current file stream.
292 *
293 * @param[in] clientData Pointer to user-defined data.
294 * @param[in] offset Offset position starts from the beginning of file
295 * stream. This parameter indicates writing position.
296 * @param[in] buffer Memory buffer contains data which is written into
297 * file stream. This parameter should not be <b>NULL</b>.
298 * @param[in] size Size of data which should be written into file
299 * stream, in bytes.
300 *
301 * @return 0 for success, other value for failure.
302 */
303 FPDF_RESULT (*WriteBlock)(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPCVOID buffer, FPDF_DWORD size);
304 /**
305 * @brief Callback function to flush all internal accessing buffers.
306 *
307 * @param[in] clientData Pointer to user-defined data.
308 *
309 * @return 0 for success, other value for failure.
310 */
311 FPDF_RESULT (*Flush)(FPDF_LPVOID clientData);
312 /**
313 * @brief Callback function to change file size.
314 *
315 * @details This function is called under writing mode usually. Implementer
316 * can determine whether to realize it based on application requests.
317 *
318 * @param[in] clientData Pointer to user-defined data.
319 * @param[in] size New size of file stream, in bytes.
320 *
321 * @return 0 for success, other value for failure.
322 */
323 FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size);
Bo Xufdc00a72014-10-28 23:03:33 -0700324
325} FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER;
326
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700327// Function: FPDF_LoadCustomDocument
Tom Sepez9857e202015-05-13 17:09:26 -0700328// Load PDF document from a custom access descriptor.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700329// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700330// pFileAccess - A structure for access the file.
331// password - Optional password for decrypting the PDF file.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700332// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700333// A handle to the loaded document. If failed, NULL is returned.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700334// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700335// The application should maintain the file resources being valid until
336// the PDF document close.
Tom Sepez9857e202015-05-13 17:09:26 -0700337// Loaded document can be closed by FPDF_CloseDocument.
Bo Xufdc00a72014-10-28 23:03:33 -0700338// Notes:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700339// The application should call ::FPDF_LoadXFA function after PDF
340// document loaded
Tom Sepez9857e202015-05-13 17:09:26 -0700341// to support XFA fields in fpdfformfill.h file.
Bo Xufdc00a72014-10-28 23:03:33 -0700342//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700343DLLEXPORT FPDF_DOCUMENT STDCALL
344FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700345
346// Function: FPDF_GetFileVersion
Tom Sepez9857e202015-05-13 17:09:26 -0700347// Get the file version of the specific PDF document.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700348// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700349// doc - Handle to document.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700350// fileVersion - The PDF file version. File version: 14 for 1.4, 15
351// for 1.5, ...
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700352// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700353// TRUE if this call succeed, If failed, FALSE is returned.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700354// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700355// If the document is created by function ::FPDF_CreateNewDocument,
356// then this function would always fail.
Bo Xufdc00a72014-10-28 23:03:33 -0700357//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700358DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc,
359 int* fileVersion);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700360
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700361#define FPDF_ERR_SUCCESS 0 // No error.
362#define FPDF_ERR_UNKNOWN 1 // Unknown error.
363#define FPDF_ERR_FILE 2 // File not found or could not be opened.
364#define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted.
365#define FPDF_ERR_PASSWORD 4 // Password required or incorrect password.
366#define FPDF_ERR_SECURITY 5 // Unsupported security scheme.
367#define FPDF_ERR_PAGE 6 // Page not found or content error.
368#define FPDF_ERR_XFALOAD 7 // Load XFA error.
369#define FPDF_ERR_XFALAYOUT 8 // Layout XFA error.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700370
371// Function: FPDF_GetLastError
Tom Sepez9857e202015-05-13 17:09:26 -0700372// Get last error code when an SDK function failed.
373// Parameters:
374// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700375// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700376// A 32-bit integer indicating error codes (defined above).
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700377// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700378// If the previous SDK call succeeded, the return value of this
379// function
Tom Sepez9857e202015-05-13 17:09:26 -0700380// is not defined.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700381//
Tom Sepez9857e202015-05-13 17:09:26 -0700382DLLEXPORT unsigned long STDCALL FPDF_GetLastError();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700383
384// Function: FPDF_GetDocPermission
Tom Sepez9857e202015-05-13 17:09:26 -0700385// Get file permission flags of the document.
386// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700387// document - Handle to document. Returned by FPDF_LoadDocument
388// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700389// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700390// A 32-bit integer indicating permission flags. Please refer to PDF
391// Reference for
392// detailed description. If the document is not protected, 0xffffffff
393// will be returned.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700394//
Tom Sepez9857e202015-05-13 17:09:26 -0700395DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700396
Bo Xuc5cab022014-09-19 19:16:31 -0700397// Function: FPDF_GetSecurityHandlerRevision
Tom Sepez9857e202015-05-13 17:09:26 -0700398// Get the revision for security handler.
Bo Xuc5cab022014-09-19 19:16:31 -0700399// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700400// document - Handle to document. Returned by FPDF_LoadDocument
401// function.
Bo Xuc5cab022014-09-19 19:16:31 -0700402// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700403// The security handler revision number. Please refer to PDF Reference
404// for
405// detailed description. If the document is not protected, -1 will be
406// returned.
Bo Xuc5cab022014-09-19 19:16:31 -0700407//
408DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document);
409
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700410// Function: FPDF_GetPageCount
Tom Sepez9857e202015-05-13 17:09:26 -0700411// Get total number of pages in a document.
412// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700413// document - Handle to document. Returned by FPDF_LoadDocument
414// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700415// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700416// Total number of pages in the document.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700417//
418DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document);
419
420// Function: FPDF_LoadPage
Tom Sepez9857e202015-05-13 17:09:26 -0700421// Load a page inside a document.
422// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700423// document - Handle to document. Returned by FPDF_LoadDocument
424// function.
Tom Sepez9857e202015-05-13 17:09:26 -0700425// page_index - Index number of the page. 0 for the first page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700426// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700427// A handle to the loaded page. If failed, NULL is returned.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700428// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700429// Loaded page can be rendered to devices using FPDF_RenderPage
430// function.
Tom Sepez9857e202015-05-13 17:09:26 -0700431// Loaded page can be closed by FPDF_ClosePage.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700432//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700433DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
434 int page_index);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700435
436// Function: FPDF_GetPageWidth
Tom Sepez9857e202015-05-13 17:09:26 -0700437// Get page width.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700438// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700439// page - Handle to the page. Returned by FPDF_LoadPage
440// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700441// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700442// Page width (excluding non-displayable area) measured in points.
443// One point is 1/72 inch (around 0.3528 mm).
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700444//
445DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page);
446
447// Function: FPDF_GetPageHeight
Tom Sepez9857e202015-05-13 17:09:26 -0700448// Get page height.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700449// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700450// page - Handle to the page. Returned by FPDF_LoadPage
451// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700452// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700453// Page height (excluding non-displayable area) measured in points.
454// One point is 1/72 inch (around 0.3528 mm)
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700455//
456DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page);
457
458// Function: FPDF_GetPageSizeByIndex
Tom Sepez9857e202015-05-13 17:09:26 -0700459// Get the size of a page by index.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700460// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700461// document - Handle to document. Returned by FPDF_LoadDocument
462// function.
Tom Sepez9857e202015-05-13 17:09:26 -0700463// page_index - Page index, zero for the first page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700464// width - Pointer to a double value receiving the page width
465// (in points).
466// height - Pointer to a double value receiving the page height
467// (in points).
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700468// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700469// Non-zero for success. 0 for error (document or page not found).
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700470//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700471DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
472 int page_index,
473 double* width,
474 double* height);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700475
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700476// Page rendering flags. They can be combined with bit OR.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700477#define FPDF_ANNOT 0x01 // Set if annotations are to be rendered.
478#define FPDF_LCD_TEXT \
479 0x02 // Set if using text rendering optimized for LCD display.
480#define FPDF_NO_NATIVETEXT \
481 0x04 // Don't use the native text output available on some platforms
482#define FPDF_GRAYSCALE 0x08 // Grayscale output.
483#define FPDF_DEBUG_INFO 0x80 // Set if you want to get some debug info.
484// Please discuss with Foxit first if you need to collect debug info.
485#define FPDF_NO_CATCH 0x100 // Set if you don't want to catch exception.
486#define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 // Limit image cache size.
487#define FPDF_RENDER_FORCEHALFTONE \
488 0x400 // Always use halftone for image stretching.
489#define FPDF_PRINTING 0x800 // Render for printing.
490#define FPDF_REVERSE_BYTE_ORDER \
491 0x10 // set whether render in a reverse Byte order, this flag only
492// enable when render to a bitmap.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700493#ifdef _WIN32
494// Function: FPDF_RenderPage
Tom Sepez9857e202015-05-13 17:09:26 -0700495// Render contents in a page to a device (screen, bitmap, or printer).
496// This function is only supported on Windows system.
497// Parameters:
498// dc - Handle to device context.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700499// page - Handle to the page. Returned by FPDF_LoadPage
500// function.
501// start_x - Left pixel position of the display area in the
502// device coordinate.
503// start_y - Top pixel position of the display area in the device
504// coordinate.
Tom Sepez9857e202015-05-13 17:09:26 -0700505// size_x - Horizontal size (in pixels) for displaying the page.
506// size_y - Vertical size (in pixels) for displaying the page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700507// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees
508// clockwise),
509// 2 (rotated 180 degrees), 3 (rotated 90 degrees
510// counter-clockwise).
511// flags - 0 for normal display, or combination of flags
512// defined above.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700513// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700514// None.
Bo Xufdc00a72014-10-28 23:03:33 -0700515// Notes:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700516// The method can not support to render the page for the document
517// consists of dynamic XFA fields.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700518//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700519DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
520 FPDF_PAGE page,
521 int start_x,
522 int start_y,
523 int size_x,
524 int size_y,
525 int rotate,
526 int flags);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700527#endif
528
529// Function: FPDF_RenderPageBitmap
Tom Sepez9857e202015-05-13 17:09:26 -0700530// Render contents in a page to a device independent bitmap
531// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700532// bitmap - Handle to the device independent bitmap (as the
533// output buffer).
534// Bitmap handle can be created by FPDFBitmap_Create
535// function.
536// page - Handle to the page. Returned by FPDF_LoadPage
537// function.
538// start_x - Left pixel position of the display area in the
539// bitmap coordinate.
540// start_y - Top pixel position of the display area in the bitmap
541// coordinate.
Tom Sepez9857e202015-05-13 17:09:26 -0700542// size_x - Horizontal size (in pixels) for displaying the page.
543// size_y - Vertical size (in pixels) for displaying the page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700544// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees
545// clockwise),
546// 2 (rotated 180 degrees), 3 (rotated 90 degrees
547// counter-clockwise).
548// flags - 0 for normal display, or combination of flags
549// defined above.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700550// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700551// None.
Bo Xufdc00a72014-10-28 23:03:33 -0700552// Notes:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700553// The method can not support to render the page for the document
554// consists of dynamic XFA fields.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700555//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700556DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
557 FPDF_PAGE page,
558 int start_x,
559 int start_y,
560 int size_x,
561 int size_y,
562 int rotate,
563 int flags);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700564
565// Function: FPDF_ClosePage
Tom Sepez9857e202015-05-13 17:09:26 -0700566// Close a loaded PDF page.
567// Parameters:
568// page - Handle to the loaded page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700569// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700570// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700571//
572DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page);
573
574// Function: FPDF_CloseDocument
Tom Sepez9857e202015-05-13 17:09:26 -0700575// Close a loaded PDF document.
576// Parameters:
577// document - Handle to the loaded document.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700578// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700579// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700580//
581DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);
582
583// Function: FPDF_DeviceToPage
Tom Sepez9857e202015-05-13 17:09:26 -0700584// Convert the screen coordinate of a point to page coordinate.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700585// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700586// page - Handle to the page. Returned by FPDF_LoadPage
587// function.
588// start_x - Left pixel position of the display area in the
589// device coordinate.
590// start_y - Top pixel position of the display area in the device
591// coordinate.
Tom Sepez9857e202015-05-13 17:09:26 -0700592// size_x - Horizontal size (in pixels) for displaying the page.
593// size_y - Vertical size (in pixels) for displaying the page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700594// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees
595// clockwise),
596// 2 (rotated 180 degrees), 3 (rotated 90 degrees
597// counter-clockwise).
598// device_x - X value in device coordinate, for the point to be
599// converted.
600// device_y - Y value in device coordinate, for the point to be
601// converted.
602// page_x - A Pointer to a double receiving the converted X
603// value in page coordinate.
604// page_y - A Pointer to a double receiving the converted Y
605// value in page coordinate.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700606// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700607// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700608// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700609// The page coordinate system has its origin at left-bottom corner of
610// the page, with X axis goes along
611// the bottom side to the right, and Y axis goes along the left side
612// upward. NOTE: this coordinate system
613// can be altered when you zoom, scroll, or rotate a page, however, a
614// point on the page should always have
Tom Sepez9857e202015-05-13 17:09:26 -0700615// the same coordinate values in the page coordinate system.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700616//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700617// The device coordinate system is device dependent. For screen device,
618// its origin is at left-top
619// corner of the window. However this origin can be altered by Windows
620// coordinate transformation
621// utilities. You must make sure the start_x, start_y, size_x, size_y
622// and rotate parameters have exactly
Tom Sepez9857e202015-05-13 17:09:26 -0700623// same values as you used in FPDF_RenderPage() function call.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700624//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700625DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page,
626 int start_x,
627 int start_y,
628 int size_x,
629 int size_y,
630 int rotate,
631 int device_x,
632 int device_y,
633 double* page_x,
634 double* page_y);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700635
636// Function: FPDF_PageToDevice
Tom Sepez9857e202015-05-13 17:09:26 -0700637// Convert the page coordinate of a point to screen coordinate.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700638// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700639// page - Handle to the page. Returned by FPDF_LoadPage
640// function.
641// start_x - Left pixel position of the display area in the
642// device coordinate.
643// start_y - Top pixel position of the display area in the device
644// coordinate.
Tom Sepez9857e202015-05-13 17:09:26 -0700645// size_x - Horizontal size (in pixels) for displaying the page.
646// size_y - Vertical size (in pixels) for displaying the page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700647// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees
648// clockwise),
649// 2 (rotated 180 degrees), 3 (rotated 90 degrees
650// counter-clockwise).
651// page_x - X value in page coordinate, for the point to be
652// converted.
653// page_y - Y value in page coordinate, for the point to be
654// converted.
655// device_x - A pointer to an integer receiving the result X value
656// in device coordinate.
657// device_y - A pointer to an integer receiving the result Y value
658// in device coordinate.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700659// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700660// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700661// Comments:
Tom Sepez9857e202015-05-13 17:09:26 -0700662// See comments of FPDF_DeviceToPage() function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700663//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700664DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page,
665 int start_x,
666 int start_y,
667 int size_x,
668 int size_y,
669 int rotate,
670 double page_x,
671 double page_y,
672 int* device_x,
673 int* device_y);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700674
675// Function: FPDFBitmap_Create
Tom Sepez9857e202015-05-13 17:09:26 -0700676// Create a Foxit Device Independent Bitmap (FXDIB).
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700677// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700678// width - Number of pixels in a horizontal line of the bitmap.
679// Must be greater than 0.
680// height - Number of pixels in a vertical line of the bitmap.
681// Must be greater than 0.
682// alpha - A flag indicating whether alpha channel is used.
683// Non-zero for using alpha, zero for not using.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700684// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700685// The created bitmap handle, or NULL if parameter error or out of
686// memory.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700687// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700688// An FXDIB always use 4 byte per pixel. The first byte of a pixel is
689// always double word aligned.
690// Each pixel contains red (R), green (G), blue (B) and optionally
691// alpha (A) values.
692// The byte order is BGRx (the last byte unused if no alpha channel) or
693// BGRA.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700694//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700695// The pixels in a horizontal line (also called scan line) are stored
696// side by side, with left most
697// pixel stored first (with lower memory address). Each scan line uses
698// width*4 bytes.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700699//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700700// Scan lines are stored one after another, with top most scan line
701// stored first. There is no gap
Tom Sepez9857e202015-05-13 17:09:26 -0700702// between adjacent scan lines.
703//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700704// This function allocates enough memory for holding all pixels in the
705// bitmap, but it doesn't
706// initialize the buffer. Applications can use FPDFBitmap_FillRect to
707// fill the bitmap using any color.
708DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width,
709 int height,
710 int alpha);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700711
712// More DIB formats
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700713#define FPDFBitmap_Gray 1 // Gray scale bitmap, one byte per pixel.
714#define FPDFBitmap_BGR 2 // 3 bytes per pixel, byte order: blue, green, red.
715#define FPDFBitmap_BGRx \
716 3 // 4 bytes per pixel, byte order: blue, green, red, unused.
717#define FPDFBitmap_BGRA \
718 4 // 4 bytes per pixel, byte order: blue, green, red, alpha.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700719
720// Function: FPDFBitmap_CreateEx
Tom Sepez9857e202015-05-13 17:09:26 -0700721// Create a Foxit Device Independent Bitmap (FXDIB)
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700722// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700723// width - Number of pixels in a horizontal line of the bitmap.
724// Must be greater than 0.
725// height - Number of pixels in a vertical line of the bitmap.
726// Must be greater than 0.
727// format - A number indicating for bitmap format, as defined
728// above.
729// first_scan - A pointer to the first byte of first scan line, for
730// external buffer
731// only. If this parameter is NULL, then the SDK will
732// create its own buffer.
733// stride - Number of bytes for each scan line, for external
734// buffer only..
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700735// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700736// The created bitmap handle, or NULL if parameter error or out of
737// memory.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700738// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700739// Similar to FPDFBitmap_Create function, with more formats and
740// external buffer supported.
741// Bitmap created by this function can be used in any place that a
742// FPDF_BITMAP handle is
Tom Sepez9857e202015-05-13 17:09:26 -0700743// required.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700744//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700745// If external scanline buffer is used, then the application should
746// destroy the buffer
Tom Sepez9857e202015-05-13 17:09:26 -0700747// by itself. FPDFBitmap_Destroy function will not destroy the buffer.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700748//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700749DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width,
750 int height,
751 int format,
752 void* first_scan,
753 int stride);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700754
755// Function: FPDFBitmap_FillRect
Tom Sepez9857e202015-05-13 17:09:26 -0700756// Fill a rectangle area in an FXDIB.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700757// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700758// bitmap - The handle to the bitmap. Returned by
759// FPDFBitmap_Create function.
760// left - The left side position. Starting from 0 at the
761// left-most pixel.
762// top - The top side position. Starting from 0 at the
763// top-most scan line.
Tom Sepez9857e202015-05-13 17:09:26 -0700764// width - Number of pixels to be filled in each scan line.
765// height - Number of scan lines to be filled.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700766// color - A 32-bit value specifing the color, in 8888 ARGB
767// format.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700768// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700769// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700770// Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700771// This function set the color and (optionally) alpha value in
772// specified region of the bitmap.
773// NOTE: If alpha channel is used, this function does NOT composite the
774// background with the source color,
775// instead the background will be replaced by the source color and
776// alpha.
Tom Sepez9857e202015-05-13 17:09:26 -0700777// If alpha channel is not used, the "alpha" parameter is ignored.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700778//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700779DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
780 int left,
781 int top,
782 int width,
783 int height,
784 FPDF_DWORD color);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700785
786// Function: FPDFBitmap_GetBuffer
Tom Sepez9857e202015-05-13 17:09:26 -0700787// Get data buffer of an FXDIB
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700788// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700789// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
790// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700791// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700792// The pointer to the first byte of the bitmap buffer.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700793// Comments:
Tom Sepez9857e202015-05-13 17:09:26 -0700794// The stride may be more than width * number of bytes per pixel
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700795// Applications can use this function to get the bitmap buffer pointer,
796// then manipulate any color
Tom Sepez9857e202015-05-13 17:09:26 -0700797// and/or alpha values for any pixels in the bitmap.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700798DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);
799
800// Function: FPDFBitmap_GetWidth
Tom Sepez9857e202015-05-13 17:09:26 -0700801// Get width of an FXDIB.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700802// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700803// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
804// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700805// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700806// The number of pixels in a horizontal line of the bitmap.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700807DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap);
808
809// Function: FPDFBitmap_GetHeight
Tom Sepez9857e202015-05-13 17:09:26 -0700810// Get height of an FXDIB.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700811// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700812// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
813// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700814// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700815// The number of pixels in a vertical line of the bitmap.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700816DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap);
817
818// Function: FPDFBitmap_GetStride
Tom Sepez9857e202015-05-13 17:09:26 -0700819// Get number of bytes for each scan line in the bitmap buffer.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700820// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700821// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
822// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700823// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700824// The number of bytes for each scan line in the bitmap buffer.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700825// Comments:
Tom Sepez9857e202015-05-13 17:09:26 -0700826// The stride may be more than width * number of bytes per pixel
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700827DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap);
828
829// Function: FPDFBitmap_Destroy
Tom Sepez9857e202015-05-13 17:09:26 -0700830// Destroy an FXDIB and release all related buffers.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700831// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700832// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
833// function.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700834// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700835// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700836// Comments:
Tom Sepez9857e202015-05-13 17:09:26 -0700837// This function will not destroy any external buffer.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700838//
839DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap);
840
841// Function: FPDF_VIEWERREF_GetPrintScaling
Tom Sepez9857e202015-05-13 17:09:26 -0700842// Whether the PDF document prefers to be scaled or not.
843// Parameters:
844// document - Handle to the loaded document.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700845// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700846// None.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700847//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700848DLLEXPORT FPDF_BOOL STDCALL
849FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700850
Bo Xu9114e832014-07-14 13:22:47 -0700851// Function: FPDF_VIEWERREF_GetNumCopies
Tom Sepez9857e202015-05-13 17:09:26 -0700852// Returns the number of copies to be printed.
Bo Xu9114e832014-07-14 13:22:47 -0700853// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700854// document - Handle to the loaded document.
Bo Xu9114e832014-07-14 13:22:47 -0700855// Return value:
856// The number of copies to be printed.
857//
858DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document);
859
860// Function: FPDF_VIEWERREF_GetPrintPageRange
Tom Sepez9857e202015-05-13 17:09:26 -0700861// Page numbers to initialize print dialog box when file is printed.
Bo Xu9114e832014-07-14 13:22:47 -0700862// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700863// document - Handle to the loaded document.
Bo Xu9114e832014-07-14 13:22:47 -0700864// Return value:
865// The print page range to be used for printing.
866//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700867DLLEXPORT FPDF_PAGERANGE STDCALL
868FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document);
Bo Xu9114e832014-07-14 13:22:47 -0700869
870// Function: FPDF_VIEWERREF_GetDuplex
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700871// Returns the paper handling option to be used when printing from
872// print dialog.
Bo Xu9114e832014-07-14 13:22:47 -0700873// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700874// document - Handle to the loaded document.
Bo Xu9114e832014-07-14 13:22:47 -0700875// Return value:
876// The paper handling option to be used when printing.
877//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700878DLLEXPORT FPDF_DUPLEXTYPE STDCALL
879FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document);
Bo Xu9114e832014-07-14 13:22:47 -0700880
Bo Xu4d62b6b2015-01-10 22:52:59 -0800881// Function: FPDF_CountNamedDests
Tom Sepez9857e202015-05-13 17:09:26 -0700882// Get the count of named destinations in the PDF document.
Bo Xu4d62b6b2015-01-10 22:52:59 -0800883// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700884// document - Handle to a document
Bo Xu4d62b6b2015-01-10 22:52:59 -0800885// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700886// The count of named destinations.
Bo Xu4d62b6b2015-01-10 22:52:59 -0800887DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document);
888
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700889// Function: FPDF_GetNamedDestByName
Tom Sepez9857e202015-05-13 17:09:26 -0700890// get a special dest handle by the index.
891// Parameters:
892// document - Handle to the loaded document.
893// name - The name of a special named dest.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700894// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700895// The handle of the dest.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700896//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700897DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,
898 FPDF_BYTESTRING name);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700899
Bo Xu4d62b6b2015-01-10 22:52:59 -0800900// Function: FPDF_GetNamedDest
Tom Sepez9857e202015-05-13 17:09:26 -0700901// Get the specified named destinations of the PDF document by index.
Bo Xu4d62b6b2015-01-10 22:52:59 -0800902// Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700903// document - Handle to a document
904// index - The index of named destination.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700905// buffer - The buffer to obtain destination name, used as
906// wchar_t*.
907// buflen [in/out] - Size of the buffer in bytes on input, length of
908// the result in bytes on output or -1 if the buffer is too small.
Bo Xu4d62b6b2015-01-10 22:52:59 -0800909// Return value:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700910// The destination handle of a named destination, or NULL if no named
911// destination corresponding to |index|.
Bo Xu4d62b6b2015-01-10 22:52:59 -0800912// Comments:
Tom Sepez9857e202015-05-13 17:09:26 -0700913// Call this function twice to get the name of the named destination:
914// 1) First time pass in |buffer| as NULL and get buflen.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700915// 2) Second time pass in allocated |buffer| and buflen to retrieve
916// |buffer|, which should be used as wchar_t*.
917// If buflen is not sufficiently large, it will be set to -1 upon
918// return.
Bo Xu4d62b6b2015-01-10 22:52:59 -0800919//
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700920DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document,
921 int index,
922 void* buffer,
923 long* buflen);
Bo Xu4d62b6b2015-01-10 22:52:59 -0800924
Tom Sepez9857e202015-05-13 17:09:26 -0700925// Function: FPDF_BStr_Init
926// Helper function to initialize a byte string.
Bo Xufdc00a72014-10-28 23:03:33 -0700927DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str);
928
Tom Sepez9857e202015-05-13 17:09:26 -0700929// Function: FPDF_BStr_Set
930// Helper function to set string data.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700931DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str,
932 FPDF_LPCSTR bstr,
933 int length);
Bo Xufdc00a72014-10-28 23:03:33 -0700934
Tom Sepez9857e202015-05-13 17:09:26 -0700935// Function: FPDF_BStr_Clear
936// Helper function to clear a byte string.
Bo Xufdc00a72014-10-28 23:03:33 -0700937DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str);
938
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700939#ifdef __cplusplus
Tom Sepez9857e202015-05-13 17:09:26 -0700940}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700941#endif
942
Tom Sepez9857e202015-05-13 17:09:26 -0700943#endif // PUBLIC_FPDFVIEW_H_