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 _FPDFSAVE_H_ | 7 #ifndef _FPDFSAVE_H_ |
8 #define _FPDFSAVE_H_ | 8 #define _FPDFSAVE_H_ |
9 | 9 |
10 #include "fpdfview.h" | 10 #include "fpdfview.h" |
11 | 11 |
12 #ifdef __cplusplus | 12 #ifdef __cplusplus |
13 extern "C" { | 13 extern "C" { |
14 #endif | 14 #endif |
15 | 15 |
| 16 // Structure for custom file write |
| 17 struct FPDF_FILEWRITE { |
| 18 // |
| 19 // Version number of the interface. Currently must be 1. |
| 20 // |
| 21 int version; |
16 | 22 |
17 // Structure for custom file write | 23 // |
18 struct FPDF_FILEWRITE{ | 24 // Method: WriteBlock |
19 | 25 //» » » Output a block of data in your custom way. |
20 » // | 26 // Interface Version: |
21 » //Version number of the interface. Currently must be 1. | 27 //» » » 1 |
22 » // | 28 // Implementation Required: |
23 » int version; | 29 //» » » Yes |
24 | 30 // Comments: |
25 » // | 31 //» » » Called by function FPDF_SaveDocument |
26 » // Method: WriteBlock | 32 // Parameters: |
27 » //» » » Output a block of data in your custom way. | 33 //» » » pThis» » -» Pointer to the structure itself |
28 » // Interface Version: | 34 //» » » pData» » -» Pointer to a buffer to output |
29 » //» » » 1 | 35 //» » » size» » -» The size of the buffer. |
30 » // Implementation Required: | 36 // Return value: |
31 » //» » » Yes | 37 //» » » Should be non-zero if successful, zero for error. |
32 » // Comments: | 38 // |
33 » //» » » Called by function FPDF_SaveDocument | 39 int (*WriteBlock)(FPDF_FILEWRITE* pThis, |
34 » // Parameters: | 40 const void* pData, |
35 » //» » » pThis» » -» Pointer to the structure
itself | 41 unsigned long size); |
36 » //» » » pData» » -» Pointer to a buffer to o
utput | |
37 » //» » » size» » -» The size of the buffer. | |
38 » // Return value: | |
39 » //» » » Should be non-zero if successful, zero for error
. | |
40 » // | |
41 » int» » (*WriteBlock)( FPDF_FILEWRITE* pThis, const void* pData,
unsigned long size); | |
42 | |
43 }; | 42 }; |
44 | 43 |
45 | |
46 /** @brief Incremental. */ | 44 /** @brief Incremental. */ |
47 #define FPDF_INCREMENTAL» » 1 | 45 #define FPDF_INCREMENTAL 1 |
48 /** @brief No Incremental. */ | 46 /** @brief No Incremental. */ |
49 #define FPDF_NO_INCREMENTAL» » 2 | 47 #define FPDF_NO_INCREMENTAL 2 |
50 /** @brief Remove security. */ | 48 /** @brief Remove security. */ |
51 #define FPDF_REMOVE_SECURITY» 3 | 49 #define FPDF_REMOVE_SECURITY 3 |
52 | 50 |
53 // Function: FPDF_SaveAsCopy | 51 // Function: FPDF_SaveAsCopy |
54 // Saves the copy of specified document in custom way. | 52 // Saves the copy of specified document in custom way. |
55 // Parameters:» | 53 // Parameters: |
56 //» » » document» » -» Handle to document. Retu
rned by FPDF_LoadDocument and FPDF_CreateNewDocument. | 54 //» » » document» » -» Handle to document. Retu
rned by |
57 //» » » pFileWrite» » -» A pointer to a custom fi
le write structure. | 55 //FPDF_LoadDocument and FPDF_CreateNewDocument. |
| 56 //» » » pFileWrite» » -» A pointer to a custom fi
le |
| 57 //write structure. |
58 // flags - The creating flags. | 58 // flags - The creating flags. |
59 // Return value: | 59 // Return value: |
60 // TRUE for succeed, FALSE for failed. | 60 // TRUE for succeed, FALSE for failed. |
61 // | 61 // |
62 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(» FPDF_DOCUMENT document,FPDF_FILE
WRITE * pFileWrite, | 62 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document, |
63 » » » » » » » » » »
» » FPDF_DWORD flags ); | 63 FPDF_FILEWRITE* pFileWrite, |
| 64 FPDF_DWORD flags); |
64 | 65 |
65 // Function: FPDF_SaveWithVersion | 66 // Function: FPDF_SaveWithVersion |
66 //» » » Same as function ::FPDF_SaveAsCopy, except the file vers
ion of the saved document could be specified by user. | 67 //» » » Same as function ::FPDF_SaveAsCopy, except the file vers
ion |
67 // Parameters:» | 68 //of the saved document could be specified by user. |
| 69 // Parameters: |
68 // document - Handle to document. | 70 // document - Handle to document. |
69 //» » » pFileWrite» » -» A pointer to a custom fi
le write structure. | 71 //» » » pFileWrite» » -» A pointer to a custom fi
le |
| 72 //write structure. |
70 // flags - The creating flags. | 73 // flags - The creating flags. |
71 //» » » fileVersion» » -» The PDF file version. Fi
le version: 14 for 1.4, 15 for 1.5, ... | 74 //» » » fileVersion» » -» The PDF file version. Fi
le |
| 75 //version: 14 for 1.4, 15 for 1.5, ... |
72 // Return value: | 76 // Return value: |
73 // TRUE if succeed, FALSE if failed. | 77 // TRUE if succeed, FALSE if failed. |
74 // | 78 // |
75 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,FPDF_FIL
EWRITE * pFileWrite, | 79 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, |
76 » FPDF_DWORD flags, int fileVersion); | 80 FPDF_FILEWRITE* pFileWrite, |
| 81 FPDF_DWORD flags, |
| 82 int fileVersion); |
77 | 83 |
78 #ifdef __cplusplus | 84 #ifdef __cplusplus |
79 }; | 85 }; |
80 #endif | 86 #endif |
81 | 87 |
82 #endif //_FPDFSAVE_H_ | 88 #endif //_FPDFSAVE_H_ |
OLD | NEW |