| OLD | NEW |
| 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 /** The result of the process which check linearized PDF. */ |
| 15 #define FSDK_IS_LINEARIZED 1 | 15 #define PDF_FILE_UNKNOW -1 |
| 16 #define FSDK_NOT_LINEARIZED 0 | 16 #define PDF_FILE_NOTLINEARIZED 0 |
| 17 #define FSDK_UNKNOW_LINEARIZED -1 | 17 #define PDF_FILE_LINEARIZED 1 |
| 18 #define PDF_FORM_NOTAVAIL 0 |
| 19 #define PDF_FORM_AVAIL 1 |
| 18 | 20 |
| 19 #ifdef __cplusplus | 21 #ifdef __cplusplus |
| 20 extern "C" { | 22 extern "C" { |
| 21 #endif | 23 #endif |
| 22 | 24 |
| 23 /** | 25 /** |
| 24 * Interface: FX_FILEAVAIL | 26 * Interface: FX_FILEAVAIL |
| 25 * Interface for checking whether the section of the file is available. | 27 * Interface for checking whether the section of the file is available. |
| 26 */ | 28 */ |
| 27 typedef struct _FX_FILEAVAIL { | 29 typedef struct _FX_FILEAVAIL { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 * Function: FPDFAvail_IsDocAvail | 125 * Function: FPDFAvail_IsDocAvail |
| 124 * Check whether the document is ready for loading, if not, get | 126 * Check whether the document is ready for loading, if not, get |
| 125 * download hints. | 127 * download hints. |
| 126 * | 128 * |
| 127 * Parameters: | 129 * Parameters: |
| 128 * avail - Handle to document availability provider returned by | 130 * avail - Handle to document availability provider returned by |
| 129 * FPDFAvail_Create | 131 * FPDFAvail_Create |
| 130 * hints - Pointer to a download hints interface, receiving | 132 * hints - Pointer to a download hints interface, receiving |
| 131 * generated hints | 133 * generated hints |
| 132 * Return value: | 134 * Return value: |
| 133 * Non-zero for page is fully available, 0 for page not yet available. | 135 * true is fully available, false for page not yet available. |
| 134 * Comments: | 136 * Comments: |
| 135 * The application should call this function whenever new data arrived, | 137 * The application should call this function whenever new data arrived, |
| 136 * and process all the | 138 * and process all the |
| 137 * generated download hints if any, until the function returns non-zero | 139 * generated download hints if any, until the function returns true. |
| 138 * value. Then the | 140 * Then the application can call FPDFAvail_GetDocument() to get a document |
| 139 * application can call FPDFAvail_GetDocument() to get a document | |
| 140 * handle. | 141 * handle. |
| 141 */ | 142 */ |
| 142 DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, | 143 DLLEXPORT FPDF_BOOL STDCALL |
| 143 FX_DOWNLOADHINTS* hints); | 144 FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints); |
| 144 | 145 |
| 145 /** | 146 /** |
| 146 * Function: FPDFAvail_GetDocument | 147 * Function: FPDFAvail_GetDocument |
| 147 * Get document from the availability provider. | 148 * Get document from the availability provider. |
| 148 * | 149 * |
| 149 * Parameters: | 150 * Parameters: |
| 150 * avail - Handle to document availability provider returned by | 151 * avail - Handle to document availability provider returned by |
| 151 * FPDFAvail_Create | 152 * FPDFAvail_Create |
| 152 * password - Optional password for decrypting the PDF file. | 153 * password - Optional password for decrypting the PDF file. |
| 153 * Return value: | 154 * Return value: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 182 * Check whether a page is ready for loading, if not, get download | 183 * Check whether a page is ready for loading, if not, get download |
| 183 * hints. | 184 * hints. |
| 184 * | 185 * |
| 185 * Parameters: | 186 * Parameters: |
| 186 * avail - Handle to document availability provider returned by | 187 * avail - Handle to document availability provider returned by |
| 187 * FPDFAvail_Create | 188 * FPDFAvail_Create |
| 188 * page_index - Index number of the page. 0 for the first page. | 189 * page_index - Index number of the page. 0 for the first page. |
| 189 * hints - Pointer to a download hints interface, receiving | 190 * hints - Pointer to a download hints interface, receiving |
| 190 * generated hints | 191 * generated hints |
| 191 * Return value: | 192 * Return value: |
| 192 * Non-zero for page is fully available, 0 for page not yet available. | 193 * true is fully available, false for page not yet available. |
| 193 * Comments: | 194 * Comments: |
| 194 * This function call be called only after FPDFAvail_GetDocument if | 195 * This function call be called only after FPDFAvail_GetDocument if |
| 195 * called. | 196 * called. |
| 196 * The application should call this function whenever new data arrived, | 197 * The application should call this function whenever new data arrived, |
| 197 * and process all the | 198 * and process all the |
| 198 * generated download hints if any, until the function returns non-zero | 199 * generated download hints if any, until the function returns true. |
| 199 * value. Then the | 200 * Then the application can perform page loading. |
| 200 * application can perform page loading. | |
| 201 */ | 201 */ |
| 202 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, | 202 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, |
| 203 int page_index, | 203 int page_index, |
| 204 FX_DOWNLOADHINTS* hints); | 204 FX_DOWNLOADHINTS* hints); |
| 205 | 205 |
| 206 /** | 206 /** |
| 207 * Function: FPDFAvail_ISFormAvail | 207 * Function: FPDFAvail_ISFormAvail |
| 208 * Check whether Form data is ready for init, if not, get download | 208 * Check whether Form data is ready for init, if not, get download |
| 209 * hints. | 209 * hints. |
| 210 * | 210 * |
| 211 * Parameters: | 211 * Parameters: |
| 212 * avail - Handle to document availability provider returned by | 212 * avail - Handle to document availability provider returned by |
| 213 * FPDFAvail_Create | 213 * FPDFAvail_Create |
| 214 * hints - Pointer to a download hints interface, receiving | 214 * hints - Pointer to a download hints interface, receiving |
| (...skipping 21 matching lines...) Expand all Loading... |
| 236 FX_DOWNLOADHINTS* hints); | 236 FX_DOWNLOADHINTS* hints); |
| 237 | 237 |
| 238 /** | 238 /** |
| 239 * Function: FPDFAvail_IsLinearized | 239 * Function: FPDFAvail_IsLinearized |
| 240 * To check whether a document is Linearized PDF file. | 240 * To check whether a document is Linearized PDF file. |
| 241 * | 241 * |
| 242 * Parameters: | 242 * Parameters: |
| 243 * avail - Handle to document availability provider returned by | 243 * avail - Handle to document availability provider returned by |
| 244 * FPDFAvail_Create | 244 * FPDFAvail_Create |
| 245 * Return value: | 245 * Return value: |
| 246 * return TRUE means the document is linearized PDF else not. | 246 * PDF_FILE_LINEARIZED is a linearize file. |
| 247 * FSDK_IS_LINEARIZED is a linearize file. | 247 * PDF_FILE_NOTLINEARIZED is not a linearize file. |
| 248 * FSDK_NOT_LINEARIZED is not a linearize file. | 248 * PDF_FILE_UNKNOW doesn't know whether the file is a linearize file. |
| 249 * FSDK_UNKNOW_LINEARIZED don't know whether the file is a linearize | 249 * |
| 250 * file. | |
| 251 * Comments: | 250 * Comments: |
| 252 * It return TRUE/FALSE as soon as we have first 1K data. If the | 251 * It return PDF_FILE_LINEARIZED or PDF_FILE_NOTLINEARIZED as soon as |
| 253 * file's size less than | 252 * 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. | 253 * PDF_FILE_UNKNOW because there is not enough information to |
| 254 * tell whether a PDF file is a linearized file or not. |
| 255 * | 255 * |
| 256 */ | 256 */ |
| 257 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail); | 257 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail); |
| 258 | 258 |
| 259 #ifdef __cplusplus | 259 #ifdef __cplusplus |
| 260 } | 260 } |
| 261 #endif | 261 #endif |
| 262 | 262 |
| 263 #endif // PUBLIC_FPDF_DATAAVAIL_H_ | 263 #endif // PUBLIC_FPDF_DATAAVAIL_H_ |
| OLD | NEW |