• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The PDFium Authors
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_PPO_H_
8 #define PUBLIC_FPDF_PPO_H_
9 
10 // NOLINTNEXTLINE(build/include)
11 #include "fpdfview.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 // Experimental API.
18 // Import pages to a FPDF_DOCUMENT.
19 //
20 //   dest_doc     - The destination document for the pages.
21 //   src_doc      - The document to be imported.
22 //   page_indices - An array of page indices to be imported. The first page is
23 //                  zero. If |page_indices| is NULL, all pages from |src_doc|
24 //                  are imported.
25 //   length       - The length of the |page_indices| array.
26 //   index        - The page index at which to insert the first imported page
27 //                  into |dest_doc|. The first page is zero.
28 //
29 // Returns TRUE on success. Returns FALSE if any pages in |page_indices| is
30 // invalid.
31 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
32 FPDF_ImportPagesByIndex(FPDF_DOCUMENT dest_doc,
33                         FPDF_DOCUMENT src_doc,
34                         const int* page_indices,
35                         unsigned long length,
36                         int index);
37 
38 // Import pages to a FPDF_DOCUMENT.
39 //
40 //   dest_doc  - The destination document for the pages.
41 //   src_doc   - The document to be imported.
42 //   pagerange - A page range string, Such as "1,3,5-7". The first page is one.
43 //               If |pagerange| is NULL, all pages from |src_doc| are imported.
44 //   index     - The page index at which to insert the first imported page into
45 //               |dest_doc|. The first page is zero.
46 //
47 // Returns TRUE on success. Returns FALSE if any pages in |pagerange| is
48 // invalid or if |pagerange| cannot be read.
49 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
50                                                      FPDF_DOCUMENT src_doc,
51                                                      FPDF_BYTESTRING pagerange,
52                                                      int index);
53 
54 // Experimental API.
55 // Create a new document from |src_doc|.  The pages of |src_doc| will be
56 // combined to provide |num_pages_on_x_axis x num_pages_on_y_axis| pages per
57 // |output_doc| page.
58 //
59 //   src_doc             - The document to be imported.
60 //   output_width        - The output page width in PDF "user space" units.
61 //   output_height       - The output page height in PDF "user space" units.
62 //   num_pages_on_x_axis - The number of pages on X Axis.
63 //   num_pages_on_y_axis - The number of pages on Y Axis.
64 //
65 // Return value:
66 //   A handle to the created document, or NULL on failure.
67 //
68 // Comments:
69 //   number of pages per page = num_pages_on_x_axis * num_pages_on_y_axis
70 //
71 FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
72 FPDF_ImportNPagesToOne(FPDF_DOCUMENT src_doc,
73                        float output_width,
74                        float output_height,
75                        size_t num_pages_on_x_axis,
76                        size_t num_pages_on_y_axis);
77 
78 // Experimental API.
79 // Create a template to generate form xobjects from |src_doc|'s page at
80 // |src_page_index|, for use in |dest_doc|.
81 //
82 // Returns a handle on success, or NULL on failure. Caller owns the newly
83 // created object.
84 FPDF_EXPORT FPDF_XOBJECT FPDF_CALLCONV
85 FPDF_NewXObjectFromPage(FPDF_DOCUMENT dest_doc,
86                         FPDF_DOCUMENT src_doc,
87                         int src_page_index);
88 
89 // Experimental API.
90 // Close an FPDF_XOBJECT handle created by FPDF_NewXObjectFromPage().
91 // FPDF_PAGEOBJECTs created from the FPDF_XOBJECT handle are not affected.
92 FPDF_EXPORT void FPDF_CALLCONV FPDF_CloseXObject(FPDF_XOBJECT xobject);
93 
94 // Experimental API.
95 // Create a new form object from an FPDF_XOBJECT object.
96 //
97 // Returns a new form object on success, or NULL on failure. Caller owns the
98 // newly created object.
99 FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
100 FPDF_NewFormObjectFromXObject(FPDF_XOBJECT xobject);
101 
102 // Copy the viewer preferences from |src_doc| into |dest_doc|.
103 //
104 //   dest_doc - Document to write the viewer preferences into.
105 //   src_doc  - Document to read the viewer preferences from.
106 //
107 // Returns TRUE on success.
108 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
109 FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_DOCUMENT src_doc);
110 
111 #ifdef __cplusplus
112 }  // extern "C"
113 #endif  // __cplusplus
114 
115 #endif  // PUBLIC_FPDF_PPO_H_
116