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