blob: 800d4e758c0f20f53f3d785bf308fed08dd67228 [file] [log] [blame]
K. Moon832a6942022-10-31 20:11:31 +00001// Copyright 2014 The PDFium Authors
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Tom Sepez9857e202015-05-13 17:09:26 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Tom Sepez9857e202015-05-13 17:09:26 -07007#ifndef PUBLIC_FPDF_SAVE_H_
8#define PUBLIC_FPDF_SAVE_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
Tom Sepeze020cf32019-12-19 00:55:38 +000010// clang-format off
Dan Sinclair85c8e7f2016-11-21 13:50:32 -050011// NOLINTNEXTLINE(build/include)
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070012#include "fpdfview.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070018// Structure for custom file write
Tom Sepezcf22eb82015-05-12 17:28:08 -070019typedef struct FPDF_FILEWRITE_ {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070020 //
21 // Version number of the interface. Currently must be 1.
22 //
23 int version;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070024
Nico Weber9d8ec5a2015-08-04 13:00:21 -070025 // 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 Weber9d8ec5a2015-08-04 13:00:21 -070039 int (*WriteBlock)(struct FPDF_FILEWRITE_* pThis,
40 const void* pData,
41 unsigned long size);
Tom Sepezcf22eb82015-05-12 17:28:08 -070042} FPDF_FILEWRITE;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070043
Tom Sepeze020cf32019-12-19 00:55:38 +000044 // Flags for FPDF_SaveAsCopy()
Nico Weber9d8ec5a2015-08-04 13:00:21 -070045#define FPDF_INCREMENTAL 1
Nico Weber9d8ec5a2015-08-04 13:00:21 -070046#define FPDF_NO_INCREMENTAL 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -070047#define FPDF_REMOVE_SECURITY 3
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070048
49// Function: FPDF_SaveAsCopy
Tom Sepez9857e202015-05-13 17:09:26 -070050// Saves the copy of specified document in custom way.
51// Parameters:
Tom Sepeze020cf32019-12-19 00:55:38 +000052// document - Handle to document, as returned by
53// FPDF_LoadDocument() or FPDF_CreateNewDocument().
Tom Sepez9857e202015-05-13 17:09:26 -070054// pFileWrite - A pointer to a custom file write structure.
55// flags - The creating flags.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070056// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -070057// TRUE for succeed, FALSE for failed.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070058//
Dan Sinclair00d2ad12017-08-10 14:13:02 -040059FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SaveAsCopy(FPDF_DOCUMENT document,
60 FPDF_FILEWRITE* pFileWrite,
61 FPDF_DWORD flags);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070062
63// Function: FPDF_SaveWithVersion
Tom Sepeze020cf32019-12-19 00:55:38 +000064// Same as FPDF_SaveAsCopy(), except the file version of the
65// saved document can be specified by the caller.
Tom Sepez9857e202015-05-13 17:09:26 -070066// Parameters:
67// document - Handle to document.
68// pFileWrite - A pointer to a custom file write structure.
69// flags - The creating flags.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070070// fileVersion - The PDF file version. File version: 14 for 1.4,
Tom Sepeze020cf32019-12-19 00:55:38 +000071// 15 for 1.5, ...
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070072// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -070073// TRUE if succeed, FALSE if failed.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070074//
Dan Sinclair00d2ad12017-08-10 14:13:02 -040075FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
76FPDF_SaveWithVersion(FPDF_DOCUMENT document,
77 FPDF_FILEWRITE* pFileWrite,
78 FPDF_DWORD flags,
79 int fileVersion);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070080
81#ifdef __cplusplus
Tom Sepez9857e202015-05-13 17:09:26 -070082}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070083#endif
84
Tom Sepez9857e202015-05-13 17:09:26 -070085#endif // PUBLIC_FPDF_SAVE_H_