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

Side by Side Diff: public/fpdf_dataavail.h

Issue 1353093003: Support linearized loading (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
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
« no previous file with comments | « pdfium.gyp ('k') | samples/pdfium_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 * Function: FPDFAvail_IsDocAvail 129 * Function: FPDFAvail_IsDocAvail
124 * Check whether the document is ready for loading, if not, get 130 * Check whether the document is ready for loading, if not, get
125 * download hints. 131 * download hints.
126 * 132 *
127 * Parameters: 133 * Parameters:
128 * avail - Handle to document availability provider returned by 134 * avail - Handle to document availability provider returned by
129 * FPDFAvail_Create 135 * FPDFAvail_Create
130 * hints - Pointer to a download hints interface, receiving 136 * hints - Pointer to a download hints interface, receiving
131 * generated hints 137 * generated hints
132 * Return value: 138 * Return value:
133 * Non-zero for page is fully available, 0 for page not yet available. 139 * PDF_DATA_ERROR: A common error is returned. It can't tell
140 * whehter data are availabe or not.
141 * PDF_DATA_NOTAVAIL: Data are not yet available.
142 * PDF_DATA_AVAIL: Data are available.
134 * Comments: 143 * Comments:
135 * The application should call this function whenever new data arrived, 144 * Applications should call this function whenever new data arrived,
136 * and process all the 145 * and process all the generated download hints if any, until the
137 * generated download hints if any, until the function returns non-zero 146 * function returns PDF_DATA_ERROR or PDF_DATA_AVAIL. Then
138 * value. Then the 147 * applications can call FPDFAvail_GetDocument() to get a document
139 * application can call FPDFAvail_GetDocument() to get a document 148 * handle.
140 * handle.
141 */ 149 */
142 DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, 150 DLLEXPORT int STDCALL
143 FX_DOWNLOADHINTS* hints); 151 FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
144 152
145 /** 153 /**
146 * Function: FPDFAvail_GetDocument 154 * Function: FPDFAvail_GetDocument
147 * Get document from the availability provider. 155 * Get document from the availability provider.
148 * 156 *
149 * Parameters: 157 * Parameters:
150 * avail - Handle to document availability provider returned by 158 * avail - Handle to document availability provider returned by
151 * FPDFAvail_Create 159 * FPDFAvail_Create
152 * password - Optional password for decrypting the PDF file. 160 * password - Optional password for decrypting the PDF file.
153 * Return value: 161 * Return value:
(...skipping 28 matching lines...) Expand all
182 * Check whether a page is ready for loading, if not, get download 190 * Check whether a page is ready for loading, if not, get download
183 * hints. 191 * hints.
184 * 192 *
185 * Parameters: 193 * Parameters:
186 * avail - Handle to document availability provider returned by 194 * avail - Handle to document availability provider returned by
187 * FPDFAvail_Create 195 * FPDFAvail_Create
188 * page_index - Index number of the page. 0 for the first page. 196 * page_index - Index number of the page. 0 for the first page.
189 * hints - Pointer to a download hints interface, receiving 197 * hints - Pointer to a download hints interface, receiving
190 * generated hints 198 * generated hints
191 * Return value: 199 * Return value:
192 * Non-zero for page is fully available, 0 for page not yet available. 200 * PDF_DATA_ERROR: A common error is returned. It can't tell
201 * whehter data are availabe or not.
202 * PDF_DATA_NOTAVAIL: Data are not yet available.
203 * PDF_DATA_AVAIL: Data are available.
193 * Comments: 204 * Comments:
194 * This function call be called only after FPDFAvail_GetDocument if 205 * This function can be called only after FPDFAvail_GetDocument is
195 * called. 206 * called. Applications should call this function whenever new data
196 * The application should call this function whenever new data arrived, 207 * arrived and process all the generated download hints if any, until
197 * and process all the 208 * this function returns PDF_DATA_ERROR or PDF_DATA_AVAIL. Then
198 * generated download hints if any, until the function returns non-zero 209 * applications can perform page loading.
199 * value. Then the
200 * application can perform page loading.
201 */ 210 */
202 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, 211 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
203 int page_index, 212 int page_index,
204 FX_DOWNLOADHINTS* hints); 213 FX_DOWNLOADHINTS* hints);
205 214
206 /** 215 /**
207 * Function: FPDFAvail_ISFormAvail 216 * Function: FPDFAvail_ISFormAvail
208 * Check whether Form data is ready for init, if not, get download 217 * Check whether Form data is ready for init, if not, get download
209 * hints. 218 * hints.
210 * 219 *
211 * Parameters: 220 * Parameters:
212 * avail - Handle to document availability provider returned by 221 * avail - Handle to document availability provider returned by
213 * FPDFAvail_Create 222 * FPDFAvail_Create
214 * hints - Pointer to a download hints interface, receiving 223 * hints - Pointer to a download hints interface, receiving
215 * generated hints 224 * generated hints
216 * Return value: 225 * Return value:
217 * Non-zero for Form data is fully available, 0 for Form data not yet 226 * PDF_FORM_ERROR - A common eror, in general incorrect parameters,
218 * available. 227 * like 'hints' is nullptr.
219 * Details: -1 - error, the input parameter not correct, such as hints 228 * PDF_FORM_NOTAVAIL - data not available
220 * is null. 229 * PDF_FORM_AVAIL - data available
221 * 0 - data not available 230 * PDF_FORM_NOTEXIST - no form data
222 * 1 - data available
223 * 2 - no form data.
224 * Comments: 231 * Comments:
225 * This function call be called only after FPDFAvail_GetDocument if 232 * This function can be called only after FPDFAvail_GetDocument is
226 * called. 233 * called.
227 * The application should call this function whenever new data arrived, 234 * The application should call this function whenever new data arrived,
228 * and process all the 235 * and process all the
229 * generated download hints if any, until the function returns non-zero 236 * generated download hints if any, until the function returns non-zero
230 * value. Then the 237 * value. Then the
231 * application can perform page loading. Recommend to call 238 * application can perform page loading. Recommend to call
232 * FPDFDOC_InitFormFillEnvironment 239 * FPDFDOC_InitFormFillEnvironment
233 * after the function returns non-zero value. 240 * after the function returns non-zero value.
234 */ 241 */
235 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, 242 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail,
236 FX_DOWNLOADHINTS* hints); 243 FX_DOWNLOADHINTS* hints);
237 244
238 /** 245 /**
239 * Function: FPDFAvail_IsLinearized 246 * Function: FPDFAvail_IsLinearized
240 * To check whether a document is Linearized PDF file. 247 * To check whether a document is Linearized PDF file.
241 * 248 *
242 * Parameters: 249 * Parameters:
243 * avail - Handle to document availability provider returned by 250 * avail - Handle to document availability provider returned by
244 * FPDFAvail_Create 251 * FPDFAvail_Create
245 * Return value: 252 * Return value:
246 * return TRUE means the document is linearized PDF else not. 253 * PDF_LINEARIZED is a linearize file.
247 * FSDK_IS_LINEARIZED is a linearize file. 254 * PDF_NOT_LINEARIZED is not a linearize file.
248 * FSDK_NOT_LINEARIZED is not a linearize file. 255 * PDF_LINEARIZATION_UNKNOWN doesn't know whether the file is a
249 * FSDK_UNKNOW_LINEARIZED don't know whether the file is a linearize 256 *linearize file.
250 * file. 257 *
251 * Comments: 258 * Comments:
252 * It return TRUE/FALSE as soon as we have first 1K data. If the 259 * It return PDF_LINEARIZED or PDF_NOT_LINEARIZED as soon as
253 * file's size less than 260 * we have first 1K data. If the file's size less than 1K, it returns
254 * 1K,we don't known whether the PDF is a linearized file. 261 * PDF_LINEARIZATION_UNKNOWN because there is not enough information to
262 * tell whether a PDF file is a linearized file or not.
255 * 263 *
256 */ 264 */
257 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail); 265 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail);
258 266
259 #ifdef __cplusplus 267 #ifdef __cplusplus
260 } 268 }
261 #endif 269 #endif
262 270
263 #endif // PUBLIC_FPDF_DATAAVAIL_H_ 271 #endif // PUBLIC_FPDF_DATAAVAIL_H_
OLDNEW
« no previous file with comments | « pdfium.gyp ('k') | samples/pdfium_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698