Poppler CPP 24.05.0
poppler-page.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009-2010, Pino Toscano <pino@kde.org>
3 * Copyright (C) 2018, 2020, Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
4 * Copyright (C) 2018-2022, Albert Astals Cid <aacid@kde.org>
5 * Copyright (C) 2018, Zsombor Hollay-Horvath <hollay.horvath@gmail.com>
6 * Copyright (C) 2018, Aleksey Nikolaev <nae202@gmail.com>
7 * Copyright (C) 2020, Jiri Jakes <freedesktop@jirijakes.eu>
8 * Copyright (C) 2020, Adam Reichold <adam.reichold@t-online.de>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
13 * any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
23 */
24
25#ifndef POPPLER_PAGE_H
26#define POPPLER_PAGE_H
27
28#include "poppler-global.h"
29#include "poppler-rectangle.h"
30
31#include <memory>
32
33namespace poppler {
34
35struct text_box_data;
36class POPPLER_CPP_EXPORT text_box
37{
38 friend class page;
39
40public:
41 text_box(text_box &&) noexcept;
42 text_box &operator=(text_box &&) noexcept;
43
44 ~text_box();
45
46 ustring text() const;
47 rectf bbox() const;
48
52 int rotation() const;
53
67 rectf char_bbox(size_t i) const;
68 bool has_space_after() const;
69
73 bool has_font_info() const;
74
86 {
87 invalid_wmode = -1,
88 horizontal_wmode = 0,
89 vertical_wmode = 1
90 };
91
95 writing_mode_enum get_wmode(int i = 0) const;
96
107 double get_font_size() const;
108
129 std::string get_font_name(int i = 0) const;
130
131private:
132 explicit text_box(text_box_data *data);
133
134 std::unique_ptr<text_box_data> m_data;
135};
136
137class document;
138class document_private;
139class page_private;
140class page_transition;
141
142class POPPLER_CPP_EXPORT page : public poppler::noncopyable
143{
144public:
146 {
147 landscape,
148 portrait,
149 seascape,
150 upside_down
151 };
153 {
154 search_from_top,
155 search_next_result,
156 search_previous_result
157 };
159 {
160 physical_layout,
161 raw_order_layout,
162 non_raw_non_physical_layout
163 };
164
165 ~page();
166
167 orientation_enum orientation() const;
168 double duration() const;
169 rectf page_rect(page_box_enum box = crop_box) const;
170 ustring label() const;
171
172 page_transition *transition() const;
173
174 bool search(const ustring &text, rectf &r, search_direction_enum direction, case_sensitivity_enum case_sensitivity, rotation_enum rotation = rotate_0) const;
175 ustring text(const rectf &r = rectf()) const;
176 ustring text(const rectf &r, text_layout_enum layout_mode) const;
177
196 std::vector<text_box> text_list() const;
197
198 /*
199 * text_list_option_enum is a bitmask-style flags for text_list(),
200 * 0 means the default & simplest behaviour.
201 */
202 enum text_list_option_enum
203 {
204 text_list_include_font = 1 // \since 0.89
205 };
206
213 std::vector<text_box> text_list(int opt_flag) const;
214
215private:
216 page(document_private *doc, int index);
217
218 page_private *d;
219 friend class page_private;
220 friend class document;
221};
222
223}
224
225#endif
A transition between two pages in a PDF document.
Definition poppler-page-transition.h:33
A page in a PDF document.
Definition poppler-page.h:143
text_layout_enum
A layout of the text of a page.
Definition poppler-page.h:159
search_direction_enum
The direction/action to follow when performing a text search.
Definition poppler-page.h:153
orientation_enum
The possible orientation of a page.
Definition poppler-page.h:146
A rectangle.
Definition poppler-rectangle.h:28
Definition poppler-page.h:37
writing_mode_enum
Get a writing mode for the i-th glyph.
Definition poppler-page.h:86
Definition poppler-global.h:103
Single namespace containing all the classes and functions of poppler-cpp.
Definition poppler-destination.h:27
page_box_enum
A possible box of a page in a PDF document.
Definition poppler-global.h:67
case_sensitivity_enum
The case sensitivity.
Definition poppler-global.h:88
rotation_enum
The case sensitivity.
Definition poppler-global.h:59