• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // 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 PUBLIC_FPDF_SAVE_H_
8 #define PUBLIC_FPDF_SAVE_H_
9 
10 // NOLINTNEXTLINE(build/include)
11 #include "fpdfview.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 // Structure for custom file write
18 typedef struct FPDF_FILEWRITE_ {
19   //
20   // Version number of the interface. Currently must be 1.
21   //
22   int version;
23 
24   //
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.
39   //
40   int (*WriteBlock)(struct FPDF_FILEWRITE_* pThis,
41                     const void* pData,
42                     unsigned long size);
43 } FPDF_FILEWRITE;
44 
45 /** @brief Incremental. */
46 #define FPDF_INCREMENTAL 1
47 /** @brief No Incremental. */
48 #define FPDF_NO_INCREMENTAL 2
49 /** @brief Remove security. */
50 #define FPDF_REMOVE_SECURITY 3
51 
52 // Function: FPDF_SaveAsCopy
53 //          Saves the copy of specified document in custom way.
54 // Parameters:
55 //          document        -   Handle to document. Returned by
56 //          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 //
62 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document,
63                                             FPDF_FILEWRITE* pFileWrite,
64                                             FPDF_DWORD flags);
65 
66 // Function: FPDF_SaveWithVersion
67 //          Same as function ::FPDF_SaveAsCopy, except the file version of the
68 //          saved document could be specified by user.
69 // Parameters:
70 //          document        -   Handle to document.
71 //          pFileWrite      -   A pointer to a custom file write structure.
72 //          flags           -   The creating flags.
73 //          fileVersion     -   The PDF file version. File version: 14 for 1.4,
74 //          15 for 1.5, ...
75 // Return value:
76 //          TRUE if succeed, FALSE if failed.
77 //
78 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,
79                                                  FPDF_FILEWRITE* pFileWrite,
80                                                  FPDF_DWORD flags,
81                                                  int fileVersion);
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif  // PUBLIC_FPDF_SAVE_H_
88