blob: aa326032ca5d46c820af546c5fabb72e02549c7e [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
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
Tom Sepez9857e202015-05-13 17:09:26 -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
Tom Sepez9857e202015-05-13 17:09:26 -070025 //
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 //
41 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
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070045/** @brief Incremental. */
Tom Sepez9857e202015-05-13 17:09:26 -070046#define FPDF_INCREMENTAL 1
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070047/** @brief No Incremental. */
Tom Sepez9857e202015-05-13 17:09:26 -070048#define FPDF_NO_INCREMENTAL 2
Bo Xua5572c32014-06-12 13:40:04 -070049/** @brief Remove security. */
Tom Sepez9857e202015-05-13 17:09:26 -070050#define FPDF_REMOVE_SECURITY 3
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070051
52// Function: FPDF_SaveAsCopy
Tom Sepez9857e202015-05-13 17:09:26 -070053// Saves the copy of specified document in custom way.
54// Parameters:
55// document - Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.
56// 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//
Tom Sepez9857e202015-05-13 17:09:26 -070061DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy( FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
62 FPDF_DWORD flags );
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070063
64// Function: FPDF_SaveWithVersion
Tom Sepez9857e202015-05-13 17:09:26 -070065// Same as function ::FPDF_SaveAsCopy, except the file version of the saved document could be specified by user.
66// Parameters:
67// document - Handle to document.
68// pFileWrite - A pointer to a custom file write structure.
69// flags - The creating flags.
70// fileVersion - The PDF file version. File version: 14 for 1.4, 15 for 1.5, ...
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070071// Return value:
Tom Sepez9857e202015-05-13 17:09:26 -070072// TRUE if succeed, FALSE if failed.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070073//
74DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
Tom Sepez9857e202015-05-13 17:09:26 -070075 FPDF_DWORD flags, int fileVersion);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070076
77#ifdef __cplusplus
Tom Sepez9857e202015-05-13 17:09:26 -070078}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070079#endif
80
Tom Sepez9857e202015-05-13 17:09:26 -070081#endif // PUBLIC_FPDF_SAVE_H_