John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 7 | #ifndef PUBLIC_FPDF_SAVE_H_ |
| 8 | #define PUBLIC_FPDF_SAVE_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
| 10 | #include "fpdfview.h" |
| 11 | |
| 12 | #ifdef __cplusplus |
| 13 | extern "C" { |
| 14 | #endif |
| 15 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 16 | // Structure for custom file write |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 17 | typedef struct FPDF_FILEWRITE_ { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 18 | // |
| 19 | // Version number of the interface. Currently must be 1. |
| 20 | // |
| 21 | int version; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 22 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 23 | // |
| 24 | // Method: WriteBlock |
| 25 | // Output a block of data in your custom way. |
| 26 | // Interface Version: |
| 27 | // 1 |
| 28 | // Implementation Required: |
| 29 | // Yes |
| 30 | // Comments: |
| 31 | // Called by function FPDF_SaveDocument |
| 32 | // Parameters: |
| 33 | // pThis - Pointer to the structure itself |
| 34 | // pData - Pointer to a buffer to output |
| 35 | // size - The size of the buffer. |
| 36 | // Return value: |
| 37 | // Should be non-zero if successful, zero for error. |
| 38 | // |
| 39 | int (*WriteBlock)(struct FPDF_FILEWRITE_* pThis, |
| 40 | const void* pData, |
| 41 | unsigned long size); |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 42 | } FPDF_FILEWRITE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 43 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 44 | /** @brief Incremental. */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 45 | #define FPDF_INCREMENTAL 1 |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 46 | /** @brief No Incremental. */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 47 | #define FPDF_NO_INCREMENTAL 2 |
Bo Xu | a5572c3 | 2014-06-12 13:40:04 -0700 | [diff] [blame] | 48 | /** @brief Remove security. */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 49 | #define FPDF_REMOVE_SECURITY 3 |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 50 | |
| 51 | // Function: FPDF_SaveAsCopy |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 52 | // Saves the copy of specified document in custom way. |
| 53 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 54 | // document - Handle to document. Returned by |
| 55 | // FPDF_LoadDocument and FPDF_CreateNewDocument. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 56 | // pFileWrite - A pointer to a custom file write structure. |
| 57 | // flags - The creating flags. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 58 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 59 | // TRUE for succeed, FALSE for failed. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 60 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 61 | DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document, |
| 62 | FPDF_FILEWRITE* pFileWrite, |
| 63 | FPDF_DWORD flags); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 64 | |
| 65 | // Function: FPDF_SaveWithVersion |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 66 | // Same as function ::FPDF_SaveAsCopy, except the file version of the |
| 67 | // saved document could be specified by user. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 68 | // Parameters: |
| 69 | // document - Handle to document. |
| 70 | // pFileWrite - A pointer to a custom file write structure. |
| 71 | // flags - The creating flags. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 72 | // fileVersion - The PDF file version. File version: 14 for 1.4, |
| 73 | // 15 for 1.5, ... |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 74 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 75 | // TRUE if succeed, FALSE if failed. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 76 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 77 | DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, |
| 78 | FPDF_FILEWRITE* pFileWrite, |
| 79 | FPDF_DWORD flags, |
| 80 | int fileVersion); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 81 | |
| 82 | #ifdef __cplusplus |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 83 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 84 | #endif |
| 85 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 86 | #endif // PUBLIC_FPDF_SAVE_H_ |