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 84d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// despite lack of consistency 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 184d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// PDF_USE_XFA is set in confirmation that this version of PDFium can support 194d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// XFA forms as requested by the PDF_ENABLE_XFA setting. 20ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define PDF_USE_XFA 21ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif // PDF_ENABLE_XFA 22e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 23d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// PDF object types 24d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_OBJECT_UNKNOWN 0 25d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_OBJECT_BOOLEAN 1 26d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_OBJECT_NUMBER 2 27d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_OBJECT_STRING 3 28d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_OBJECT_NAME 4 29d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_OBJECT_ARRAY 5 30d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_OBJECT_DICTIONARY 6 31d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_OBJECT_STREAM 7 32d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_OBJECT_NULLOBJ 8 33d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_OBJECT_REFERENCE 9 34d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann 35e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// PDF types 36ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_ACTION; 37d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmanntypedef void* FPDF_ANNOTATION; 38d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmanntypedef void* FPDF_ATTACHMENT; 39e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef void* FPDF_BITMAP; 40e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef void* FPDF_BOOKMARK; 41ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_CLIPPATH; 42e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef void* FPDF_DEST; 43ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_DOCUMENT; 44ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_FONT; 45e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef void* FPDF_LINK; 46ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_PAGE; 47ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_PAGELINK; 48ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc) 49e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef void* FPDF_PAGERANGE; 504d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmanntypedef void* FPDF_RECORDER; 51ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_SCHHANDLE; 524d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmanntypedef void* FPDF_STRUCTELEMENT; 534d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmanntypedef void* FPDF_STRUCTTREE; 54ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_TEXTPAGE; 55d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmanntypedef void const* FPDF_PATHSEGMENT; 56ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 57ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 58ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_STRINGHANDLE; 59ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_WIDGET; 60ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif // PDF_ENABLE_XFA 61e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 62e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Basic data types 63e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef int FPDF_BOOL; 64e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef int FPDF_ERROR; 65e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef unsigned long FPDF_DWORD; 66e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef float FS_FLOAT; 67e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 68ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 69ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void* FPDF_LPVOID; 70ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef void const* FPDF_LPCVOID; 71ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef char const* FPDF_LPCSTR; 72ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef int FPDF_RESULT; 73ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif 74ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 75e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Duplex types 76e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef enum _FPDF_DUPLEXTYPE_ { 77ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann DuplexUndefined = 0, 78ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann Simplex, 79ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann DuplexFlipShortEdge, 80ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann DuplexFlipLongEdge 81e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} FPDF_DUPLEXTYPE; 82e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 83e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// String types 84e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef unsigned short FPDF_WCHAR; 85e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef unsigned char const* FPDF_LPCBYTE; 86e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 87ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE 88ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// encoded), and platform dependent string 89e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef const char* FPDF_BYTESTRING; 90e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 91ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDFSDK always uses UTF-16LE encoded wide strings, each character uses 2 92ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bytes (except surrogation), with the low byte first. 93ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef const unsigned short* FPDF_WIDESTRING; 94ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 95ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 96ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Structure for a byte string. 97ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Note, a byte string commonly means a UTF-16LE formated string. 98ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef struct _FPDF_BSTR { 99ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // String buffer. 100ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann char* str; 101ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Length of the string, in bytes. 102ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int len; 103ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann} FPDF_BSTR; 104ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif // PDF_ENABLE_XFA 105ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 106ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// For Windows programmers: In most cases it's OK to treat FPDF_WIDESTRING as a 107ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Windows unicode string, however, special care needs to be taken if you 108ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// expect to process Unicode larger than 0xffff. 109ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 110ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// For Linux/Unix programmers: most compiler/library environments use 4 bytes 111ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// for a Unicode character, and you have to convert between FPDF_WIDESTRING and 112ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// system wide string by yourself. 113e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef const char* FPDF_STRING; 114e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 115d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Matrix for transformation, in the form [a b c d e f], equivalent to: 116d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// | a b 0 | 117d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// | c d 0 | 118d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// | e f 1 | 119d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// 120d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Translation is performed with [1 0 0 1 tx ty]. 121d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Scaling is performed with [sx 0 0 sy 0 0]. 122d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// See PDF Reference 1.7, 4.2.2 Common Transformations for more. 123ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef struct _FS_MATRIX_ { 124ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float a; 125ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float b; 126ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float c; 127ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float d; 128ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float e; 129ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float f; 130e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} FS_MATRIX; 131e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 132ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Rectangle area(float) in device or page coordinate system. 133ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef struct _FS_RECTF_ { 134ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The x-coordinate of the left-top corner. 135ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float left; 136ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The y-coordinate of the left-top corner. 137ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float top; 138ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The x-coordinate of the right-bottom corner. 139ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float right; 140ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The y-coordinate of the right-bottom corner. 141ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann float bottom; 142ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann} * FS_LPRECTF, FS_RECTF; 143ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 144ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Const Pointer to FS_RECTF structure. 145e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef const FS_RECTF* FS_LPCRECTF; 146e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 147d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Annotation enums. 148d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmanntypedef int FPDF_ANNOTATION_SUBTYPE; 149d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmanntypedef int FPDF_ANNOT_APPEARANCEMODE; 150d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann 151d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Dictionary value types. 152d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmanntypedef int FPDF_OBJECT_TYPE; 153d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann 154e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#if defined(_WIN32) && defined(FPDFSDK_EXPORTS) 155e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// On Windows system, functions are exported in a DLL 156d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_EXPORT __declspec(dllexport) 157d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_CALLCONV __stdcall 158e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#else 159d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_EXPORT 160d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDF_CALLCONV 161e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif 162e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 163e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Exported Functions 164e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifdef __cplusplus 165e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovextern "C" { 166e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif 167e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 168e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_InitLibrary 169e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Initialize the FPDFSDK library 170e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 171e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None 172e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 173e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 174e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 175ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Convenience function to call FPDF_InitLibraryWithConfig() for 176ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// backwards comatibility purposes. 177d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDF_InitLibrary(); 178e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 179ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Process-wide options for initializing the library. 180ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef struct FPDF_LIBRARY_CONFIG_ { 181ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Version number of the interface. Currently must be 2. 182ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int version; 183ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 184ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Array of paths to scan in place of the defaults when using built-in 185ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // FXGE font loading code. The array is terminated by a NULL pointer. 186ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The Array may be NULL itself to use the default paths. May be ignored 187ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // entirely depending upon the platform. 188ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann const char** m_pUserFontPaths; 189ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 190ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Version 2. 191ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 192ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // pointer to the v8::Isolate to use, or NULL to force PDFium to create one. 193ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void* m_pIsolate; 194ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 195ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The embedder data slot to use in the v8::Isolate to store PDFium's 196ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // per-isolate data. The value needs to be between 0 and 197ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // v8::Internals::kNumIsolateDataLots (exclusive). Note that 0 is fine 198ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // for most embedders. 199ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann unsigned int m_v8EmbedderSlot; 200ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann} FPDF_LIBRARY_CONFIG; 201ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 202ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Function: FPDF_InitLibraryWithConfig 203ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Initialize the FPDFSDK library 204ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Parameters: 205ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// config - configuration information as above. 206ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Return value: 207ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// None. 208ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Comments: 209ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// You have to call this function before you can call any PDF 210ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// processing functions. 211d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV 212d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config); 213ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 214e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_DestroyLibary 215e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Release all resources allocated by the FPDFSDK library. 216e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 217e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 218e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 219e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 220e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 221ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// You can call this function to release all memory blocks allocated by 222ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the library. 223ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// After this function is called, you should not call any PDF 224ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// processing functions. 225d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary(); 226e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 227ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Policy for accessing the local machine time. 228ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_POLICY_MACHINETIME_ACCESS 0 229e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 230e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_SetSandBoxPolicy 231e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Set the policy for the sandbox environment. 232e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 233ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// policy - The specified policy for setting, for example: 234ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDF_POLICY_MACHINETIME_ACCESS. 235ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// enable - True to enable, false to disable the policy. 236e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 237e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 238d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDF_SetSandBoxPolicy(FPDF_DWORD policy, 239d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann FPDF_BOOL enable); 240e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 2414d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann#if defined(_WIN32) 2424d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann#if defined(PDFIUM_PRINT_TEXT_WITH_GDI) 2434d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Pointer to a helper function to make |font| with |text| of |text_length| 2444d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// accessible when printing text with GDI. This is useful in sandboxed 2454d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// environments where PDFium's access to GDI may be restricted. 2464d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmanntypedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, 2474d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann const wchar_t* text, 2484d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann size_t text_length); 2494d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann 2504d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Function: FPDF_SetTypefaceAccessibleFunc 2514d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Set the function pointer that makes GDI fonts available in sandboxed 2524d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// environments. Experimental API. 2534d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Parameters: 2544d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// func - A function pointer. See description above. 2554d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Return value: 2564d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// None. 257d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV 2584d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. MoltmannFPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func); 2594d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann 2604d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Function: FPDF_SetPrintTextWithGDI 2614d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Set whether to use GDI to draw fonts when printing on Windows. 2624d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Experimental API. 2634d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Parameters: 2644d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// use_gdi - Set to true to enable printing text with GDI. 2654d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Return value: 2664d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// None. 267d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi); 2684d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann#endif // PDFIUM_PRINT_TEXT_WITH_GDI 2694d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann 2704d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Function: FPDF_SetPrintPostscriptLevel 2714d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Set postscript printing level when printing on Windows. 2724d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Experimental API. 2734d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Parameters: 274d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// postscript_level- 0 to disable postscript printing, 275d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// 2 to print with postscript level 2, 276d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// 3 to print with postscript level 3. 277d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// All other values are invalid. 2784d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Return value: 279d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// True if successful, false if unsuccessful (typically invalid input). 280d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 281d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_SetPrintPostscriptLevel(int postscript_level); 282d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann 283d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Function: FPDF_SetPrintMode 284d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Set printing mode when printing on Windows. 285d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Experimental API. 286d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Parameters: 287d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// mode - FPDF_PRINTMODE_EMF to output EMF (default) 288d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// FPDF_PRINTMODE_TEXTONLY to output text only (for charstream 289d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// devices) 290d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// FPDF_PRINTMODE_POSTSCRIPT2 to output level 2 postscript 291d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// FPDF_PRINTMODE_POSTSCRIPT3 to output level 3 postscript 292d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Return value: 293d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// True if successful, false if unsuccessful (typically invalid input). 294d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SetPrintMode(int mode); 2954d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann#endif // defined(_WIN32) 2964d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann 297e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_LoadDocument 298e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Open and load a PDF document. 299e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 300ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// file_path - Path to the PDF file (including extension). 301ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// password - A string used as the password for the PDF file. 302ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If no password is needed, empty or NULL can be used. 303e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 304e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// A handle to the loaded document, or NULL on failure. 305e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 306e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Loaded document can be closed by FPDF_CloseDocument(). 307e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// If this function fails, you can use FPDF_GetLastError() to retrieve 308e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// the reason why it failed. 309d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV 310d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_LoadDocument(FPDF_STRING file_path, FPDF_BYTESTRING password); 311e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 312e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_LoadMemDocument 313e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Open and load a PDF document from memory. 314e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 315e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// data_buf - Pointer to a buffer containing the PDF document. 316e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size - Number of bytes in the PDF document. 317ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// password - A string used as the password for the PDF file. 318ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If no password is needed, empty or NULL can be used. 319e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 320ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// A handle to the loaded document, or NULL on failure. 321e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 322e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The memory buffer must remain valid when the document is open. 323ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The loaded document can be closed by FPDF_CloseDocument. 324e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// If this function fails, you can use FPDF_GetLastError() to retrieve 325ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the reason why it failed. 326ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Notes: 327ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If PDFium is built with the XFA module, the application should call 328ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDF_LoadXFA() function after the PDF document loaded to support XFA 329ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// fields defined in the fpdfformfill.h file. 330d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV 331d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_LoadMemDocument(const void* data_buf, int size, FPDF_BYTESTRING password); 332e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 333e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Structure for custom file access. 334e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef struct { 335ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // File length, in bytes. 336ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann unsigned long m_FileLen; 337ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 338ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // A function pointer for getting a block of data from a specific position. 339ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Position is specified by byte offset from the beginning of the file. 340ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // The position and size will never go out of range of the file length. 341ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // It may be possible for FPDFSDK to call this function multiple times for 342ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // the same position. 343ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // Return value: should be non-zero if successful, zero for error. 344ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int (*m_GetBlock)(void* param, 345ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann unsigned long position, 346ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann unsigned char* pBuf, 347ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann unsigned long size); 348ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 349ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // A custom pointer for all implementation specific data. This pointer will 350ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // be used as the first parameter to the m_GetBlock callback. 351ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void* m_Param; 352e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} FPDF_FILEACCESS; 353e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 354ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 355ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann/** 356ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Structure for file reading or writing (I/O). 357ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 358ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @note This is a handler and should be implemented by callers. 359ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 360ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef struct _FPDF_FILEHANDLER { 361ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 362ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief User-defined data. 363ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @note Callers can use this field to track controls. 364ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 365ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_LPVOID clientData; 366ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 367ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to release the current file stream object. 368ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 369ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 370ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 371ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return None. 372ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 373ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void (*Release)(FPDF_LPVOID clientData); 374ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 375ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to retrieve the current file stream size. 376ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 377ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 378ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 379ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return Size of file stream. 380ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 381ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_DWORD (*GetSize)(FPDF_LPVOID clientData); 382ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 383ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to read data from the current file stream. 384ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 385ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 386ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] offset Offset position starts from the beginning of file 387ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * stream. This parameter indicates reading position. 388ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] buffer Memory buffer to store data which are read from 389ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * file stream. This parameter should not be <b>NULL</b>. 390ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] size Size of data which should be read from file 391ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * stream, in bytes. The buffer indicated by the parameter <i>buffer</i> 392ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * should be enough to store specified data. 393ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 394ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return 0 for success, other value for failure. 395ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 3964d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann FPDF_RESULT (*ReadBlock)(FPDF_LPVOID clientData, 3974d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann FPDF_DWORD offset, 3984d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann FPDF_LPVOID buffer, 3994d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann FPDF_DWORD size); 400ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 401ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to write data into the current file stream. 402ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 403ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 404ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] offset Offset position starts from the beginning of file 405ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * stream. This parameter indicates writing position. 406ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] buffer Memory buffer contains data which is written into 407ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * file stream. This parameter should not be <b>NULL</b>. 408ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] size Size of data which should be written into file 409ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * stream, in bytes. 410ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 411ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return 0 for success, other value for failure. 412ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 4134d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann FPDF_RESULT (*WriteBlock)(FPDF_LPVOID clientData, 4144d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann FPDF_DWORD offset, 4154d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann FPDF_LPCVOID buffer, 4164d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann FPDF_DWORD size); 417ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 418ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to flush all internal accessing buffers. 419ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 420ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 421ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 422ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return 0 for success, other value for failure. 423ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 424ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_RESULT (*Flush)(FPDF_LPVOID clientData); 425ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann /** 426ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @brief Callback function to change file size. 427ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 428ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @details This function is called under writing mode usually. Implementer 429ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * can determine whether to realize it based on application requests. 430ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 431ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] clientData Pointer to user-defined data. 432ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @param[in] size New size of file stream, in bytes. 433ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * 434ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann * @return 0 for success, other value for failure. 435ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann */ 436ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size); 437ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann} FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER; 438ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 439ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif 440e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_LoadCustomDocument 441e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Load PDF document from a custom access descriptor. 442e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 443ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// pFileAccess - A structure for accessing the file. 444e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// password - Optional password for decrypting the PDF file. 445e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 446ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// A handle to the loaded document, or NULL on failure. 447e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 448ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The application must keep the file resources valid until the PDF 449ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document is closed. 450ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 451ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The loaded document can be closed with FPDF_CloseDocument. 452ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Notes: 453ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If PDFium is built with the XFA module, the application should call 454ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDF_LoadXFA() function after the PDF document loaded to support XFA 455ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// fields defined in the fpdfformfill.h file. 456d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV 457ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannFPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password); 458e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 459e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetFileVersion 460ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get the file version of the given PDF document. 461e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 462ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// doc - Handle to a document. 463ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// fileVersion - The PDF file version. File version: 14 for 1.4, 15 464ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// for 1.5, ... 465e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 466ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// True if succeeds, false otherwise. 467e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 468ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If the document was created by FPDF_CreateNewDocument, 469ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// then this function will always fail. 470d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_GetFileVersion(FPDF_DOCUMENT doc, 471d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int* fileVersion); 472ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 473ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_SUCCESS 0 // No error. 474ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_UNKNOWN 1 // Unknown error. 475ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_FILE 2 // File not found or could not be opened. 476ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted. 477ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_PASSWORD 4 // Password required or incorrect password. 478ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_SECURITY 5 // Unsupported security scheme. 479ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_PAGE 6 // Page not found or content error. 480ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 481ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_XFALOAD 7 // Load XFA error. 482ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ERR_XFALAYOUT 8 // Layout XFA error. 483ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif // PDF_ENABLE_XFA 484e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 485e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetLastError 486ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get last error code when a function fails. 487e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 488e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 489e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 490ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// A 32-bit integer indicating error code as defined above. 491e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 492ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If the previous SDK call succeeded, the return value of this 493ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// function is not defined. 494d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetLastError(); 495e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 496e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetDocPermission 497e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Get file permission flags of the document. 498e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 499ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document - Handle to a document. Returned by FPDF_LoadDocument. 500e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 501ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// A 32-bit integer indicating permission flags. Please refer to the 502ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// PDF Reference for detailed descriptions. If the document is not 503ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// protected, 0xffffffff will be returned. 504d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT unsigned long FPDF_CALLCONV 505d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_GetDocPermissions(FPDF_DOCUMENT document); 506e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 507e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetSecurityHandlerRevision 508ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get the revision for the security handler. 509e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 510ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document - Handle to a document. Returned by FPDF_LoadDocument. 511e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 512ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The security handler revision number. Please refer to the PDF 513ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Reference for a detailed description. If the document is not 514ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// protected, -1 will be returned. 515d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT int FPDF_CALLCONV 516d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document); 517e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 518e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetPageCount 519ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get total number of pages in the document. 520e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 521ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document - Handle to document. Returned by FPDF_LoadDocument. 522e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 523e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Total number of pages in the document. 524d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageCount(FPDF_DOCUMENT document); 525e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 526e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_LoadPage 527ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Load a page inside the document. 528e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 529ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document - Handle to document. Returned by FPDF_LoadDocument 530e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// page_index - Index number of the page. 0 for the first page. 531e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 532ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// A handle to the loaded page, or NULL if page load fails. 533e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 534ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The loaded page can be rendered to devices using FPDF_RenderPage. 535ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The loaded page can be closed using FPDF_ClosePage. 536d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document, 537d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int page_index); 538e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 539e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetPageWidth 540e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Get page width. 541e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 542ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 543e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 544e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Page width (excluding non-displayable area) measured in points. 545e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// One point is 1/72 inch (around 0.3528 mm). 546d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageWidth(FPDF_PAGE page); 547e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 548e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetPageHeight 549e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Get page height. 550e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 551ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 552e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 553e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Page height (excluding non-displayable area) measured in points. 554e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// One point is 1/72 inch (around 0.3528 mm) 555d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageHeight(FPDF_PAGE page); 556d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann 557d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Experimental API. 558d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Function: FPDF_GetPageBoundingBox 559d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Get the bounding box of the page. This is the intersection between 560d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// its media box and its crop box. 561d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Parameters: 562d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 563d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// rect - Pointer to a rect to receive the page bounding box. 564d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// On an error, |rect| won't be filled. 565d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Return value: 566d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// True for success. 567d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_GetPageBoundingBox(FPDF_PAGE page, 568d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann FS_RECTF* rect); 569e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 570e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetPageSizeByIndex 571ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get the size of the page at the given index. 572e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 573ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// document - Handle to document. Returned by FPDF_LoadDocument. 574e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// page_index - Page index, zero for the first page. 575ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// width - Pointer to a double to receive the page width 576ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// (in points). 577ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// height - Pointer to a double to receive the page height 578ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// (in points). 579e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 580e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Non-zero for success. 0 for error (document or page not found). 581d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, 582d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int page_index, 583d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann double* width, 584d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann double* height); 585ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 586ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Page rendering flags. They can be combined with bit-wise OR. 587e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 588ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set if annotations are to be rendered. 589ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_ANNOT 0x01 590ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set if using text rendering optimized for LCD display. 591ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_LCD_TEXT 0x02 592ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Don't use the native text output available on some platforms 593ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_NO_NATIVETEXT 0x04 594ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Grayscale output. 595ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_GRAYSCALE 0x08 596ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set if you want to get some debug info. 597ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_DEBUG_INFO 0x80 598ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set if you don't want to catch exceptions. 599ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_NO_CATCH 0x100 600ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Limit image cache size. 601ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 602ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Always use halftone for image stretching. 603ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_RENDER_FORCEHALFTONE 0x400 604ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Render for printing. 605ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_PRINTING 0x800 606ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set to disable anti-aliasing on text. 607ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_RENDER_NO_SMOOTHTEXT 0x1000 608ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set to disable anti-aliasing on images. 609ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_RENDER_NO_SMOOTHIMAGE 0x2000 610ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set to disable anti-aliasing on paths. 611ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_RENDER_NO_SMOOTHPATH 0x4000 612ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Set whether to render in a reverse Byte order, this flag is only used when 613ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// rendering to a bitmap. 614ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDF_REVERSE_BYTE_ORDER 0x10 615ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 616e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifdef _WIN32 617e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_RenderPage 618ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Render contents of a page to a device (screen, bitmap, or printer). 619ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// This function is only supported on Windows. 620ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Parameters: 621ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// dc - Handle to the device context. 622ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 623ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_x - Left pixel position of the display area in 624ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device coordinates. 625ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_y - Top pixel position of the display area in device 626ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// coordinates. 627e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 628e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 629ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// rotate - Page orientation: 630ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 0 (normal) 631ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 1 (rotated 90 degrees clockwise) 632ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 2 (rotated 180 degrees) 633ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 3 (rotated 90 degrees counter-clockwise) 634ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// flags - 0 for normal display, or combination of flags 635ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// defined above. 636e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 637e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 638d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage(HDC dc, 639d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann FPDF_PAGE page, 640d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int start_x, 641d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int start_y, 642d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int size_x, 643d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int size_y, 644d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int rotate, 645d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int flags); 646e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif 647e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 648e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_RenderPageBitmap 649ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Render contents of a page to a device independent bitmap. 650ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Parameters: 651ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap - Handle to the device independent bitmap (as the 652ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// output buffer). The bitmap handle can be created 653d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// by FPDFBitmap_Create or retrieved from an image 654d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// object by FPDFImageObj_GetBitmap. 655ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage 656ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_x - Left pixel position of the display area in 657ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap coordinates. 658ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_y - Top pixel position of the display area in bitmap 659ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// coordinates. 660e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 661e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 662ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// rotate - Page orientation: 663ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 0 (normal) 664ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 1 (rotated 90 degrees clockwise) 665ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 2 (rotated 180 degrees) 666ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 3 (rotated 90 degrees counter-clockwise) 6674d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// flags - 0 for normal display, or combination of the Page 6684d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Rendering flags defined above. With the FPDF_ANNOT 6694d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// flag, it renders all annotations that do not require 6704d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// user-interaction, which are all annotations except 6714d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// widget and popup annotations. 672e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 673e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 674d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, 675d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann FPDF_PAGE page, 676d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int start_x, 677d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int start_y, 678d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int size_x, 679d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int size_y, 680d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int rotate, 681d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int flags); 682e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 6834d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Function: FPDF_RenderPageBitmapWithMatrix 6844d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Render contents of a page to a device independent bitmap. 6854d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Parameters: 6864d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// bitmap - Handle to the device independent bitmap (as the 6874d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// output buffer). The bitmap handle can be created 688d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// by FPDFBitmap_Create or retrieved by 689d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// FPDFImageObj_GetBitmap. 690d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 691d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// matrix - The transform matrix, which must be invertible. 692d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// See PDF Reference 1.7, 4.2.2 Common Transformations. 693d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// clipping - The rect to clip to in device coords. 6944d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// flags - 0 for normal display, or combination of the Page 6954d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Rendering flags defined above. With the FPDF_ANNOT 6964d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// flag, it renders all annotations that do not require 6974d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// user-interaction, which are all annotations except 6984d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// widget and popup annotations. 6994d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Return value: 700d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// None. Note that behavior is undefined if det of |matrix| is 0. 701d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV 702d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap, 703d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann FPDF_PAGE page, 704d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann const FS_MATRIX* matrix, 705d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann const FS_RECTF* clipping, 706d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int flags); 7074d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann 7084d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann#ifdef _SKIA_SUPPORT_ 709d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_RECORDER FPDF_CALLCONV FPDF_RenderPageSkp(FPDF_PAGE page, 710d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int size_x, 711d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int size_y); 7124d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann#endif 7134d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann 714e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_ClosePage 715e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Close a loaded PDF page. 716e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 717e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// page - Handle to the loaded page. 718e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 719e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 720d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page); 721e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 722e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_CloseDocument 723e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Close a loaded PDF document. 724e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 725e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 726e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 727e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 728d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDF_CloseDocument(FPDF_DOCUMENT document); 729e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 730e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_DeviceToPage 731ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Convert the screen coordinates of a point to page coordinates. 732e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 733ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 734ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_x - Left pixel position of the display area in 735ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device coordinates. 736ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_y - Top pixel position of the display area in device 737ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// coordinates. 738e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 739e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 740ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// rotate - Page orientation: 741ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 0 (normal) 742ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 1 (rotated 90 degrees clockwise) 743ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 2 (rotated 180 degrees) 744ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 3 (rotated 90 degrees counter-clockwise) 745ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device_x - X value in device coordinates to be converted. 746ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device_y - Y value in device coordinates to be converted. 747ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page_x - A pointer to a double receiving the converted X 748ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// value in page coordinates. 749ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page_y - A pointer to a double receiving the converted Y 750ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// value in page coordinates. 751e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 752e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 753e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 754ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The page coordinate system has its origin at the left-bottom corner 755ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// of the page, with the X-axis on the bottom going to the right, and 756ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the Y-axis on the left side going up. 757ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 758ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// NOTE: this coordinate system can be altered when you zoom, scroll, 759ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// or rotate a page, however, a point on the page should always have 760e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// the same coordinate values in the page coordinate system. 761e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 762ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The device coordinate system is device dependent. For screen device, 763ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// its origin is at the left-top corner of the window. However this 764ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// origin can be altered by the Windows coordinate transformation 765ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// utilities. 766e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 767ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// You must make sure the start_x, start_y, size_x, size_y 768ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// and rotate parameters have exactly same values as you used in 769ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the FPDF_RenderPage() function call. 770d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDF_DeviceToPage(FPDF_PAGE page, 771d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int start_x, 772d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int start_y, 773d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int size_x, 774d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int size_y, 775d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int rotate, 776d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int device_x, 777d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int device_y, 778d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann double* page_x, 779d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann double* page_y); 780e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 781e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_PageToDevice 782ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Convert the page coordinates of a point to screen coordinates. 783e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 784ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page - Handle to the page. Returned by FPDF_LoadPage. 785ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_x - Left pixel position of the display area in 786ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device coordinates. 787ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// start_y - Top pixel position of the display area in device 788ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// coordinates. 789e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 790e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 791ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// rotate - Page orientation: 792ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 0 (normal) 793ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 1 (rotated 90 degrees clockwise) 794ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 2 (rotated 180 degrees) 795ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 3 (rotated 90 degrees counter-clockwise) 796ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page_x - X value in page coordinates. 797ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// page_y - Y value in page coordinate. 798ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device_x - A pointer to an integer receiving the result X 799ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// value in device coordinates. 800ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// device_y - A pointer to an integer receiving the result Y 801ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// value in device coordinates. 802e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 803e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 804e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 805ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// See comments for FPDF_DeviceToPage(). 806d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDF_PageToDevice(FPDF_PAGE page, 807d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int start_x, 808d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int start_y, 809d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int size_x, 810d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int size_y, 811d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int rotate, 812d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann double page_x, 813d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann double page_y, 814d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int* device_x, 815d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int* device_y); 816e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 817e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_Create 818ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Create a device independent bitmap (FXDIB). 819e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 820ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// width - The number of pixels in width for the bitmap. 821ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Must be greater than 0. 822ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// height - The number of pixels in height for the bitmap. 823ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Must be greater than 0. 824ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// alpha - A flag indicating whether the alpha channel is used. 825ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Non-zero for using alpha, zero for not using. 826e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 827ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The created bitmap handle, or NULL if a parameter error or out of 828ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// memory. 829e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 830ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The bitmap always uses 4 bytes per pixel. The first byte is always 831ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// double word aligned. 832ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 833ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The byte order is BGRx (the last byte unused if no alpha channel) or 834ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// BGRA. 835e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 836ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The pixels in a horizontal line are stored side by side, with the 837ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// left most pixel stored first (with lower memory address). 838ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Each line uses width * 4 bytes. 839e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 840ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Lines are stored one after another, with the top most line stored 841ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// first. There is no gap between adjacent lines. 842e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 843ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// This function allocates enough memory for holding all pixels in the 844ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap, but it doesn't initialize the buffer. Applications can use 845ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDFBitmap_FillRect to fill the bitmap using any color. 846d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_Create(int width, 847d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int height, 848d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int alpha); 849e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 850e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// More DIB formats 851d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Unknown or unsupported format. 852d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FPDFBitmap_Unknown 0 853ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Gray scale bitmap, one byte per pixel. 854ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDFBitmap_Gray 1 855ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 3 bytes per pixel, byte order: blue, green, red. 856ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDFBitmap_BGR 2 857ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 4 bytes per pixel, byte order: blue, green, red, unused. 858ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDFBitmap_BGRx 3 859ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 4 bytes per pixel, byte order: blue, green, red, alpha. 860ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FPDFBitmap_BGRA 4 861e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 862e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_CreateEx 863ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Create a device independent bitmap (FXDIB) 864ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Parameters: 865ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// width - The number of pixels in width for the bitmap. 866ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Must be greater than 0. 867ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// height - The number of pixels in height for the bitmap. 868ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Must be greater than 0. 869ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// format - A number indicating for bitmap format, as defined 870ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// above. 871ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// first_scan - A pointer to the first byte of the first line if 872ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// using an external buffer. If this parameter is NULL, 873ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// then the a new buffer will be created. 874ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// stride - Number of bytes for each scan line, for external 875ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// buffer only. 876ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Return value: 877ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The bitmap handle, or NULL if parameter error or out of memory. 878e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 879ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Similar to FPDFBitmap_Create function, but allows for more formats 880ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// and an external buffer is supported. The bitmap created by this 881ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// function can be used in any place that a FPDF_BITMAP handle is 882e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// required. 883e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 884ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If an external buffer is used, then the application should destroy 885ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the buffer by itself. FPDFBitmap_Destroy function will not destroy 886ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the buffer. 887d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_CreateEx(int width, 888d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int height, 889d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int format, 890d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann void* first_scan, 891d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int stride); 892d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann 893d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Function: FPDFBitmap_GetFormat 894d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Get the format of the bitmap. 895d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Parameters: 896d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create 897d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// or FPDFImageObj_GetBitmap. 898d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Return value: 899d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// The format of the bitmap. 900d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Comments: 901d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// Only formats supported by FPDFBitmap_CreateEx are supported by this 902d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// function; see the list of such formats above. 903d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetFormat(FPDF_BITMAP bitmap); 904e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 905e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_FillRect 906ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Fill a rectangle in a bitmap. 907ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Parameters: 908ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap - The handle to the bitmap. Returned by 909ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// FPDFBitmap_Create. 910ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// left - The left position. Starting from 0 at the 911ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// left-most pixel. 912ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// top - The top position. Starting from 0 at the 913ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// top-most line. 914ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// width - Width in pixels to be filled. 915ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// height - Height in pixels to be filled. 916ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// color - A 32-bit value specifing the color, in 8888 ARGB 917ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// format. 918e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 919e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 920e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 921ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// This function sets the color and (optionally) alpha value in the 922ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// specified region of the bitmap. 923ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 924ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// NOTE: If the alpha channel is used, this function does NOT 925ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// composite the background with the source color, instead the 926ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// background will be replaced by the source color and the alpha. 927e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 928ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If the alpha channel is not used, the alpha parameter is ignored. 929d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDFBitmap_FillRect(FPDF_BITMAP bitmap, 930d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int left, 931d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int top, 932d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int width, 933d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int height, 934d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann FPDF_DWORD color); 935e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 936e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_GetBuffer 937ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get data buffer of a bitmap. 938e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 939d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create 940d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// or FPDFImageObj_GetBitmap. 941e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 942e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The pointer to the first byte of the bitmap buffer. 943e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 944e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The stride may be more than width * number of bytes per pixel 945ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 946ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Applications can use this function to get the bitmap buffer pointer, 947ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// then manipulate any color and/or alpha values for any pixels in the 948ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// bitmap. 949ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 950ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The data is in BGRA format. Where the A maybe unused if alpha was 951ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// not specified. 952d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void* FPDF_CALLCONV FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); 953e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 954e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_GetWidth 955ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get width of a bitmap. 956e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 957d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create 958d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// or FPDFImageObj_GetBitmap. 959e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 960ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The width of the bitmap in pixels. 961d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); 962e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 963e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_GetHeight 964ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get height of a bitmap. 965e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 966d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create 967d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// or FPDFImageObj_GetBitmap. 968e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 969ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The height of the bitmap in pixels. 970d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); 971e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 972e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_GetStride 973ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get number of bytes for each line in the bitmap buffer. 974e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 975d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create 976d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// or FPDFImageObj_GetBitmap. 977e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 978ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The number of bytes for each line in the bitmap buffer. 979e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 980ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The stride may be more than width * number of bytes per pixel. 981d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetStride(FPDF_BITMAP bitmap); 982e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 983e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDFBitmap_Destroy 984ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Destroy a bitmap and release all related buffers. 985e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 986d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create 987d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// or FPDFImageObj_GetBitmap. 988e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 989e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 990e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 991ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// This function will not destroy any external buffers provided when 992ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the bitmap was created. 993d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDFBitmap_Destroy(FPDF_BITMAP bitmap); 994e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 995e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_VIEWERREF_GetPrintScaling 996e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Whether the PDF document prefers to be scaled or not. 997e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 998e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 999e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 1000e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// None. 1001d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 1002ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannFPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); 1003e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 1004e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_VIEWERREF_GetNumCopies 1005e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Returns the number of copies to be printed. 1006e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 1007e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 1008e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 1009e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The number of copies to be printed. 1010d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT int FPDF_CALLCONV 1011d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); 1012e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 1013e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_VIEWERREF_GetPrintPageRange 1014e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Page numbers to initialize print dialog box when file is printed. 1015e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 1016e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 1017e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 1018e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The print page range to be used for printing. 1019d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_PAGERANGE FPDF_CALLCONV 1020ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannFPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); 1021e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 1022e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_VIEWERREF_GetDuplex 1023ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Returns the paper handling option to be used when printing from 1024ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// the print dialog. 1025e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 1026e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 1027e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 1028e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The paper handling option to be used when printing. 1029d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_DUPLEXTYPE FPDF_CALLCONV 1030ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannFPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); 1031e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 10324d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Function: FPDF_VIEWERREF_GetName 10334d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Gets the contents for a viewer ref, with a given key. The value must 10344d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// be of type "name". 10354d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Parameters: 10364d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// document - Handle to the loaded document. 1037d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// key - Name of the key in the viewer pref dictionary, 1038d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann// encoded in UTF-8. 10394d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// buffer - A string to write the contents of the key to. 10404d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// length - Length of the buffer. 10414d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Return value: 10424d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// The number of bytes in the contents, including the NULL terminator. 10434d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// Thus if the return value is 0, then that indicates an error, such 10444d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// as when |document| is invalid or |buffer| is NULL. If |length| is 10454d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// less than the returned length, or |buffer| is NULL, |buffer| will 10464d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// not be modified. 1047d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT unsigned long FPDF_CALLCONV 1048d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_VIEWERREF_GetName(FPDF_DOCUMENT document, 1049d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann FPDF_BYTESTRING key, 1050d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann char* buffer, 1051d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann unsigned long length); 10524d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann 1053e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_CountNamedDests 1054e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Get the count of named destinations in the PDF document. 1055e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 1056e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to a document 1057e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 1058e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// The count of named destinations. 1059d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_DWORD FPDF_CALLCONV 1060d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_CountNamedDests(FPDF_DOCUMENT document); 1061e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 1062e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetNamedDestByName 1063ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get a the destination handle for the given name. 1064e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 1065e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to the loaded document. 1066ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// name - The name of a destination. 1067e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Return value: 1068ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The handle to the destination. 1069d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_DEST FPDF_CALLCONV 1070d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_GetNamedDestByName(FPDF_DOCUMENT document, FPDF_BYTESTRING name); 1071e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 1072e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Function: FPDF_GetNamedDest 1073ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Get the named destination by index. 1074e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Parameters: 1075e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// document - Handle to a document 1076ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// index - The index of a named destination. 1077ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// buffer - The buffer to store the destination name, 1078ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// used as wchar_t*. 1079ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// buflen [in/out] - Size of the buffer in bytes on input, 1080ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// length of the result in bytes on output 1081ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// or -1 if the buffer is too small. 1082ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Return value: 1083ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// The destination handle for a given index, or NULL if there is no 1084ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// named destination corresponding to |index|. 1085e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Comments: 1086e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Call this function twice to get the name of the named destination: 1087ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 1) First time pass in |buffer| as NULL and get buflen. 1088ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// 2) Second time pass in allocated |buffer| and buflen to retrieve 1089ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// |buffer|, which should be used as wchar_t*. 1090e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// 1091ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// If buflen is not sufficiently large, it will be set to -1 upon 1092ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// return. 1093d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document, 1094d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int index, 1095d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann void* buffer, 1096d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann long* buflen); 1097ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 1098ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifdef PDF_ENABLE_XFA 1099ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Function: FPDF_BStr_Init 1100ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Helper function to initialize a byte string. 1101d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Init(FPDF_BSTR* str); 1102ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 1103ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Function: FPDF_BStr_Set 1104ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Helper function to set string data. 1105d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Set(FPDF_BSTR* str, 1106d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann FPDF_LPCSTR bstr, 1107d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann int length); 1108ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 1109ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Function: FPDF_BStr_Clear 1110ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Helper function to clear a byte string. 1111d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Clear(FPDF_BSTR* str); 1112ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif // PDF_ENABLE_XFA 1113e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 1114e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifdef __cplusplus 1115e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} 1116e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif 1117e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 1118e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif // PUBLIC_FPDFVIEW_H_ 1119