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