Poppler CPP 25.12.90
poppler-document.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009-2010, Pino Toscano <pino@kde.org>
3 * Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com>
4 * Copyright (C) 2019, Masamichi Hosoda <trueroad@trueroad.jp>
5 * Copyright (C) 2019, 2021, 2022, Albert Astals Cid <aacid@kde.org>
6 * Copyright (C) 2025 Nathanael d. Noblet <nathanael@noblet.ca>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef POPPLER_DOCUMENT_H
24#define POPPLER_DOCUMENT_H
25
26#include "poppler-global.h"
27#include "poppler-font.h"
28
29#include <map>
30
31namespace poppler {
32
33class destination;
34class document_private;
35class embedded_file;
36class page;
37class toc;
38
39class POPPLER_CPP_EXPORT document : public poppler::noncopyable
40{
41public:
51
52 enum page_layout_enum
53 {
54 no_layout,
55 single_page,
56 one_column,
57 two_column_left,
58 two_column_right,
59 two_page_left,
60 two_page_right
61 };
62
63 enum class form_type
64 {
65 none,
66 acro,
67 xfa
68 };
69
70 ~document();
71
72 bool is_locked() const;
73 bool unlock(const std::string &owner_password, const std::string &user_password);
74
75 page_mode_enum page_mode() const;
76 page_layout_enum page_layout() const;
77 void get_pdf_version(int *major, int *minor) const;
78 std::vector<std::string> info_keys() const;
79
80 ustring info_key(const std::string &key) const;
81 bool set_info_key(const std::string &key, const ustring &val);
82
83 time_t info_date_t(const std::string &key) const;
84 bool set_info_date_t(const std::string &key, time_t val);
85
86 ustring get_title() const;
87 bool set_title(const ustring &title);
88 ustring get_author() const;
89 bool set_author(const ustring &author);
90 ustring get_subject() const;
91 bool set_subject(const ustring &subject);
92 ustring get_keywords() const;
93 bool set_keywords(const ustring &keywords);
94 ustring get_creator() const;
95 bool set_creator(const ustring &creator);
96 ustring get_producer() const;
97 bool set_producer(const ustring &producer);
98 time_t get_creation_date_t() const;
99 bool set_creation_date_t(time_t creation_date);
100 time_t get_modification_date_t() const;
101 bool set_modification_date_t(time_t mod_date);
102
103 bool remove_info();
104
105 bool is_encrypted() const;
106 bool is_linearized() const;
107 form_type form_type() const;
108 bool has_javascript() const;
109
110 bool has_permission(permission_enum which) const;
111 ustring metadata() const;
112 bool get_pdf_id(std::string *permanent_id, std::string *update_id) const;
113
114 int pages() const;
115 page *create_page(const ustring &label) const;
116 page *create_page(int index) const;
117
118 std::vector<font_info> fonts() const;
119 font_iterator *create_font_iterator(int start_page = 0) const;
120
121 toc *create_toc() const;
122
123 bool has_embedded_files() const;
124 std::vector<embedded_file *> embedded_files() const;
125
126 // Named destinations are bytestrings, not string.
127 // So we use std::string instead of ustring.
128 std::map<std::string, destination> create_destination_map() const;
129
130 bool save(const std::string &file_name) const;
131 bool save_a_copy(const std::string &file_name) const;
132
133 static document *load_from_file(const std::string &file_name, const std::string &owner_password = std::string(), const std::string &user_password = std::string());
134 static document *load_from_data(byte_array *file_data, const std::string &owner_password = std::string(), const std::string &user_password = std::string());
135 static document *load_from_raw_data(const char *file_data, int file_data_length, const std::string &owner_password = std::string(), const std::string &user_password = std::string());
136
137private:
138 explicit document(document_private &dd);
139
140 document_private *d;
141 friend class document_private;
142};
143
144}
145
146#endif
The information about a destination used in a PDF document.
Definition poppler-destination.h:31
page_mode_enum
The various page modes available in a PDF document.
Definition poppler-document.h:43
@ use_none
The document specifies no particular page mode.
Definition poppler-document.h:44
@ use_outlines
The document specifies its TOC (table of contents) should be open.
Definition poppler-document.h:45
@ use_attach
The document specifies that should be open a view of its document-level attachments.
Definition poppler-document.h:49
@ fullscreen
The document specifies it wants to be open in a fullscreen mode.
Definition poppler-document.h:47
@ use_oc
The document specifies that should be open a view of its Optional Content (also known as layers).
Definition poppler-document.h:48
@ use_thumbs
The document specifies that should be open a view of the thumbnails of its pages.
Definition poppler-document.h:46
Represents a file embedded in a PDF document.
Definition poppler-embedded-file.h:33
A page in a PDF document.
Definition poppler-page.h:143
Represents the TOC (Table of Contents) of a PDF document.
Definition poppler-toc.h:33
Single namespace containing all the classes and functions of poppler-cpp.
Definition poppler-destination.h:27