K. Moon | 832a694 | 2022-10-31 20:11:31 +0000 | [diff] [blame] | 1 | // Copyright 2014 The PDFium Authors |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 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 | |
Tom Sepez | e020cf3 | 2019-12-19 00:55:38 +0000 | [diff] [blame] | 10 | // clang-format off |
Dan Sinclair | 85c8e7f | 2016-11-21 13:50:32 -0500 | [diff] [blame] | 11 | // NOLINTNEXTLINE(build/include) |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 12 | #include "fpdfview.h" |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 18 | // Structure for custom file write |
Tom Sepez | cf22eb8 | 2015-05-12 17:28:08 -0700 | [diff] [blame] | 19 | typedef struct FPDF_FILEWRITE_ { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 20 | // |
| 21 | // Version number of the interface. Currently must be 1. |
| 22 | // |
| 23 | int version; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 24 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 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. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 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 | |
Tom Sepez | e020cf3 | 2019-12-19 00:55:38 +0000 | [diff] [blame] | 44 | // Flags for FPDF_SaveAsCopy() |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 45 | #define FPDF_INCREMENTAL 1 |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 46 | #define FPDF_NO_INCREMENTAL 2 |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 47 | #define FPDF_REMOVE_SECURITY 3 |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 48 | |
| 49 | // Function: FPDF_SaveAsCopy |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 50 | // Saves the copy of specified document in custom way. |
| 51 | // Parameters: |
Tom Sepez | e020cf3 | 2019-12-19 00:55:38 +0000 | [diff] [blame] | 52 | // document - Handle to document, as returned by |
| 53 | // FPDF_LoadDocument() or FPDF_CreateNewDocument(). |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 54 | // pFileWrite - A pointer to a custom file write structure. |
| 55 | // flags - The creating flags. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 56 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 57 | // TRUE for succeed, FALSE for failed. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 58 | // |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 59 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SaveAsCopy(FPDF_DOCUMENT document, |
| 60 | FPDF_FILEWRITE* pFileWrite, |
| 61 | FPDF_DWORD flags); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 62 | |
| 63 | // Function: FPDF_SaveWithVersion |
Tom Sepez | e020cf3 | 2019-12-19 00:55:38 +0000 | [diff] [blame] | 64 | // Same as FPDF_SaveAsCopy(), except the file version of the |
| 65 | // saved document can be specified by the caller. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 66 | // Parameters: |
| 67 | // document - Handle to document. |
| 68 | // pFileWrite - A pointer to a custom file write structure. |
| 69 | // flags - The creating flags. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 70 | // fileVersion - The PDF file version. File version: 14 for 1.4, |
Tom Sepez | e020cf3 | 2019-12-19 00:55:38 +0000 | [diff] [blame] | 71 | // 15 for 1.5, ... |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 72 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 73 | // TRUE if succeed, FALSE if failed. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 74 | // |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 75 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV |
| 76 | FPDF_SaveWithVersion(FPDF_DOCUMENT document, |
| 77 | FPDF_FILEWRITE* pFileWrite, |
| 78 | FPDF_DWORD flags, |
| 79 | int fileVersion); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 80 | |
| 81 | #ifdef __cplusplus |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 82 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 83 | #endif |
| 84 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 85 | #endif // PUBLIC_FPDF_SAVE_H_ |