blob: 44520a5baf2e4864026633ad8ef4f1235f26ff0f [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// 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 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
10#include "fpdfview.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070016// Structure for custom file write
Tom Sepezcf22eb82015-05-12 17:28:08 -070017typedef struct FPDF_FILEWRITE_ {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070018 //
19 // Version number of the interface. Currently must be 1.
20 //
21 int version;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070022
Nico Weber9d8ec5a2015-08-04 13:00:21 -070023 //
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 Sepezcf22eb82015-05-12 17:28:08 -070042} FPDF_FILEWRITE;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070043
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070044/** @brief Incremental. */
Nico Weber9d8ec5a2015-08-04 13:00:21 -070045#define FPDF_INCREMENTAL 1
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070046/** @brief No Incremental. */
Nico Weber9d8ec5a2015-08-04 13:00:21 -070047#define FPDF_NO_INCREMENTAL 2
Bo Xua5572c32014-06-12 13:40:04 -070048/** @brief Remove security. */
Nico Weber9d8ec5a2015-08-04 13:00:21 -070049#define FPDF_REMOVE_SECURITY 3
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070050
51// Function: FPDF_SaveAsCopy
Tom Sepez9857e202015-05-13 17:09:26 -070052// Saves the copy of specified document in custom way.
53// Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -070054// document - Handle to document. Returned by
55// FPDF_LoadDocument and FPDF_CreateNewDocument.
Tom Sepez9857e202015-05-13 17:09:26 -070056// pFileWrite - A pointer to a custom file write structure.
57// flags - The creating flags.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070058// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -070059// TRUE for succeed, FALSE for failed.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070060//
Nico Weber9d8ec5a2015-08-04 13:00:21 -070061DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document,
62 FPDF_FILEWRITE* pFileWrite,
63 FPDF_DWORD flags);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070064
65// Function: FPDF_SaveWithVersion
Nico Weber9d8ec5a2015-08-04 13:00:21 -070066// Same as function ::FPDF_SaveAsCopy, except the file version of the
67// saved document could be specified by user.
Tom Sepez9857e202015-05-13 17:09:26 -070068// Parameters:
69// document - Handle to document.
70// pFileWrite - A pointer to a custom file write structure.
71// flags - The creating flags.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070072// fileVersion - The PDF file version. File version: 14 for 1.4,
73// 15 for 1.5, ...
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070074// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -070075// TRUE if succeed, FALSE if failed.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070076//
Nico Weber9d8ec5a2015-08-04 13:00:21 -070077DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,
78 FPDF_FILEWRITE* pFileWrite,
79 FPDF_DWORD flags,
80 int fileVersion);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070081
82#ifdef __cplusplus
Tom Sepez9857e202015-05-13 17:09:26 -070083}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070084#endif
85
Tom Sepez9857e202015-05-13 17:09:26 -070086#endif // PUBLIC_FPDF_SAVE_H_