1ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Copyright 2014 PDFium Authors. All rights reserved. 2ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Use of this source code is governed by a BSD-style license that can be 3ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// found in the LICENSE file. 4ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 5ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 7ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 8ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef _FPDFVIEW_H_ 9ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define _FPDFVIEW_H_ 10ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 11ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#if defined(_WIN32) && !defined(__WINDOWS__) 12ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#include <windows.h> 13ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif 14ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 15ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Data types 16ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_MODULEMGR; 17ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 18ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// PDF types 19ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_DOCUMENT; 20ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_PAGE; 21ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc) 22ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_PATH; 23ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_CLIPPATH; 24ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_BITMAP; 25ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_FONT; 26ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 27ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_TEXTPAGE; 28ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_SCHHANDLE; 29ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_PAGELINK; 30ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_HMODULE; 31ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_DOCSCHHANDLE; 32ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 33ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_BOOKMARK; 34ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_DEST; 35ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_ACTION; 36ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef void* FPDF_LINK; 37ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 38ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Basic data types 39ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef int FPDF_BOOL; 40ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef int FPDF_ERROR; 41ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef unsigned long FPDF_DWORD; 42ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 43ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef float FS_FLOAT; 44ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 45ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// String types 46ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef unsigned short FPDF_WCHAR; 47ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef unsigned char const* FPDF_LPCBYTE; 48ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 49ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE encoded), and platform dependent string 50ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef const char* FPDF_BYTESTRING; 51ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 52ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef const unsigned short* FPDF_WIDESTRING; // Foxit PDF SDK always use UTF-16LE encoding wide string, 53ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov // each character use 2 bytes (except surrogation), with low byte first. 54ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 55ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// For Windows programmers: for most case it's OK to treat FPDF_WIDESTRING as Windows unicode string, 56ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// however, special care needs to be taken if you expect to process Unicode larger than 0xffff. 57ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// For Linux/Unix programmers: most compiler/library environment uses 4 bytes for a Unicode character, 58ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// you have to convert between FPDF_WIDESTRING and system wide string by yourself. 59ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 60ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifdef _WIN32_WCE 61ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef const unsigned short* FPDF_STRING; 62ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#else 63ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef const char* FPDF_STRING; 64ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif 65ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 66ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef _FS_DEF_MATRIX_ 67ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define _FS_DEF_MATRIX_ 68ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov/** @brief Matrix for transformation. */ 69ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef struct _FS_MATRIX_ 70ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov{ 71ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov float a; /**< @brief Coefficient a.*/ 72ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov float b; /**< @brief Coefficient b.*/ 73ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov float c; /**< @brief Coefficient c.*/ 74ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov float d; /**< @brief Coefficient d.*/ 75ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov float e; /**< @brief Coefficient e.*/ 76ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov float f; /**< @brief Coefficient f.*/ 77ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov} FS_MATRIX; 78ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif 79ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 80ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef _FS_DEF_RECTF_ 81ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define _FS_DEF_RECTF_ 82ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov/** @brief Rectangle area(float) in device or page coordination system. */ 83ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef struct _FS_RECTF_ 84ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov{ 85ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov /**@{*/ 86ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov /** @brief The x-coordinate of the left-top corner. */ 87ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov float left; 88ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov /** @brief The y-coordinate of the left-top corner. */ 89ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov float top; 90ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov /** @brief The x-coordinate of the right-bottom corner. */ 91ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov float right; 92ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov /** @brief The y-coordinate of the right-bottom corner. */ 93ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov float bottom; 94ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov /**@}*/ 95ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov}* FS_LPRECTF, FS_RECTF; 96ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov/** @brief Const Pointer to ::FS_RECTF structure.*/ 97ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef const FS_RECTF* FS_LPCRECTF; 98ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif 99ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 100ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#if defined(_WIN32) && defined(FPDFSDK_EXPORTS) 101ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// On Windows system, functions are exported in a DLL 102ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define DLLEXPORT __declspec( dllexport ) 103ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define STDCALL __stdcall 104ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#else 105ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define DLLEXPORT 106ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define STDCALL 107ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif 108ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 109ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovextern const char g_ExpireDate[]; 110ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovextern const char g_ModuleCodes[]; 111ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 112ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Exported Functions 113ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifdef __cplusplus 114ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovextern "C" { 115ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif 116ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 117ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_InitLibrary 118ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Initialize the FPDFSDK library 119ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 120ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// hInstance - For WIN32 system only: the instance of the executable or DLL module. 121ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 122ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 123ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 124ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// You have to call this function before you can call any PDF processing functions. 125ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 126ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void STDCALL FPDF_InitLibrary(void* hInstance); 127ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 128ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 129ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_DestroyLibary 130ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Release all resources allocated by the FPDFSDK library. 131ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 132ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 133ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 134ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 135ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 136ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// You can call this function to release all memory blocks allocated by the library. 137ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// After this function called, you should not call any PDF processing functions. 138ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void STDCALL FPDF_DestroyLibrary(); 139ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 140ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//Policy for accessing the local machine time. 141ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_POLICY_MACHINETIME_ACCESS 0 142ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 143ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_SetSandBoxPolicy 144ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Set the policy for the sandbox environment. 145ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 146ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// policy - The specified policy for setting, for example:FPDF_POLICY_MACHINETIME_ACCESS. 147ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// enable - True for enable, False for disable the policy. 148ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 149ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 150ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable); 151ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 152ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov/** 153ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov* Open and load a PDF document. 154ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov* @param[in] file_path - Path to the PDF file (including extension). 155ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov* @param[in] password - A string used as the password for PDF file. 156ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov* If no password needed, empty or NULL can be used. 157ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov* @note Loaded document can be closed by FPDF_CloseDocument. 158ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov* If this function fails, you can use FPDF_GetLastError() to retrieve 159ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov* the reason why it fails. 160ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov* @retval A handle to the loaded document. If failed, NULL is returned. 161ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov*/ 162ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, 163ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov FPDF_BYTESTRING password); 164ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 165ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_LoadMemDocument 166ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Open and load a PDF document from memory. 167ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 168ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// data_buf - Pointer to a buffer containing the PDF document. 169ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// size - Number of bytes in the PDF document. 170ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// password - A string used as the password for PDF file. 171ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// If no password needed, empty or NULL can be used. 172ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 173ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// A handle to the loaded document. If failed, NULL is returned. 174ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 175ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The memory buffer must remain valid when the document is open. 176ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Loaded document can be closed by FPDF_CloseDocument. 177ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// If this function fails, you can use FPDF_GetLastError() to retrieve 178ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// the reason why it fails. 179ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 180ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, 181ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov int size, FPDF_BYTESTRING password); 182ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 183ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Structure for custom file access. 184ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovtypedef struct { 185ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov // File length, in bytes. 186ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov unsigned long m_FileLen; 187ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 188ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov // A function pointer for getting a block of data from specific position. 189ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov // Position is specified by byte offset from beginning of the file. 190ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov // The position and size will never go out range of file length. 191ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov // It may be possible for FPDFSDK to call this function multiple times for same position. 192ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov // Return value: should be non-zero if successful, zero for error. 193ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov int (*m_GetBlock)(void* param, unsigned long position, unsigned char* pBuf, unsigned long size); 194ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 195ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov // A custom pointer for all implementation specific data. 196ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov // This pointer will be used as the first parameter to m_GetBlock callback. 197ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov void* m_Param; 198ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov} FPDF_FILEACCESS; 199ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 200ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_LoadCustomDocument 201ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Load PDF document from a custom access descriptor. 202ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 203ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// pFileAccess - A structure for access the file. 204ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// password - Optional password for decrypting the PDF file. 205ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 206ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// A handle to the loaded document. If failed, NULL is returned. 207ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 208ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The application should maintain the file resources being valid until the PDF document close. 209ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Loaded document can be closed by FPDF_CloseDocument. 210ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, 211ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov FPDF_BYTESTRING password); 212ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 213ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_GetFileVersion 214ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Get the file version of the specific PDF document. 215ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 216ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// doc - Handle to document. 217ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// fileVersion - The PDF file version. File version: 14 for 1.4, 15 for 1.5, ... 218ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 219ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// TRUE if this call succeed, If failed, FALSE is returned. 220ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 221ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// If the document is created by function ::FPDF_CreateNewDocument, then this function would always fail. 222ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, int* fileVersion); 223ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 224ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_ERR_SUCCESS 0 // No error. 225ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_ERR_UNKNOWN 1 // Unknown error. 226ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_ERR_FILE 2 // File not found or could not be opened. 227ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted. 228ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_ERR_PASSWORD 4 // Password required or incorrect password. 229ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_ERR_SECURITY 5 // Unsupported security scheme. 230ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_ERR_PAGE 6 // Page not found or content error. 231ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 232ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_GetLastError 233ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Get last error code when an SDK function failed. 234ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 235ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 236ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 237ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// A 32-bit integer indicating error codes (defined above). 238ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 239ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// If the previous SDK call succeeded, the return value of this function 240ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// is not defined. 241ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 242ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT unsigned long STDCALL FPDF_GetLastError(); 243ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 244ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_GetDocPermission 245ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Get file permission flags of the document. 246ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 247ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// document - Handle to document. Returned by FPDF_LoadDocument function. 248ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 249ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// A 32-bit integer indicating permission flags. Please refer to PDF Reference for 250ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// detailed description. If the document is not protected, 0xffffffff will be returned. 251ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 252ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document); 253ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 254ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_GetPageCount 255ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Get total number of pages in a document. 256ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 257ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// document - Handle to document. Returned by FPDF_LoadDocument function. 258ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 259ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Total number of pages in the document. 260ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 261ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document); 262ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 263ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_LoadPage 264ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Load a page inside a document. 265ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 266ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// document - Handle to document. Returned by FPDF_LoadDocument function. 267ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page_index - Index number of the page. 0 for the first page. 268ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 269ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// A handle to the loaded page. If failed, NULL is returned. 270ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 271ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Loaded page can be rendered to devices using FPDF_RenderPage function. 272ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Loaded page can be closed by FPDF_ClosePage. 273ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 274ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, int page_index); 275ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 276ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_GetPageWidth 277ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Get page width. 278ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 279ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page - Handle to the page. Returned by FPDF_LoadPage function. 280ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 281ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Page width (excluding non-displayable area) measured in points. 282ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// One point is 1/72 inch (around 0.3528 mm). 283ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 284ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page); 285ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 286ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_GetPageHeight 287ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Get page height. 288ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 289ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page - Handle to the page. Returned by FPDF_LoadPage function. 290ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 291ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Page height (excluding non-displayable area) measured in points. 292ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// One point is 1/72 inch (around 0.3528 mm) 293ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 294ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page); 295ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 296ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_GetPageSizeByIndex 297ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Get the size of a page by index. 298ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 299ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// document - Handle to document. Returned by FPDF_LoadDocument function. 300ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page_index - Page index, zero for the first page. 301ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// width - Pointer to a double value receiving the page width (in points). 302ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// height - Pointer to a double value receiving the page height (in points). 303ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 304ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Non-zero for success. 0 for error (document or page not found). 305ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 306ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, int page_index, double* width, double* height); 307ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 308ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 309ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Page rendering flags. They can be combined with bit OR. 310ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_ANNOT 0x01 // Set if annotations are to be rendered. 311ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_LCD_TEXT 0x02 // Set if using text rendering optimized for LCD display. 312ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_NO_NATIVETEXT 0x04 // Don't use the native text output available on some platforms 313ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_GRAYSCALE 0x08 // Grayscale output. 314ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_DEBUG_INFO 0x80 // Set if you want to get some debug info. 315ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov // Please discuss with Foxit first if you need to collect debug info. 316ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_NO_CATCH 0x100 // Set if you don't want to catch exception. 317ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 // Limit image cache size. 318ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_RENDER_FORCEHALFTONE 0x400 // Always use halftone for image stretching. 319ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_PRINTING 0x800 // Render for printing. 320ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDF_REVERSE_BYTE_ORDER 0x10 //set whether render in a reverse Byte order, this flag only 321ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov //enable when render to a bitmap. 322ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifdef _WIN32 323ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_RenderPage 324ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Render contents in a page to a device (screen, bitmap, or printer). 325ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// This function is only supported on Windows system. 326ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 327ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// dc - Handle to device context. 328ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page - Handle to the page. Returned by FPDF_LoadPage function. 329ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// start_x - Left pixel position of the display area in the device coordinate. 330ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// start_y - Top pixel position of the display area in the device coordinate. 331ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 332ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 333ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 334ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise). 335ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// flags - 0 for normal display, or combination of flags defined above. 336ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 337ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 338ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 339ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, 340ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov int rotate, int flags); 341ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif 342ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 343ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_RenderPageBitmap 344ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Render contents in a page to a device independent bitmap 345ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 346ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// bitmap - Handle to the device independent bitmap (as the output buffer). 347ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Bitmap handle can be created by FPDFBitmap_Create function. 348ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page - Handle to the page. Returned by FPDF_LoadPage function. 349ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// start_x - Left pixel position of the display area in the bitmap coordinate. 350ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// start_y - Top pixel position of the display area in the bitmap coordinate. 351ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 352ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 353ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 354ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise). 355ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// flags - 0 for normal display, or combination of flags defined above. 356ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 357ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 358ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 359ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, 360ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov int size_x, int size_y, int rotate, int flags); 361ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 362ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_ClosePage 363ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Close a loaded PDF page. 364ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 365ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page - Handle to the loaded page. 366ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 367ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 368ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 369ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); 370ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 371ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_CloseDocument 372ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Close a loaded PDF document. 373ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 374ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// document - Handle to the loaded document. 375ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 376ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 377ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 378ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); 379ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 380ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_DeviceToPage 381ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Convert the screen coordinate of a point to page coordinate. 382ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 383ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page - Handle to the page. Returned by FPDF_LoadPage function. 384ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// start_x - Left pixel position of the display area in the device coordinate. 385ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// start_y - Top pixel position of the display area in the device coordinate. 386ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 387ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 388ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 389ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise). 390ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// device_x - X value in device coordinate, for the point to be converted. 391ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// device_y - Y value in device coordinate, for the point to be converted. 392ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page_x - A Pointer to a double receiving the converted X value in page coordinate. 393ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page_y - A Pointer to a double receiving the converted Y value in page coordinate. 394ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 395ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 396ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 397ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The page coordinate system has its origin at left-bottom corner of the page, with X axis goes along 398ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// the bottom side to the right, and Y axis goes along the left side upward. NOTE: this coordinate system 399ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// can be altered when you zoom, scroll, or rotate a page, however, a point on the page should always have 400ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// the same coordinate values in the page coordinate system. 401ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 402ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The device coordinate system is device dependent. For screen device, its origin is at left-top 403ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// corner of the window. However this origin can be altered by Windows coordinate transformation 404ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// utilities. You must make sure the start_x, start_y, size_x, size_y and rotate parameters have exactly 405ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// same values as you used in FPDF_RenderPage() function call. 406ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 407ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, 408ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov int rotate, int device_x, int device_y, double* page_x, double* page_y); 409ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 410ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_PageToDevice 411ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Convert the page coordinate of a point to screen coordinate. 412ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 413ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page - Handle to the page. Returned by FPDF_LoadPage function. 414ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// start_x - Left pixel position of the display area in the device coordinate. 415ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// start_y - Top pixel position of the display area in the device coordinate. 416ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// size_x - Horizontal size (in pixels) for displaying the page. 417ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// size_y - Vertical size (in pixels) for displaying the page. 418ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 419ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise). 420ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page_x - X value in page coordinate, for the point to be converted. 421ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// page_y - Y value in page coordinate, for the point to be converted. 422ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// device_x - A pointer to an integer receiving the result X value in device coordinate. 423ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// device_y - A pointer to an integer receiving the result Y value in device coordinate. 424ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 425ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 426ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 427ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// See comments of FPDF_DeviceToPage() function. 428ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 429ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, 430ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov int rotate, double page_x, double page_y, int* device_x, int* device_y); 431ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 432ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDFBitmap_Create 433ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Create a Foxit Device Independent Bitmap (FXDIB). 434ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 435ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// width - Number of pixels in a horizontal line of the bitmap. Must be greater than 0. 436ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// height - Number of pixels in a vertical line of the bitmap. Must be greater than 0. 437ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// alpha - A flag indicating whether alpha channel is used. Non-zero for using alpha, zero for not using. 438ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 439ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The created bitmap handle, or NULL if parameter error or out of memory. 440ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 441ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// An FXDIB always use 4 byte per pixel. The first byte of a pixel is always double word aligned. 442ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Each pixel contains red (R), green (G), blue (B) and optionally alpha (A) values. 443ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The byte order is BGRx (the last byte unused if no alpha channel) or BGRA. 444ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 445ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The pixels in a horizontal line (also called scan line) are stored side by side, with left most 446ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// pixel stored first (with lower memory address). Each scan line uses width*4 bytes. 447ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 448ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Scan lines are stored one after another, with top most scan line stored first. There is no gap 449ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// between adjacent scan lines. 450ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 451ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// This function allocates enough memory for holding all pixels in the bitmap, but it doesn't 452ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// initialize the buffer. Applications can use FPDFBitmap_FillRect to fill the bitmap using any color. 453ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha); 454ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 455ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// More DIB formats 456ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDFBitmap_Gray 1 // Gray scale bitmap, one byte per pixel. 457ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDFBitmap_BGR 2 // 3 bytes per pixel, byte order: blue, green, red. 458ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDFBitmap_BGRx 3 // 4 bytes per pixel, byte order: blue, green, red, unused. 459ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define FPDFBitmap_BGRA 4 // 4 bytes per pixel, byte order: blue, green, red, alpha. 460ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 461ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDFBitmap_CreateEx 462ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Create a Foxit Device Independent Bitmap (FXDIB) 463ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 464ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// width - Number of pixels in a horizontal line of the bitmap. Must be greater than 0. 465ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// height - Number of pixels in a vertical line of the bitmap. Must be greater than 0. 466ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// format - A number indicating for bitmap format, as defined above. 467ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// first_scan - A pointer to the first byte of first scan line, for external buffer 468ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// only. If this parameter is NULL, then the SDK will create its own buffer. 469ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// stride - Number of bytes for each scan line, for external buffer only.. 470ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 471ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The created bitmap handle, or NULL if parameter error or out of memory. 472ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 473ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Similar to FPDFBitmap_Create function, with more formats and external buffer supported. 474ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Bitmap created by this function can be used in any place that a FPDF_BITMAP handle is 475ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// required. 476ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 477ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// If external scanline buffer is used, then the application should destroy the buffer 478ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// by itself. FPDFBitmap_Destroy function will not destroy the buffer. 479ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 480ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int format, void* first_scan, int stride); 481ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 482ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDFBitmap_FillRect 483ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Fill a rectangle area in an FXDIB. 484ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 485ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// bitmap - The handle to the bitmap. Returned by FPDFBitmap_Create function. 486ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// left - The left side position. Starting from 0 at the left-most pixel. 487ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// top - The top side position. Starting from 0 at the top-most scan line. 488ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// width - Number of pixels to be filled in each scan line. 489ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// height - Number of scan lines to be filled. 490ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// red - A number from 0 to 255, identifying the red intensity. 491ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// green - A number from 0 to 255, identifying the green intensity. 492ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// blue - A number from 0 to 255, identifying the blue intensity. 493ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// alpha - (Only if the alpha channeled is used when bitmap created) A number from 0 to 255, 494ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// identifying the alpha value. 495ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 496ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 497ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 498ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// This function set the color and (optionally) alpha value in specified region of the bitmap. 499ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// NOTE: If alpha channel is used, this function does NOT composite the background with the source color, 500ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// instead the background will be replaced by the source color and alpha. 501ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// If alpha channel is not used, the "alpha" parameter is ignored. 502ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 503ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, 504ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov int red, int green, int blue, int alpha); 505ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 506ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDFBitmap_GetBuffer 507ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Get data buffer of an FXDIB 508ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 509ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function. 510ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 511ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The pointer to the first byte of the bitmap buffer. 512ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 513ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The stride may be more than width * number of bytes per pixel 514ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Applications can use this function to get the bitmap buffer pointer, then manipulate any color 515ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// and/or alpha values for any pixels in the bitmap. 516ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); 517ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 518ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDFBitmap_GetWidth 519ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Get width of an FXDIB. 520ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 521ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function. 522ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 523ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The number of pixels in a horizontal line of the bitmap. 524ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); 525ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 526ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDFBitmap_GetHeight 527ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Get height of an FXDIB. 528ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 529ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function. 530ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 531ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The number of pixels in a vertical line of the bitmap. 532ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); 533ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 534ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDFBitmap_GetStride 535ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Get number of bytes for each scan line in the bitmap buffer. 536ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 537ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function. 538ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 539ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The number of bytes for each scan line in the bitmap buffer. 540ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 541ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The stride may be more than width * number of bytes per pixel 542ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap); 543ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 544ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDFBitmap_Destroy 545ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Destroy an FXDIB and release all related buffers. 546ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 547ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function. 548ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 549ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 550ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Comments: 551ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// This function will not destroy any external buffer. 552ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 553ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); 554ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 555ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_VIEWERREF_GetPrintScaling 556ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Whether the PDF document prefers to be scaled or not. 557ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 558ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// document - Handle to the loaded document. 559ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 560ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// None. 561ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 562ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); 563ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 564ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Function: FPDF_GetNamedDestByName 565ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// get a special dest handle by the index. 566ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: 567ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// document - Handle to the loaded document. 568ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// name - The name of a special named dest. 569ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Return value: 570ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The handle of the dest. 571ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// 572ee451cb395940862dad63c85adfe8f2fd55e864cSvet GanovDLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_BYTESTRING name); 573ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 574ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifdef __cplusplus 575ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov}; 576ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif 577ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov 578ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif // _FPDFVIEW_H_ 579