blob: 28b169b0df869070315ad81103d29e422b837c18 [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.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef _FPDFSAVE_H_
8#define _FPDFSAVE_H_
9
10#include "fpdfview.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16
17// Structure for custom file write
Tom Sepezcf22eb82015-05-12 17:28:08 -070018typedef struct FPDF_FILEWRITE_ {
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070019
20 //
21 //Version number of the interface. Currently must be 1.
22 //
23 int version;
24
25 //
26 // Method: WriteBlock
27 // Output a block of data in your custom way.
28 // Interface Version:
29 // 1
30 // Implementation Required:
31 // Yes
32 // Comments:
33 // Called by function FPDF_SaveDocument
34 // Parameters:
35 // pThis - Pointer to the structure itself
36 // pData - Pointer to a buffer to output
37 // size - The size of the buffer.
38 // Return value:
39 // Should be non-zero if successful, zero for error.
40 //
Tom Sepezcf22eb82015-05-12 17:28:08 -070041 int (*WriteBlock)(struct FPDF_FILEWRITE_* pThis, const void* pData, unsigned long size);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070042
Tom Sepezcf22eb82015-05-12 17:28:08 -070043} FPDF_FILEWRITE;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070044
45
46/** @brief Incremental. */
47#define FPDF_INCREMENTAL 1
48/** @brief No Incremental. */
49#define FPDF_NO_INCREMENTAL 2
Bo Xua5572c32014-06-12 13:40:04 -070050/** @brief Remove security. */
51#define FPDF_REMOVE_SECURITY 3
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070052
53// Function: FPDF_SaveAsCopy
54// Saves the copy of specified document in custom way.
55// Parameters:
56// document - Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.
57// pFileWrite - A pointer to a custom file write structure.
58// flags - The creating flags.
59// Return value:
60// TRUE for succeed, FALSE for failed.
61//
62DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy( FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
63 FPDF_DWORD flags );
64
65// Function: FPDF_SaveWithVersion
66// Same as function ::FPDF_SaveAsCopy, except the file version of the saved document could be specified by user.
67// Parameters:
68// document - Handle to document.
69// pFileWrite - A pointer to a custom file write structure.
70// flags - The creating flags.
71// fileVersion - The PDF file version. File version: 14 for 1.4, 15 for 1.5, ...
72// Return value:
73// TRUE if succeed, FALSE if failed.
74//
75DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
76 FPDF_DWORD flags, int fileVersion);
77
78#ifdef __cplusplus
79};
80#endif
81
82#endif //_FPDFSAVE_H_