Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: public/fpdf_dataavail.h

Issue 1412083010: Merge to XFA: Support linearized loading (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef PUBLIC_FPDF_DATAAVAIL_H_ 7 #ifndef PUBLIC_FPDF_DATAAVAIL_H_
8 #define PUBLIC_FPDF_DATAAVAIL_H_ 8 #define PUBLIC_FPDF_DATAAVAIL_H_
9 9
10 #include <stddef.h> // For size_t. 10 #include <stddef.h> // For size_t.
11 11
12 #include "fpdfview.h" 12 #include "fpdfview.h"
13 13
14 /** The result of the process which check linearized PDF. */ 14 #define PDF_LINEARIZATION_UNKNOWN -1
15 #define FSDK_IS_LINEARIZED 1 15 #define PDF_NOT_LINEARIZED 0
16 #define FSDK_NOT_LINEARIZED 0 16 #define PDF_LINEARIZED 1
17 #define FSDK_UNKNOW_LINEARIZED -1 17 #define PDF_DATA_ERROR -1
18 #define PDF_DATA_NOTAVAIL 0
19 #define PDF_DATA_AVAIL 1
20 #define PDF_FORM_ERROR -1
21 #define PDF_FORM_NOTAVAIL 0
22 #define PDF_FORM_AVAIL 1
23 #define PDF_FORM_NOTEXIST 2
18 24
19 #ifdef __cplusplus 25 #ifdef __cplusplus
20 extern "C" { 26 extern "C" {
21 #endif 27 #endif
22 28
23 /** 29 /**
24 * Interface: FX_FILEAVAIL 30 * Interface: FX_FILEAVAIL
25 * Interface for checking whether the section of the file is available. 31 * Interface for checking whether the section of the file is available.
26 */ 32 */
27 typedef struct _FX_FILEAVAIL { 33 typedef struct _FX_FILEAVAIL {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 * Function: FPDFAvail_IsDocAvail 132 * Function: FPDFAvail_IsDocAvail
127 * Check whether the document is ready for loading, if not, get 133 * Check whether the document is ready for loading, if not, get
128 * download hints. 134 * download hints.
129 * 135 *
130 * Parameters: 136 * Parameters:
131 * avail - Handle to document availability provider returned by 137 * avail - Handle to document availability provider returned by
132 * FPDFAvail_Create 138 * FPDFAvail_Create
133 * hints - Pointer to a download hints interface, receiving 139 * hints - Pointer to a download hints interface, receiving
134 * generated hints 140 * generated hints
135 * Return value: 141 * Return value:
136 * Non-zero for page is fully available, 0 for page not yet available. 142 * PDF_DATA_ERROR: A common error is returned. It can't tell
143 * whehter data are availabe or not.
144 * PDF_DATA_NOTAVAIL: Data are not yet available.
145 * PDF_DATA_AVAIL: Data are available.
137 * Comments: 146 * Comments:
138 * The application should call this function whenever new data arrived, 147 * Applications should call this function whenever new data arrived,
139 * and process all the 148 * and process all the generated download hints if any, until the
140 * generated download hints if any, until the function returns non-zero 149 * function returns PDF_DATA_ERROR or PDF_DATA_AVAIL. Then
141 * value. Then the 150 * applications can call FPDFAvail_GetDocument() to get a document
142 * application can call FPDFAvail_GetDocument() to get a document 151 * handle.
143 * handle.
144 */ 152 */
145 DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, 153 DLLEXPORT int STDCALL
146 FX_DOWNLOADHINTS* hints); 154 FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
147 155
148 /** 156 /**
149 * Function: FPDFAvail_GetDocument 157 * Function: FPDFAvail_GetDocument
150 * Get document from the availability provider. 158 * Get document from the availability provider.
151 * 159 *
152 * Parameters: 160 * Parameters:
153 * avail - Handle to document availability provider returned by 161 * avail - Handle to document availability provider returned by
154 * FPDFAvail_Create 162 * FPDFAvail_Create
155 * password - Optional password for decrypting the PDF file. 163 * password - Optional password for decrypting the PDF file.
156 * Return value: 164 * Return value:
(...skipping 28 matching lines...) Expand all
185 * Check whether a page is ready for loading, if not, get download 193 * Check whether a page is ready for loading, if not, get download
186 * hints. 194 * hints.
187 * 195 *
188 * Parameters: 196 * Parameters:
189 * avail - Handle to document availability provider returned by 197 * avail - Handle to document availability provider returned by
190 * FPDFAvail_Create 198 * FPDFAvail_Create
191 * page_index - Index number of the page. 0 for the first page. 199 * page_index - Index number of the page. 0 for the first page.
192 * hints - Pointer to a download hints interface, receiving 200 * hints - Pointer to a download hints interface, receiving
193 * generated hints 201 * generated hints
194 * Return value: 202 * Return value:
195 * Non-zero for page is fully available, 0 for page not yet available. 203 * PDF_DATA_ERROR: A common error is returned. It can't tell
204 * whehter data are availabe or not.
205 * PDF_DATA_NOTAVAIL: Data are not yet available.
206 * PDF_DATA_AVAIL: Data are available.
196 * Comments: 207 * Comments:
197 * This function call be called only after FPDFAvail_GetDocument if 208 * This function can be called only after FPDFAvail_GetDocument is
198 * called. 209 * called. Applications should call this function whenever new data
199 * The application should call this function whenever new data arrived, 210 * arrived and process all the generated download hints if any, until
200 * and process all the 211 * this function returns PDF_DATA_ERROR or PDF_DATA_AVAIL. Then
201 * generated download hints if any, until the function returns non-zero 212 * applications can perform page loading.
202 * value. Then the
203 * application can perform page loading.
204 */ 213 */
205 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, 214 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
206 int page_index, 215 int page_index,
207 FX_DOWNLOADHINTS* hints); 216 FX_DOWNLOADHINTS* hints);
208 217
209 /** 218 /**
210 * Function: FPDFAvail_ISFormAvail 219 * Function: FPDFAvail_ISFormAvail
211 * Check whether Form data is ready for init, if not, get download 220 * Check whether Form data is ready for init, if not, get download
212 * hints. 221 * hints.
213 * 222 *
214 * Parameters: 223 * Parameters:
215 * avail - Handle to document availability provider returned by 224 * avail - Handle to document availability provider returned by
216 * FPDFAvail_Create 225 * FPDFAvail_Create
217 * hints - Pointer to a download hints interface, receiving 226 * hints - Pointer to a download hints interface, receiving
218 * generated hints 227 * generated hints
219 * Return value: 228 * Return value:
220 * Non-zero for Form data is fully available, 0 for Form data not yet 229 * PDF_FORM_ERROR - A common eror, in general incorrect parameters,
221 * available. 230 * like 'hints' is nullptr.
222 * Details: -1 - error, the input parameter not correct, such as hints 231 * PDF_FORM_NOTAVAIL - data not available
223 * is null. 232 * PDF_FORM_AVAIL - data available
224 * 0 - data not available 233 * PDF_FORM_NOTEXIST - no form data
225 * 1 - data available
226 * 2 - no form data.
227 * Comments: 234 * Comments:
228 * This function call be called only after FPDFAvail_GetDocument if 235 * This function can be called only after FPDFAvail_GetDocument is
229 * called. 236 * called.
230 * The application should call this function whenever new data arrived, 237 * The application should call this function whenever new data arrived,
231 * and process all the 238 * and process all the
232 * generated download hints if any, until the function returns non-zero 239 * generated download hints if any, until the function returns non-zero
233 * value. Then the 240 * value. Then the
234 * application can perform page loading. Recommend to call 241 * application can perform page loading. Recommend to call
235 * FPDFDOC_InitFormFillEnvironment 242 * FPDFDOC_InitFormFillEnvironment
236 * after the function returns non-zero value. 243 * after the function returns non-zero value.
237 */ 244 */
238 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, 245 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail,
239 FX_DOWNLOADHINTS* hints); 246 FX_DOWNLOADHINTS* hints);
240 247
241 /** 248 /**
242 * Function: FPDFAvail_IsLinearized 249 * Function: FPDFAvail_IsLinearized
243 * To check whether a document is Linearized PDF file. 250 * To check whether a document is Linearized PDF file.
244 * 251 *
245 * Parameters: 252 * Parameters:
246 * avail - Handle to document availability provider returned by 253 * avail - Handle to document availability provider returned by
247 * FPDFAvail_Create 254 * FPDFAvail_Create
248 * Return value: 255 * Return value:
249 * return TRUE means the document is linearized PDF else not. 256 * PDF_LINEARIZED is a linearize file.
250 * FSDK_IS_LINEARIZED is a linearize file. 257 * PDF_NOT_LINEARIZED is not a linearize file.
251 * FSDK_NOT_LINEARIZED is not a linearize file. 258 * PDF_LINEARIZATION_UNKNOWN doesn't know whether the file is a
252 * FSDK_UNKNOW_LINEARIZED don't know whether the file is a linearize 259 *linearize file.
253 * file. 260 *
254 * Comments: 261 * Comments:
255 * It return TRUE/FALSE as soon as we have first 1K data. If the 262 * It return PDF_LINEARIZED or PDF_NOT_LINEARIZED as soon as
256 * file's size less than 263 * we have first 1K data. If the file's size less than 1K, it returns
257 * 1K,we don't known whether the PDF is a linearized file. 264 * PDF_LINEARIZATION_UNKNOWN because there is not enough information to
265 * tell whether a PDF file is a linearized file or not.
258 * 266 *
259 */ 267 */
260 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail); 268 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail);
261 269
262 #ifdef __cplusplus 270 #ifdef __cplusplus
263 } 271 }
264 #endif 272 #endif
265 273
266 #endif // PUBLIC_FPDF_DATAAVAIL_H_ 274 #endif // PUBLIC_FPDF_DATAAVAIL_H_
OLDNEW
« no previous file with comments | « pdfium.gyp ('k') | samples/pdfium_test.cc » ('j') | samples/pdfium_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698