1e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Copyright 2014 PDFium Authors. All rights reserved. 2e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Use of this source code is governed by a BSD-style license that can be 3e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// found in the LICENSE file. 4e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 5e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 7e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// NOTE: External docs refer to this file as "fpdfview.h", so do not rename 8e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// despite lack of consitency with other public files. 9e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 10e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifndef PUBLIC_FPDFVIEW_H_ 11e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define PUBLIC_FPDFVIEW_H_ 12e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 13e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#if defined(_WIN32) && !defined(__WINDOWS__) 14e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#include <windows.h> 15e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif 16e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 17ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 18ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// TODO: remove the #define when XFA is officially in pdfium 19ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define PDF_USE_XFA 20ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif // PDF_ENABLE_XFA 21e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 22e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// PDF types 23ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_ACTION; 24e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef void* FPDF_BITMAP; 25e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef void* FPDF_BOOKMARK; 26ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_CLIPPATH; 27e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef void* FPDF_DEST; 28ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_DOCSCHHANDLE; 29ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_DOCUMENT; 30ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_FONT; 31ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_HMODULE; 32e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef void* FPDF_LINK; 33ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_MODULEMGR; 34ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_PAGE; 35ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_PAGELINK; 36ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc) 37e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef void* FPDF_PAGERANGE; 38ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_PATH; 39ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_SCHHANDLE; 40ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_TEXTPAGE; 41ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 42ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 43ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_STRINGHANDLE; 44ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_WIDGET; 45ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif // PDF_ENABLE_XFA 46e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 47e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Basic data types 48e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef int FPDF_BOOL; 49e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef int FPDF_ERROR; 50e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef unsigned long FPDF_DWORD; 51e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef float FS_FLOAT; 52e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 53ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 54ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_LPVOID; 55ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void const* FPDF_LPCVOID; 56ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef char const* FPDF_LPCSTR; 57ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef int FPDF_RESULT; 58ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif 59ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 60e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Duplex types 61e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef enum _FPDF_DUPLEXTYPE_ { 62ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann DuplexUndefined = 0, 63ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann Simplex, 64ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann DuplexFlipShortEdge, 65ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann DuplexFlipLongEdge 66e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} FPDF_DUPLEXTYPE; 67e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 68e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// String types 69e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef unsigned short FPDF_WCHAR; 70e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef unsigned char const* FPDF_LPCBYTE; 71e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 72ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE 73ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// encoded), and platform dependent string 74e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef const char* FPDF_BYTESTRING; 75e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 76ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDFSDK always uses UTF-16LE encoded wide strings, each character uses 2 77ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bytes (except surrogation), with the low byte first. 78ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef const unsigned short* FPDF_WIDESTRING; 79ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 80ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 81ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Structure for a byte string. 82ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Note, a byte string commonly means a UTF-16LE formated string. 83ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef struct _FPDF_BSTR { 84ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // String buffer. 85ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann char* str; 86ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Length of the string, in bytes. 87ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int len; 88ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann} FPDF_BSTR; 89ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif // PDF_ENABLE_XFA 90ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 91ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// For Windows programmers: In most cases it's OK to treat FPDF_WIDESTRING as a 92ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Windows unicode string, however, special care needs to be taken if you 93ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// expect to process Unicode larger than 0xffff. 94ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 95ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// For Linux/Unix programmers: most compiler/library environments use 4 bytes 96ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// for a Unicode character, and you have to convert between FPDF_WIDESTRING and 97ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// system wide string by yourself. 98e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifdef _WIN32_WCE 99e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef const unsigned short* FPDF_STRING; 100e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#else 101e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef const char* FPDF_STRING; 102e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif 103e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 104ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Matrix for transformation. 105ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef struct _FS_MATRIX_ { 106ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float a; 107ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float b; 108ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float c; 109ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float d; 110ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float e; 111ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float f; 112e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} FS_MATRIX; 113e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 114ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Rectangle area(float) in device or page coordinate system. 115ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef struct _FS_RECTF_ { 116ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The x-coordinate of the left-top corner. 117ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float left; 118ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The y-coordinate of the left-top corner. 119ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float top; 120ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The x-coordinate of the right-bottom corner. 121ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float right; 122ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The y-coordinate of the right-bottom corner. 123ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float bottom; 124ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann} * FS_LPRECTF, FS_RECTF; 125ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 126ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Const Pointer to FS_RECTF structure. 127e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef const FS_RECTF* FS_LPCRECTF; 128e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 129e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#if defined(_WIN32) && defined(FPDFSDK_EXPORTS) 130e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// On Windows system, functions are exported in a DLL 131ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define DLLEXPORT __declspec(dllexport) 132e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define STDCALL __stdcall 133e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#else 134e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define DLLEXPORT 135e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define STDCALL 136e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif 137e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 138e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Exported Functions 139e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifdef __cplusplus 140e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovextern "C" { 141e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif 142e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 143e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_InitLibrary 144e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Initialize the FPDFSDK library 145e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 146e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None 147e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 148e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 149e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 150ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Convenience function to call FPDF_InitLibraryWithConfig() for 151ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// backwards comatibility purposes. 152e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT void STDCALL FPDF_InitLibrary(); 153e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 154ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Process-wide options for initializing the library. 155ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef struct FPDF_LIBRARY_CONFIG_ { 156ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Version number of the interface. Currently must be 2. 157ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int version; 158ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 159ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Array of paths to scan in place of the defaults when using built-in 160ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // FXGE font loading code. The array is terminated by a NULL pointer. 161ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The Array may be NULL itself to use the default paths. May be ignored 162ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // entirely depending upon the platform. 163ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann const char** m_pUserFontPaths; 164ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 165ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Version 2. 166ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 167ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // pointer to the v8::Isolate to use, or NULL to force PDFium to create one. 168ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void* m_pIsolate; 169ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 170ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The embedder data slot to use in the v8::Isolate to store PDFium's 171ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // per-isolate data. The value needs to be between 0 and 172ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // v8::Internals::kNumIsolateDataLots (exclusive). Note that 0 is fine 173ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // for most embedders. 174ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann unsigned int m_v8EmbedderSlot; 175ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann} FPDF_LIBRARY_CONFIG; 176ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 177ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Function: FPDF_InitLibraryWithConfig 178ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Initialize the FPDFSDK library 179ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Parameters: 180ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// config - configuration information as above. 181ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Return value: 182ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// None. 183ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Comments: 184ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// You have to call this function before you can call any PDF 185ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// processing functions. 186ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( 187ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann const FPDF_LIBRARY_CONFIG* config); 188ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 189e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_DestroyLibary 190e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Release all resources allocated by the FPDFSDK library. 191e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 192e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 193e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 194e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 195e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 196ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// You can call this function to release all memory blocks allocated by 197ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the library. 198ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// After this function is called, you should not call any PDF 199ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// processing functions. 200e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT void STDCALL FPDF_DestroyLibrary(); 201e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 202ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Policy for accessing the local machine time. 203ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_POLICY_MACHINETIME_ACCESS 0 204e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 205e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_SetSandBoxPolicy 206e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Set the policy for the sandbox environment. 207e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 208ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// policy - The specified policy for setting, for example: 209ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDF_POLICY_MACHINETIME_ACCESS. 210ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// enable - True to enable, false to disable the policy. 211e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 212e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 213ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, 214ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_BOOL enable); 215e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 216e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_LoadDocument 217e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Open and load a PDF document. 218e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 219ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// file_path - Path to the PDF file (including extension). 220ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// password - A string used as the password for the PDF file. 221ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If no password is needed, empty or NULL can be used. 222e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 223e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// A handle to the loaded document, or NULL on failure. 224e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 225e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Loaded document can be closed by FPDF_CloseDocument(). 226e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// If this function fails, you can use FPDF_GetLastError() to retrieve 227e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// the reason why it failed. 228e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, 229ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_BYTESTRING password); 230e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 231e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_LoadMemDocument 232e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Open and load a PDF document from memory. 233e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 234e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// data_buf - Pointer to a buffer containing the PDF document. 235e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size - Number of bytes in the PDF document. 236ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// password - A string used as the password for the PDF file. 237ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If no password is needed, empty or NULL can be used. 238e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 239ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// A handle to the loaded document, or NULL on failure. 240e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 241e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The memory buffer must remain valid when the document is open. 242ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The loaded document can be closed by FPDF_CloseDocument. 243e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// If this function fails, you can use FPDF_GetLastError() to retrieve 244ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the reason why it failed. 245ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Notes: 246ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If PDFium is built with the XFA module, the application should call 247ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDF_LoadXFA() function after the PDF document loaded to support XFA 248ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// fields defined in the fpdfformfill.h file. 249e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, 250ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int size, 251ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_BYTESTRING password); 252e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 253e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Structure for custom file access. 254e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef struct { 255ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // File length, in bytes. 256ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann unsigned long m_FileLen; 257ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 258ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // A function pointer for getting a block of data from a specific position. 259ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Position is specified by byte offset from the beginning of the file. 260ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The position and size will never go out of range of the file length. 261ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // It may be possible for FPDFSDK to call this function multiple times for 262ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // the same position. 263ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Return value: should be non-zero if successful, zero for error. 264ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int (*m_GetBlock)(void* param, 265ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann unsigned long position, 266ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann unsigned char* pBuf, 267ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann unsigned long size); 268ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 269ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // A custom pointer for all implementation specific data. This pointer will 270ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // be used as the first parameter to the m_GetBlock callback. 271ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void* m_Param; 272e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} FPDF_FILEACCESS; 273e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 274ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 275ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann/** 276ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Structure for file reading or writing (I/O). 277ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 278ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @note This is a handler and should be implemented by callers. 279ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 280ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef struct _FPDF_FILEHANDLER { 281ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 282ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief User-defined data. 283ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @note Callers can use this field to track controls. 284ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 285ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_LPVOID clientData; 286ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 287ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to release the current file stream object. 288ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 289ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 290ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 291ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return None. 292ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 293ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void (*Release)(FPDF_LPVOID clientData); 294ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 295ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to retrieve the current file stream size. 296ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 297ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 298ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 299ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return Size of file stream. 300ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 301ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_DWORD (*GetSize)(FPDF_LPVOID clientData); 302ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 303ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to read data from the current file stream. 304ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 305ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 306ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] offset Offset position starts from the beginning of file 307ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * stream. This parameter indicates reading position. 308ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] buffer Memory buffer to store data which are read from 309ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * file stream. This parameter should not be <b>NULL</b>. 310ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] size Size of data which should be read from file 311ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * stream, in bytes. The buffer indicated by the parameter <i>buffer</i> 312ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * should be enough to store specified data. 313ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 314ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return 0 for success, other value for failure. 315ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 316ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_RESULT (*ReadBlock)(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPVOID buffer, FPDF_DWORD size); 317ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 318ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to write data into the current file stream. 319ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 320ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 321ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] offset Offset position starts from the beginning of file 322ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * stream. This parameter indicates writing position. 323ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] buffer Memory buffer contains data which is written into 324ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * file stream. This parameter should not be <b>NULL</b>. 325ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] size Size of data which should be written into file 326ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * stream, in bytes. 327ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 328ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return 0 for success, other value for failure. 329ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 330ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_RESULT (*WriteBlock)(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPCVOID buffer, FPDF_DWORD size); 331ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 332ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to flush all internal accessing buffers. 333ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 334ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 335ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 336ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return 0 for success, other value for failure. 337ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 338ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_RESULT (*Flush)(FPDF_LPVOID clientData); 339ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 340ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to change file size. 341ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 342ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @details This function is called under writing mode usually. Implementer 343ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * can determine whether to realize it based on application requests. 344ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 345ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 346ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] size New size of file stream, in bytes. 347ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 348ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return 0 for success, other value for failure. 349ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 350ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size); 351ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 352ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann} FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER; 353ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 354ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif 355e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_LoadCustomDocument 356e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Load PDF document from a custom access descriptor. 357e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 358ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// pFileAccess - A structure for accessing the file. 359e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// password - Optional password for decrypting the PDF file. 360e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 361ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// A handle to the loaded document, or NULL on failure. 362e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 363ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The application must keep the file resources valid until the PDF 364ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document is closed. 365ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 366ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The loaded document can be closed with FPDF_CloseDocument. 367ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Notes: 368ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If PDFium is built with the XFA module, the application should call 369ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDF_LoadXFA() function after the PDF document loaded to support XFA 370ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// fields defined in the fpdfformfill.h file. 371ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_DOCUMENT STDCALL 372ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannFPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password); 373e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 374e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetFileVersion 375ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get the file version of the given PDF document. 376e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 377ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// doc - Handle to a document. 378ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// fileVersion - The PDF file version. File version: 14 for 1.4, 15 379ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// for 1.5, ... 380e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 381ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// True if succeeds, false otherwise. 382e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 383ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If the document was created by FPDF_CreateNewDocument, 384ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// then this function will always fail. 385ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, 386ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int* fileVersion); 387ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 388ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_SUCCESS 0 // No error. 389ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_UNKNOWN 1 // Unknown error. 390ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_FILE 2 // File not found or could not be opened. 391ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted. 392ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_PASSWORD 4 // Password required or incorrect password. 393ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_SECURITY 5 // Unsupported security scheme. 394ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_PAGE 6 // Page not found or content error. 395ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 396ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_XFALOAD 7 // Load XFA error. 397ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_XFALAYOUT 8 // Layout XFA error. 398ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif // PDF_ENABLE_XFA 399e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 400e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetLastError 401ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get last error code when a function fails. 402e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 403e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 404e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 405ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// A 32-bit integer indicating error code as defined above. 406e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 407ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If the previous SDK call succeeded, the return value of this 408ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// function is not defined. 409e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT unsigned long STDCALL FPDF_GetLastError(); 410e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 411e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetDocPermission 412e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Get file permission flags of the document. 413e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 414ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document - Handle to a document. Returned by FPDF_LoadDocument. 415e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 416ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// A 32-bit integer indicating permission flags. Please refer to the 417ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// PDF Reference for detailed descriptions. If the document is not 418ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// protected, 0xffffffff will be returned. 419e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document); 420e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 421e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetSecurityHandlerRevision 422ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get the revision for the security handler. 423e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 424ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document - Handle to a document. Returned by FPDF_LoadDocument. 425e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 426ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The security handler revision number. Please refer to the PDF 427ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Reference for a detailed description. If the document is not 428ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// protected, -1 will be returned. 429e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document); 430e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 431e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetPageCount 432ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get total number of pages in the document. 433e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 434ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document - Handle to document. Returned by FPDF_LoadDocument. 435e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 436e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Total number of pages in the document. 437e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document); 438e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 439e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_LoadPage 440ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Load a page inside the document. 441e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 442ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document - Handle to document. Returned by FPDF_LoadDocument 443e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// page_index - Index number of the page. 0 for the first page. 444e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 445ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// A handle to the loaded page, or NULL if page load fails. 446e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 447ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The loaded page can be rendered to devices using FPDF_RenderPage. 448ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The loaded page can be closed using FPDF_ClosePage. 449ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, 450ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int page_index); 451e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 452e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetPageWidth 453e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Get page width. 454e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 455ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 456e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 457e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Page width (excluding non-displayable area) measured in points. 458e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// One point is 1/72 inch (around 0.3528 mm). 459e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page); 460e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 461e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetPageHeight 462e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Get page height. 463e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 464ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 465e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 466e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Page height (excluding non-displayable area) measured in points. 467e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// One point is 1/72 inch (around 0.3528 mm) 468e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page); 469e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 470e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetPageSizeByIndex 471ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get the size of the page at the given index. 472e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 473ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document - Handle to document. Returned by FPDF_LoadDocument. 474e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// page_index - Page index, zero for the first page. 475ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// width - Pointer to a double to receive the page width 476ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// (in points). 477ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// height - Pointer to a double to receive the page height 478ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// (in points). 479e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 480e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Non-zero for success. 0 for error (document or page not found). 481ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, 482ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int page_index, 483ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann double* width, 484ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann double* height); 485ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 486ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Page rendering flags. They can be combined with bit-wise OR. 487e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 488ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set if annotations are to be rendered. 489ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ANNOT 0x01 490ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set if using text rendering optimized for LCD display. 491ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_LCD_TEXT 0x02 492ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Don't use the native text output available on some platforms 493ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_NO_NATIVETEXT 0x04 494ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Grayscale output. 495ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_GRAYSCALE 0x08 496ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set if you want to get some debug info. 497ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_DEBUG_INFO 0x80 498ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set if you don't want to catch exceptions. 499ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_NO_CATCH 0x100 500ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Limit image cache size. 501ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 502ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Always use halftone for image stretching. 503ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_RENDER_FORCEHALFTONE 0x400 504ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Render for printing. 505ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_PRINTING 0x800 506ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set to disable anti-aliasing on text. 507ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_RENDER_NO_SMOOTHTEXT 0x1000 508ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set to disable anti-aliasing on images. 509ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_RENDER_NO_SMOOTHIMAGE 0x2000 510ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set to disable anti-aliasing on paths. 511ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_RENDER_NO_SMOOTHPATH 0x4000 512ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set whether to render in a reverse Byte order, this flag is only used when 513ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// rendering to a bitmap. 514ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_REVERSE_BYTE_ORDER 0x10 515ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 516e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifdef _WIN32 517e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_RenderPage 518ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Render contents of a page to a device (screen, bitmap, or printer). 519ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// This function is only supported on Windows. 520ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Parameters: 521ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// dc - Handle to the device context. 522ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 523ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_x - Left pixel position of the display area in 524ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device coordinates. 525ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_y - Top pixel position of the display area in device 526ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// coordinates. 527e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 528e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 529ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// rotate - Page orientation: 530ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 0 (normal) 531ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 1 (rotated 90 degrees clockwise) 532ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 2 (rotated 180 degrees) 533ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 3 (rotated 90 degrees counter-clockwise) 534ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// flags - 0 for normal display, or combination of flags 535ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// defined above. 536e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 537e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 538ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, 539ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_PAGE page, 540ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int start_x, 541ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int start_y, 542ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int size_x, 543ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int size_y, 544ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int rotate, 545ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int flags); 546e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif 547e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 548e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_RenderPageBitmap 549ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Render contents of a page to a device independent bitmap. 550ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Parameters: 551ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap - Handle to the device independent bitmap (as the 552ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// output buffer). The bitmap handle can be created 553ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// by FPDFBitmap_Create. 554ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage 555ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_x - Left pixel position of the display area in 556ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap coordinates. 557ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_y - Top pixel position of the display area in bitmap 558ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// coordinates. 559e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 560e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 561ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// rotate - Page orientation: 562ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 0 (normal) 563ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 1 (rotated 90 degrees clockwise) 564ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 2 (rotated 180 degrees) 565ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 3 (rotated 90 degrees counter-clockwise) 566ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// flags - 0 for normal display, or combination of flags 567ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// defined above. 568e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 569e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 570ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, 571ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_PAGE page, 572ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int start_x, 573ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int start_y, 574ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int size_x, 575ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int size_y, 576ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int rotate, 577ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int flags); 578e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 579e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_ClosePage 580e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Close a loaded PDF page. 581e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 582e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// page - Handle to the loaded page. 583e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 584e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 585e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); 586e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 587e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_CloseDocument 588e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Close a loaded PDF document. 589e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 590e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 591e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 592e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 593e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); 594e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 595e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_DeviceToPage 596ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Convert the screen coordinates of a point to page coordinates. 597e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 598ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 599ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_x - Left pixel position of the display area in 600ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device coordinates. 601ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_y - Top pixel position of the display area in device 602ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// coordinates. 603e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 604e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 605ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// rotate - Page orientation: 606ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 0 (normal) 607ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 1 (rotated 90 degrees clockwise) 608ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 2 (rotated 180 degrees) 609ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 3 (rotated 90 degrees counter-clockwise) 610ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device_x - X value in device coordinates to be converted. 611ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device_y - Y value in device coordinates to be converted. 612ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page_x - A pointer to a double receiving the converted X 613ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// value in page coordinates. 614ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page_y - A pointer to a double receiving the converted Y 615ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// value in page coordinates. 616e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 617e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 618e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 619ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The page coordinate system has its origin at the left-bottom corner 620ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// of the page, with the X-axis on the bottom going to the right, and 621ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the Y-axis on the left side going up. 622ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 623ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// NOTE: this coordinate system can be altered when you zoom, scroll, 624ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// or rotate a page, however, a point on the page should always have 625e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// the same coordinate values in the page coordinate system. 626e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 627ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The device coordinate system is device dependent. For screen device, 628ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// its origin is at the left-top corner of the window. However this 629ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// origin can be altered by the Windows coordinate transformation 630ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// utilities. 631e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 632ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// You must make sure the start_x, start_y, size_x, size_y 633ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// and rotate parameters have exactly same values as you used in 634ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the FPDF_RenderPage() function call. 635ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, 636ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int start_x, 637ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int start_y, 638ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int size_x, 639ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int size_y, 640ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int rotate, 641ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int device_x, 642ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int device_y, 643ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann double* page_x, 644ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann double* page_y); 645e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 646e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_PageToDevice 647ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Convert the page coordinates of a point to screen coordinates. 648e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 649ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 650ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_x - Left pixel position of the display area in 651ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device coordinates. 652ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_y - Top pixel position of the display area in device 653ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// coordinates. 654e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 655e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 656ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// rotate - Page orientation: 657ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 0 (normal) 658ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 1 (rotated 90 degrees clockwise) 659ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 2 (rotated 180 degrees) 660ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 3 (rotated 90 degrees counter-clockwise) 661ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page_x - X value in page coordinates. 662ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page_y - Y value in page coordinate. 663ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device_x - A pointer to an integer receiving the result X 664ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// value in device coordinates. 665ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device_y - A pointer to an integer receiving the result Y 666ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// value in device coordinates. 667e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 668e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 669e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 670ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// See comments for FPDF_DeviceToPage(). 671ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, 672ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int start_x, 673ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int start_y, 674ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int size_x, 675ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int size_y, 676ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int rotate, 677ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann double page_x, 678ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann double page_y, 679ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int* device_x, 680ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int* device_y); 681e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 682e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_Create 683ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Create a device independent bitmap (FXDIB). 684e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 685ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// width - The number of pixels in width for the bitmap. 686ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Must be greater than 0. 687ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// height - The number of pixels in height for the bitmap. 688ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Must be greater than 0. 689ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// alpha - A flag indicating whether the alpha channel is used. 690ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Non-zero for using alpha, zero for not using. 691e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 692ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The created bitmap handle, or NULL if a parameter error or out of 693ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// memory. 694e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 695ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The bitmap always uses 4 bytes per pixel. The first byte is always 696ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// double word aligned. 697ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 698ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The byte order is BGRx (the last byte unused if no alpha channel) or 699ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// BGRA. 700e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 701ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The pixels in a horizontal line are stored side by side, with the 702ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// left most pixel stored first (with lower memory address). 703ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Each line uses width * 4 bytes. 704e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 705ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Lines are stored one after another, with the top most line stored 706ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// first. There is no gap between adjacent lines. 707e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 708ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// This function allocates enough memory for holding all pixels in the 709ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap, but it doesn't initialize the buffer. Applications can use 710ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDFBitmap_FillRect to fill the bitmap using any color. 711ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, 712ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int height, 713ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int alpha); 714e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 715e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// More DIB formats 716ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Gray scale bitmap, one byte per pixel. 717ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDFBitmap_Gray 1 718ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 3 bytes per pixel, byte order: blue, green, red. 719ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDFBitmap_BGR 2 720ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 4 bytes per pixel, byte order: blue, green, red, unused. 721ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDFBitmap_BGRx 3 722ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 4 bytes per pixel, byte order: blue, green, red, alpha. 723ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDFBitmap_BGRA 4 724e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 725e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_CreateEx 726ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Create a device independent bitmap (FXDIB) 727ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Parameters: 728ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// width - The number of pixels in width for the bitmap. 729ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Must be greater than 0. 730ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// height - The number of pixels in height for the bitmap. 731ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Must be greater than 0. 732ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// format - A number indicating for bitmap format, as defined 733ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// above. 734ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// first_scan - A pointer to the first byte of the first line if 735ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// using an external buffer. If this parameter is NULL, 736ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// then the a new buffer will be created. 737ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// stride - Number of bytes for each scan line, for external 738ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// buffer only. 739ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Return value: 740ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The bitmap handle, or NULL if parameter error or out of memory. 741e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 742ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Similar to FPDFBitmap_Create function, but allows for more formats 743ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// and an external buffer is supported. The bitmap created by this 744ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// function can be used in any place that a FPDF_BITMAP handle is 745e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// required. 746e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 747ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If an external buffer is used, then the application should destroy 748ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the buffer by itself. FPDFBitmap_Destroy function will not destroy 749ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the buffer. 750ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, 751ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int height, 752ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int format, 753ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void* first_scan, 754ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int stride); 755e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 756e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_FillRect 757ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Fill a rectangle in a bitmap. 758ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Parameters: 759ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap - The handle to the bitmap. Returned by 760ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDFBitmap_Create. 761ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// left - The left position. Starting from 0 at the 762ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// left-most pixel. 763ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// top - The top position. Starting from 0 at the 764ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// top-most line. 765ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// width - Width in pixels to be filled. 766ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// height - Height in pixels to be filled. 767ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// color - A 32-bit value specifing the color, in 8888 ARGB 768ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// format. 769e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 770e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 771e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 772ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// This function sets the color and (optionally) alpha value in the 773ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// specified region of the bitmap. 774ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 775ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// NOTE: If the alpha channel is used, this function does NOT 776ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// composite the background with the source color, instead the 777ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// background will be replaced by the source color and the alpha. 778e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 779ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If the alpha channel is not used, the alpha parameter is ignored. 780ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, 781ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int left, 782ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int top, 783ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int width, 784ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int height, 785ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_DWORD color); 786e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 787e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_GetBuffer 788ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get data buffer of a bitmap. 789e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 790ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. 791e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 792e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The pointer to the first byte of the bitmap buffer. 793e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 794e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The stride may be more than width * number of bytes per pixel 795ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 796ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Applications can use this function to get the bitmap buffer pointer, 797ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// then manipulate any color and/or alpha values for any pixels in the 798ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap. 799ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 800ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The data is in BGRA format. Where the A maybe unused if alpha was 801ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// not specified. 802e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); 803e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 804e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_GetWidth 805ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get width of a bitmap. 806e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 807ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. 808e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 809ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The width of the bitmap in pixels. 810e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); 811e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 812e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_GetHeight 813ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get height of a bitmap. 814e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 815ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. 816e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 817ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The height of the bitmap in pixels. 818e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); 819e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 820e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_GetStride 821ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get number of bytes for each line in the bitmap buffer. 822e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 823ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. 824e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 825ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The number of bytes for each line in the bitmap buffer. 826e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 827ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The stride may be more than width * number of bytes per pixel. 828e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap); 829e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 830e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_Destroy 831ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Destroy a bitmap and release all related buffers. 832e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 833ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. 834e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 835e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 836e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 837ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// This function will not destroy any external buffers provided when 838ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the bitmap was created. 839e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); 840e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 841e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_VIEWERREF_GetPrintScaling 842e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Whether the PDF document prefers to be scaled or not. 843e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 844e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 845e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 846e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 847ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_BOOL STDCALL 848ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannFPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); 849e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 850e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_VIEWERREF_GetNumCopies 851e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Returns the number of copies to be printed. 852e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 853e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 854e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 855e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The number of copies to be printed. 856e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); 857e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 858e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_VIEWERREF_GetPrintPageRange 859e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Page numbers to initialize print dialog box when file is printed. 860e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 861e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 862e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 863e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The print page range to be used for printing. 864ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_PAGERANGE STDCALL 865ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannFPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); 866e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 867e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_VIEWERREF_GetDuplex 868ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Returns the paper handling option to be used when printing from 869ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the print dialog. 870e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 871e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 872e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 873e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The paper handling option to be used when printing. 874ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_DUPLEXTYPE STDCALL 875ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannFPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); 876e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 877e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_CountNamedDests 878e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Get the count of named destinations in the PDF document. 879e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 880e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to a document 881e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 882e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The count of named destinations. 883e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovDLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document); 884e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 885e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetNamedDestByName 886ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get a the destination handle for the given name. 887e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 888e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 889ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// name - The name of a destination. 890e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 891ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The handle to the destination. 892ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document, 893ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_BYTESTRING name); 894e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 895e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetNamedDest 896ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get the named destination by index. 897e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 898e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to a document 899ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// index - The index of a named destination. 900ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// buffer - The buffer to store the destination name, 901ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// used as wchar_t*. 902ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// buflen [in/out] - Size of the buffer in bytes on input, 903ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// length of the result in bytes on output 904ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// or -1 if the buffer is too small. 905ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Return value: 906ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The destination handle for a given index, or NULL if there is no 907ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// named destination corresponding to |index|. 908e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 909e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Call this function twice to get the name of the named destination: 910ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 1) First time pass in |buffer| as NULL and get buflen. 911ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 2) Second time pass in allocated |buffer| and buflen to retrieve 912ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// |buffer|, which should be used as wchar_t*. 913e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 914ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If buflen is not sufficiently large, it will be set to -1 upon 915ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// return. 916ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, 917ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int index, 918ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void* buffer, 919ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann long* buflen); 920ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 921ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 922ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Function: FPDF_BStr_Init 923ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Helper function to initialize a byte string. 924ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str); 925ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 926ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Function: FPDF_BStr_Set 927ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Helper function to set string data. 928ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, 929ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_LPCSTR bstr, 930ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int length); 931ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 932ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Function: FPDF_BStr_Clear 933ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Helper function to clear a byte string. 934ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannDLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str); 935ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif // PDF_ENABLE_XFA 936e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 937e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifdef __cplusplus 938e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} 939e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif 940e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 941e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif // PUBLIC_FPDFVIEW_H_ 942