OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef _FPDFEDIT_H_ | |
8 #define _FPDFEDIT_H_ | |
9 | |
10 #include "fpdfview.h" | |
11 | |
12 // Define all types used in the SDK. Note they can be simply regarded as opaque
pointers | |
13 // or long integer numbers. | |
14 | |
15 #define FPDF_ARGB(a,r,g,b) ((((FX_DWORD)(((FX_BYTE)(b)|((FX_WORD)((
FX_BYTE)(g))<<8))|(((FX_DWORD)(FX_BYTE)(r))<<16)))) | (((FX_DWORD)(FX_BYTE)(a))<
<24)) | |
16 #define FPDF_GetBValue(argb) ((FX_BYTE)(argb)) | |
17 #define FPDF_GetGValue(argb) ((FX_BYTE)(((FX_WORD)(argb)) >> 8)) | |
18 #define FPDF_GetRValue(argb) ((FX_BYTE)((argb)>>16)) | |
19 #define FPDF_GetAValue(argb) ((FX_BYTE)((argb)>>24)) | |
20 | |
21 #ifdef __cplusplus | |
22 extern "C" { | |
23 #endif | |
24 | |
25 ////////////////////////////////////////////////////////////////////// | |
26 // | |
27 // Document functions | |
28 // | |
29 ////////////////////////////////////////////////////////////////////// | |
30 | |
31 // Function: FPDF_CreateNewDocument | |
32 // Create a new PDF document. | |
33 // Parameters: | |
34 // None. | |
35 // Return value: | |
36 // A handle to a document. If failed, NULL is returned. | |
37 // | |
38 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument(); | |
39 | |
40 ////////////////////////////////////////////////////////////////////// | |
41 // | |
42 // Page functions | |
43 // | |
44 ////////////////////////////////////////////////////////////////////// | |
45 | |
46 // Function: FPDFPage_New | |
47 // Construct an empty page. | |
48 // Parameters: | |
49 // document - Handle to document. Returned by
FPDF_LoadDocument and FPDF_CreateNewDocument. | |
50 // page_index - The index of a page. | |
51 // width - The page width. | |
52 // height - The page height. | |
53 // Return value: | |
54 // The handle to the page. | |
55 // Comments: | |
56 // Loaded page can be deleted by FPDFPage_Delete. | |
57 // Notes: | |
58 // The method can not support to create a new page for the
document consists of dynamic XFA fields. | |
59 // | |
60 DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, int page_index,
double width, double height); | |
61 | |
62 // Function: FPDFPage_Delete | |
63 // Delete a PDF page. | |
64 // Parameters: | |
65 // document - Handle to document. Returned by
FPDF_LoadDocument and FPDF_CreateNewDocument. | |
66 // page_index - The index of a page. | |
67 // Return value: | |
68 // None. | |
69 // Notes: | |
70 // The method can not support to delete page for the docume
nt consists of dynamic XFA fields. | |
71 // | |
72 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index); | |
73 | |
74 // Function: FPDFPage_GetRotation | |
75 // Get the page rotation. One of following values will be r
eturned: 0(0), 1(90), 2(180), 3(270). | |
76 // Parameters: | |
77 // page - Handle to a page. Returned by FP
DFPage_New or FPDF_LoadPage. | |
78 // Return value: | |
79 // The PDF page rotation. | |
80 // Comment: | |
81 // The PDF page rotation is rotated clockwise. | |
82 // Notes: | |
83 // The method can not support to get the page rotate for th
e document consists of dynamic XFA fields. | |
84 // | |
85 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page); | |
86 | |
87 // Function: FPDFPage_SetRotation | |
88 // Set page rotation. One of following values will be set:
0(0), 1(90), 2(180), 3(270). | |
89 // Parameters: | |
90 // page - Handle to a page. Returned by FP
DFPage_New or FPDF_LoadPage. | |
91 // rotate - The value of the PDF page rotati
on. | |
92 // Return value: | |
93 // None. | |
94 // Comment: | |
95 // The PDF page rotation is rotated clockwise. | |
96 // Notes: | |
97 // The method can not support to set this feature for the d
ocument consists of dynamic XFA fields. | |
98 // | |
99 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate); | |
100 | |
101 // Function: FPDFPage_InsertObject | |
102 // Insert an object to the page. The page object is automat
ically freed. | |
103 // Parameters: | |
104 // page - Handle to a page. Returned by FP
DFPage_New or FPDF_LoadPage. | |
105 // page_obj - Handle to a page object. Returne
d by FPDFPageObj_NewTextObj,FPDFPageObj_NewTextObjEx and | |
106 // FPDFPageObj_NewPathObj. | |
107 // Return value: | |
108 // None. | |
109 // Notes: | |
110 // The method can not support this feature for the document
consists of dynamic XFA fields. | |
111 // | |
112 DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT pag
e_obj); | |
113 | |
114 // Function: FPDFPage_CountObject | |
115 // Get number of page objects inside the page. | |
116 // Parameters: | |
117 // page - Handle to a page. Returned by FP
DFPage_New or FPDF_LoadPage. | |
118 // Return value: | |
119 // The number of the page object. | |
120 // Notes: | |
121 // The method can not support this feature for the document
consists of dynamic XFA fields. | |
122 // | |
123 DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page); | |
124 | |
125 // Function: FPDFPage_GetObject | |
126 // Get page object by index. | |
127 // Parameters: | |
128 // page - Handle to a page. Returned by FP
DFPage_New or FPDF_LoadPage. | |
129 // index - The index of a page object. | |
130 // Return value: | |
131 // The handle of the page object. Null for failed. | |
132 // Notes: | |
133 // The method can not support this feature for the document
consists of dynamic XFA fields. | |
134 // | |
135 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index); | |
136 | |
137 // Function: FPDFPage_HasTransparency | |
138 // Check that whether the content of specified PDF page con
tains transparency. | |
139 // Parameters: | |
140 // page - Handle to a page. Returned by FP
DFPage_New or FPDF_LoadPage. | |
141 // Return value: | |
142 // TRUE means that the PDF page does contains transparency. | |
143 // Otherwise, returns FALSE. | |
144 // Notes: | |
145 // The method can not support this feature for the document
consists of dynamic XFA fields. | |
146 // | |
147 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page); | |
148 | |
149 // Function: FPDFPage_GenerateContent | |
150 // Generate PDF Page content. | |
151 // Parameters: | |
152 // page - Handle to a page. Returned by FP
DFPage_New or FPDF_LoadPage. | |
153 // Return value: | |
154 // True if successful, false otherwise. | |
155 // Comment: | |
156 // Before you save the page to a file, or reload the page,
you must call the FPDFPage_GenerateContent function. | |
157 // Or the changed information will be lost. | |
158 // Notes: | |
159 // The method can not support this feature for the document
consists of dynamic XFA fields. | |
160 // | |
161 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page); | |
162 | |
163 ////////////////////////////////////////////////////////////////////// | |
164 // | |
165 // Page Object functions | |
166 // | |
167 ////////////////////////////////////////////////////////////////////// | |
168 | |
169 // Function: FPDFPageObj_HasTransparency | |
170 // Check that whether the specified PDF page object contain
s transparency. | |
171 // Parameters: | |
172 // pageObject - Handle to a page object. | |
173 // Return value: | |
174 // TRUE means that the PDF page object does contains transp
arency. | |
175 // Otherwise, returns FALSE. | |
176 DLLEXPORT FPDF_BOOL STDCALL FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObje
ct); | |
177 | |
178 // Function: FPDFPageObj_Transform | |
179 // Transform (scale, rotate, shear, move) page object. | |
180 // Parameters: | |
181 // page_object - Handle to a page object. Returne
d by FPDFPageObj_NewImageObj. | |
182 // a - The coefficient "a" of t
he matrix. | |
183 // b - The coefficient "b"
of the matrix. | |
184 // c - The coefficient "c" of t
he matrix. | |
185 // d - The coefficient "d" of t
he matrix. | |
186 // e - The coefficient "e" of t
he matrix. | |
187 // f - The coefficient "f" of t
he matrix. | |
188 // Return value: | |
189 // None. | |
190 DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, | |
191 double a, double b, doub
le c, double d, double e, double f); | |
192 | |
193 // Function: FPDFPage_TransformAnnots | |
194 // Transform (scale, rotate, shear, move) all annots in a p
age. | |
195 // Parameters: | |
196 // page - Handle to a page. | |
197 // a - The coefficient "a" of t
he matrix. | |
198 // b - The coefficient "b"
of the matrix. | |
199 // c - The coefficient "c" of t
he matrix. | |
200 // d - The coefficient "d" of t
he matrix. | |
201 // e - The coefficient "e" of t
he matrix. | |
202 // f - The coefficient "f" of t
he matrix. | |
203 // Return value: | |
204 // None. | |
205 // Notes: | |
206 // The method can not support this feature for the document
consists of dynamic XFA fields. | |
207 DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, | |
208
double a, double b, double c, double d, double e, double f); | |
209 | |
210 // The page object constants. | |
211 #define FPDF_PAGEOBJ_TEXT 1 | |
212 #define FPDF_PAGEOBJ_PATH 2 | |
213 #define FPDF_PAGEOBJ_IMAGE 3 | |
214 #define FPDF_PAGEOBJ_SHADING 4 | |
215 #define FPDF_PAGEOBJ_FORM 5 | |
216 | |
217 ////////////////////////////////////////////////////////////////////// | |
218 // | |
219 // Image functions | |
220 // | |
221 ////////////////////////////////////////////////////////////////////// | |
222 | |
223 // Function: FPDFPageObj_NewImgeObj | |
224 // Create a new Image Object. | |
225 // Parameters: | |
226 // document - Handle to document. Retu
rned by FPDF_LoadDocument or FPDF_CreateNewDocument function. | |
227 // Return Value: | |
228 // Handle of image object. | |
229 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document)
; | |
230 | |
231 | |
232 // Function: FPDFImageObj_LoadJpegFile | |
233 // Load Image from a JPEG image file and then set it to an
image object. | |
234 // Parameters: | |
235 // pages - Pointers to the start of
all loaded pages, could be NULL. | |
236 // nCount - Number of pages, could b
e 0. | |
237 // image_object - Handle of image object returned
by FPDFPageObj_NewImgeObj. | |
238 // fileAccess - The custom file access h
andler, which specifies the JPEG image file. | |
239 // Return Value: | |
240 // TRUE if successful, FALSE otherwise. | |
241 // Note: | |
242 // The image object might already has an associated image,
which is shared and cached by the loaded pages, In this case, we need to clear t
he cache of image for all the loaded pages. | |
243 // Pass pages and count to this API to clear the image cach
e. | |
244 // The method can not support this feature for the document
consists of dynamic XFA fields. | |
245 // | |
246 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCou
nt,FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess); | |
247 | |
248 | |
249 // Function: FPDFImageObj_SetMatrix | |
250 // Set the matrix of an image object. | |
251 // Parameters: | |
252 // image_object - Handle of image object returned
by FPDFPageObj_NewImgeObj. | |
253 // a - The coefficient
"a" of the matrix. | |
254 // b - The coefficient
"b" of the matrix. | |
255 // c - The coefficient
"c" of the matrix. | |
256 // d - The coefficient
"d" of the matrix. | |
257 // e - The coefficient
"e" of the matrix. | |
258 // f - The coefficient
"f" of the matrix. | |
259 // Return value: | |
260 // TRUE if successful, FALSE otherwise. | |
261 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, | |
262
double a, double b, double c, double d, double e, double f); | |
263 | |
264 // Function: FPDFImageObj_SetBitmap | |
265 // Set the bitmap to an image object. | |
266 // Parameters: | |
267 // pages - Pointer's to the start o
f all loaded pages. | |
268 // nCount - Number of pages. | |
269 // image_object - Handle of image object returned
by FPDFPageObj_NewImgeObj. | |
270 // bitmap - The handle of the bitmap
which you want to set it to the image object. | |
271 // Return value: | |
272 // TRUE if successful, FALSE otherwise. | |
273 // Notes; | |
274 // The method can not support this feature for the document
consists of dynamic XFA fields. | |
275 // | |
276 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,int nCount,F
PDF_PAGEOBJECT image_object, FPDF_BITMAP bitmap); | |
277 | |
278 #ifdef __cplusplus | |
279 } | |
280 #endif | |
281 #endif // _FPDFEDIT_H_ | |
OLD | NEW |