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