Poppler Qt6 26.01.90
poppler-qt6.h
1/* poppler-qt.h: qt interface to poppler
2 * Copyright (C) 2005, Net Integration Technologies, Inc.
3 * Copyright (C) 2005, 2007, Brad Hards <bradh@frogmouth.net>
4 * Copyright (C) 2005-2015, 2017-2022, 2026, Albert Astals Cid <aacid@kde.org>
5 * Copyright (C) 2005, Stefan Kebekus <stefan.kebekus@math.uni-koeln.de>
6 * Copyright (C) 2006-2011, Pino Toscano <pino@kde.org>
7 * Copyright (C) 2009 Shawn Rutledge <shawn.t.rutledge@gmail.com>
8 * Copyright (C) 2010 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
9 * Copyright (C) 2010 Matthias Fauconneau <matthias.fauconneau@gmail.com>
10 * Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
11 * Copyright (C) 2011 Glad Deschrijver <glad.deschrijver@gmail.com>
12 * Copyright (C) 2012, Guillermo A. Amaral B. <gamaral@kde.org>
13 * Copyright (C) 2012, Fabio D'Urso <fabiodurso@hotmail.it>
14 * Copyright (C) 2012, Tobias Koenig <tobias.koenig@kdab.com>
15 * Copyright (C) 2012, 2014, 2015, 2018, 2019 Adam Reichold <adamreichold@myopera.com>
16 * Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
17 * Copyright (C) 2013 Anthony Granger <grangeranthony@gmail.com>
18 * Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com>
19 * Copyright (C) 2017, 2020, 2021 Oliver Sander <oliver.sander@tu-dresden.de>
20 * Copyright (C) 2017, 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich
21 * Copyright (C) 2018, 2021 Nelson Benítez León <nbenitezl@gmail.com>
22 * Copyright (C) 2019 Jan Grulich <jgrulich@redhat.com>
23 * Copyright (C) 2019 Alexander Volkov <a.volkov@rusbitech.ru>
24 * Copyright (C) 2020 Philipp Knechtges <philipp-dev@knechtges.com>
25 * Copyright (C) 2020 Katarina Behrens <Katarina.Behrens@cib.de>
26 * Copyright (C) 2020 Thorsten Behrens <Thorsten.Behrens@CIB.de>
27 * Copyright (C) 2020, 2024 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by Technische Universität Dresden
28 * Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>.
29 * Copyright (C) 2021 Mahmoud Khalil <mahmoudkhalil11@gmail.com>
30 * Copyright (C) 2021 Georgiy Sgibnev <georgiy@sgibnev.com>. Work sponsored by lab50.net.
31 * Copyright (C) 2022 Martin <martinbts@gmx.net>
32 * Copyright (C) 2023 Kevin Ottens <kevin.ottens@enioka.com>. Work sponsored by De Bortoli Wines
33 * Copyright (C) 2024 Pratham Gandhi <ppg.1382@gmail.com>
34 * Copyright (C) 2025 Stefan Brüns <stefan.bruens@rwth-aachen.de>
35 *
36 * This program is free software; you can redistribute it and/or modify
37 * it under the terms of the GNU General Public License as published by
38 * the Free Software Foundation; either version 2, or (at your option)
39 * any later version.
40 *
41 * This program is distributed in the hope that it will be useful,
42 * but WITHOUT ANY WARRANTY; without even the implied warranty of
43 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 * GNU General Public License for more details.
45 *
46 * You should have received a copy of the GNU General Public License
47 * along with this program; if not, write to the Free Software
48 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
49 */
50
51#ifndef __POPPLER_QT_H__
52#define __POPPLER_QT_H__
53
54#include <functional>
55#include <memory>
56#include <vector>
57
58#include "poppler-annotation.h"
59#include "poppler-link.h"
60#include "poppler-optcontent.h"
61#include "poppler-page-transition.h"
62#include "poppler-converter.h"
63
64#include <QtCore/QByteArray>
65#include <QtCore/QDateTime>
66#include <QtCore/QIODevice>
67#include <QtCore/QSet>
68#include "poppler-export.h"
69
70class EmbFile;
71class Sound;
72class AnnotMovie;
73
77namespace Poppler {
78
79class Document;
80class DocumentData;
81
82class PageData;
83
84class FormField;
86
87class TextBoxData;
88
89class PDFConverter;
90class PSConverter;
91
92struct OutlineItemData;
93
101using PopplerDebugFunc = void (*)(const QString & /*message*/, const QVariant & /*closure*/);
102
112POPPLER_QT6_EXPORT void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure);
113
123class POPPLER_QT6_EXPORT TextBox
124{
125 friend class Page;
126
127public:
133 TextBox(const QString &text, const QRectF &bBox);
138
142 QString text() const;
143
148 QRectF boundingBox() const;
149
156
160 QRectF charBoundingBox(int i) const;
161
165 bool hasSpaceAfter() const;
166
167private:
168 Q_DISABLE_COPY(TextBox)
169
170 TextBoxData *m_data;
171};
172
173class FontInfoData;
178class POPPLER_QT6_EXPORT FontInfo
179{
180 friend class Document;
181
182public:
186 enum Type
187 {
188 unknown,
189 Type1,
190 Type1C,
191 Type1COT,
192 Type3,
193 TrueType,
194 TrueTypeOT,
195 CIDType0,
196 CIDType0C,
197 CIDType0COT,
198 CIDTrueType,
199 CIDTrueTypeOT
200 };
201
203
206 FontInfo();
207
211 explicit FontInfo(const FontInfoData &fid);
213
217 FontInfo(const FontInfo &fi);
218
223
227 QString name() const;
228
232 QString substituteName() const;
233
238 QString file() const;
239
245 bool isEmbedded() const;
246
253 bool isSubset() const;
254
262 Type type() const;
263
272 QString typeName() const;
273
278
279private:
280 FontInfoData *m_data;
281};
282
283class FontIteratorData;
300class POPPLER_QT6_EXPORT FontIterator
301{
302 friend class Document;
303 friend class DocumentData;
304
305public:
310
315 QList<FontInfo> next();
316
321 bool hasNext() const;
322
326 int currentPage() const;
327
328private:
329 Q_DISABLE_COPY(FontIterator)
330 FontIterator(int, DocumentData *dd);
331
332 FontIteratorData *d;
333};
334
335class EmbeddedFileData;
339class POPPLER_QT6_EXPORT EmbeddedFile
340{
341 friend class DocumentData;
342 friend class AnnotationPrivate;
343
344public:
346 explicit EmbeddedFile(EmbFile *embfile);
348
353
357 QString name() const;
358
364 QString description() const;
365
371 int size() const;
372
376 QDateTime modDate() const;
377
381 QDateTime createDate() const;
382
388 QByteArray checksum() const;
389
393 QString mimeType() const;
394
398 QByteArray data();
399
403 bool isValid() const;
404
408 // QDataStream dataStream() const;
409
410private:
411 Q_DISABLE_COPY(EmbeddedFile)
412 explicit EmbeddedFile(EmbeddedFileData &dd);
413
414 EmbeddedFileData *m_embeddedFile;
415};
416
425class POPPLER_QT6_EXPORT Page
426{
427 friend class Document;
428
429public:
434
439 {
444 };
445
454
464
469 {
470 NoPainterFlags = 0x00000000,
479 };
480 Q_DECLARE_FLAGS(PainterFlags, PainterFlag)
481
482
518 QImage renderToImage(double xres = 72.0, double yres = 72.0, int x = -1, int y = -1, int w = -1, int h = -1, Rotation rotate = Rotate0) const;
519
527 using RenderToImagePartialUpdateFunc = void (*)(const QImage & /*image*/, const QVariant & /*closure*/);
528
535 using ShouldRenderToImagePartialQueryFunc = bool (*)(const QVariant & /*closure*/);
536
584 QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
585 const QVariant &payload) const;
586
592 using ShouldAbortQueryFunc = bool (*)(const QVariant & /*closure*/);
593
645 QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
646 ShouldAbortQueryFunc shouldAbortRenderCallback, const QVariant &payload) const;
647
688 bool renderToPainter(QPainter *painter, double xres = 72.0, double yres = 72.0, int x = -1, int y = -1, int w = -1, int h = -1, Rotation rotate = Rotate0, PainterFlags flags = NoPainterFlags) const;
689
696 QImage thumbnail() const;
697
709 QString text(const QRectF &rect, TextLayout textLayout) const;
710
719 QString text(const QRectF &rect) const;
720
730
739
744 {
745 NoSearchFlags = 0x00000000,
746 IgnoreCase = 0x00000001,
747 WholeWords = 0x00000002,
748 IgnoreDiacritics = 0x00000004,
751 AcrossLines = 0x00000008
754 };
755 Q_DECLARE_FLAGS(SearchFlags, SearchFlag)
756
757
767 bool search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
768
781 QList<QRectF> search(const QString &text, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
782
796 std::vector<std::unique_ptr<TextBox>> textList(Rotation rotate = Rotate0) const;
797
817 std::vector<std::unique_ptr<TextBox>> textList(Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const;
818
822 QSizeF pageSizeF() const;
823
827 QSize pageSize() const;
828
840
844 std::unique_ptr<Link> action(PageAction act) const;
845
856
861
865 void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown);
866
870 std::vector<std::unique_ptr<Link>> links() const;
871
878 std::vector<std::unique_ptr<Annotation>> annotations() const;
879
888 std::vector<std::unique_ptr<Annotation>> annotations(const QSet<Annotation::SubType> &subtypes) const;
889
896 void addAnnotation(const Annotation *ann);
897
903 void removeAnnotation(const Annotation *ann);
904
908 std::vector<std::unique_ptr<FormField>> formFields() const;
909
915 double duration() const;
916
920 QString label() const;
921
925 int index() const;
926
927private:
928 Q_DISABLE_COPY(Page)
929
930 Page(DocumentData *doc, int index);
931 PageData *m_page;
932};
933
939class POPPLER_QT6_EXPORT OutlineItem
940{
941 friend class Document;
942
943public:
948 ~OutlineItem();
949
950 OutlineItem(const OutlineItem &other);
951 OutlineItem &operator=(const OutlineItem &other);
952
953 OutlineItem(OutlineItem &&other) noexcept;
954 OutlineItem &operator=(OutlineItem &&other) noexcept;
955
959 bool isNull() const;
960
964 QString name() const;
965
969 bool isOpen() const;
970
976 QSharedPointer<const LinkDestination> destination() const;
977
983 QString externalFileName() const;
984
990 QString uri() const;
991
997 bool hasChildren() const;
998
1004 QVector<OutlineItem> children() const;
1005
1006private:
1007 explicit OutlineItem(OutlineItemData *data);
1008 OutlineItemData *m_data;
1009};
1010
1061class POPPLER_QT6_EXPORT Document
1062{
1063 friend class Page;
1064 friend class DocumentData;
1065
1066public:
1079
1093
1102
1107 {
1108 Antialiasing = 0x00000001,
1109 TextAntialiasing = 0x00000002,
1110 TextHinting = 0x00000004,
1111 TextSlightHinting = 0x00000008,
1112 OverprintPreview = 0x00000010,
1113 ThinLineSolid = 0x00000020,
1114 ThinLineShape = 0x00000040,
1115 IgnorePaperColor = 0x00000080,
1116 HideAnnotations = 0x00000100
1117 };
1118 Q_DECLARE_FLAGS(RenderHints, RenderHint)
1119
1120
1129
1140 void setColorDisplayProfile(void *outputProfileA);
1148 void setColorDisplayProfileName(const QString &name);
1157 void *colorRgbProfile() const;
1166 void *colorDisplayProfile() const;
1167
1182 static std::unique_ptr<Document> load(const QString &filePath, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1183
1201 static std::unique_ptr<Document> load(QIODevice *device, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1202
1219 static std::unique_ptr<Document> loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1220
1236 std::unique_ptr<Page> page(int index) const;
1237
1250 std::unique_ptr<Page> page(const QString &label) const;
1251
1255 int numPages() const;
1256
1263
1270
1275 Qt::LayoutDirection textDirection() const;
1276
1285 bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword);
1286
1290 bool isLocked() const;
1291
1307 QDateTime date(const QString &type) const;
1308
1314 bool setDate(const QString &key, const QDateTime &val);
1315
1319 QDateTime creationDate() const;
1320
1326 bool setCreationDate(const QDateTime &val);
1327
1331 QDateTime modificationDate() const;
1332
1338 bool setModificationDate(const QDateTime &val);
1339
1356 QString info(const QString &type) const;
1357
1363 bool setInfo(const QString &key, const QString &val);
1364
1368 QString title() const;
1369
1375 bool setTitle(const QString &val);
1376
1380 QString author() const;
1381
1387 bool setAuthor(const QString &val);
1388
1392 QString subject() const;
1393
1399 bool setSubject(const QString &val);
1400
1404 QString keywords() const;
1405
1411 bool setKeywords(const QString &val);
1412
1416 QString creator() const;
1417
1423 bool setCreator(const QString &val);
1424
1428 QString producer() const;
1429
1435 bool setProducer(const QString &val);
1436
1443
1447 QStringList infoKeys() const;
1448
1452 bool isEncrypted() const;
1453
1460 bool isLinearized() const;
1461
1466 bool okToPrint() const;
1467
1472 bool okToPrintHighRes() const;
1473
1481 bool okToChange() const;
1482
1487 bool okToCopy() const;
1488
1494 bool okToAddNotes() const;
1495
1503 bool okToFillForm() const;
1504
1511
1518
1526 bool okToAssemble() const;
1527
1530 {
1531 int major;
1532 int minor;
1533 };
1534
1542
1554 QList<FontInfo> fonts() const;
1555
1566 std::unique_ptr<FontIterator> newFontIterator(int startPage = 0) const;
1567
1571 QByteArray fontData(const FontInfo &fi) const;
1572
1581 QList<EmbeddedFile *> embeddedFiles() const;
1582
1586 bool hasEmbeddedFiles() const;
1587
1593 QVector<OutlineItem> outline() const;
1594
1603 std::unique_ptr<LinkDestination> linkDestination(const QString &name);
1604
1610 void setPaperColor(const QColor &color);
1616 QColor paperColor() const;
1617
1630
1634 static QSet<RenderBackend> availableRenderBackends();
1635
1643 void setRenderHint(RenderHint hint, bool on = true);
1647 RenderHints renderHints() const;
1648
1652 std::unique_ptr<PSConverter> psConverter() const;
1653
1657 std::unique_ptr<PDFConverter> pdfConverter() const;
1658
1662 QString metadata() const;
1663
1675
1682
1689
1696 QStringList scripts() const;
1697
1714
1721 std::unique_ptr<Link> additionalAction(DocumentAdditionalActionsType type) const;
1722
1733 bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const;
1734
1739
1743 QVector<int> formCalculateOrder() const;
1744
1751 std::vector<std::unique_ptr<FormFieldSignature>> signatures() const;
1752
1759
1766 void setXRefReconstructedCallback(const std::function<void()> &callback);
1767
1772
1773private:
1774 Q_DISABLE_COPY(Document)
1775
1776 DocumentData *m_doc;
1777
1778 explicit Document(DocumentData *dataA);
1779};
1780
1784POPPLER_QT6_EXPORT QDateTime convertDate(const char *dateString);
1785
1789POPPLER_QT6_EXPORT bool isCmsAvailable();
1790
1794POPPLER_QT6_EXPORT bool isOverprintPreviewAvailable();
1795
1796class SoundData;
1804class POPPLER_QT6_EXPORT SoundObject
1805{
1806public:
1815
1826
1830 explicit SoundObject(Sound *popplersound);
1832
1833 ~SoundObject();
1834
1839
1843 QString url() const;
1844
1848 QByteArray data() const;
1849
1853 double samplingRate() const;
1854
1858 int channels() const;
1859
1863 int bitsPerSample() const;
1864
1869
1870private:
1871 Q_DISABLE_COPY(SoundObject)
1872
1873 SoundData *m_soundData;
1874};
1875
1876class MovieData;
1880class POPPLER_QT6_EXPORT MovieObject
1881{
1882 friend class AnnotationPrivate;
1883
1884public:
1895
1896 ~MovieObject();
1897
1901 QString url() const;
1902
1906 QSize size() const;
1907
1911 int rotation() const;
1912
1916 bool showControls() const;
1917
1922
1926 bool showPosterImage() const;
1927
1933 QImage posterImage() const;
1934
1935private:
1937 explicit MovieObject(AnnotMovie *ann);
1939
1940 Q_DISABLE_COPY(MovieObject)
1941
1942 MovieData *m_movieData;
1943};
1944
1945}
1946
1947Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::PainterFlags)
1948Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::SearchFlags)
1949Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints)
1950
1951#endif
Annotation class holding properties shared by all annotations.
Definition poppler-annotation.h:178
PDF document.
Definition poppler-qt6.h:1062
QString subject() const
The subject of the document.
RenderHints renderHints() const
The currently set render hints.
bool isLinearized() const
Test if the document is linearised.
bool setAuthor(const QString &val)
Set the author of the document to.
static std::unique_ptr< Document > load(const QString &filePath, const QByteArray &ownerPassword=QByteArray(), const QByteArray &userPassword=QByteArray())
Load the document from a file on disk.
bool setTitle(const QString &val)
Set the title of the document to.
bool okToChange() const
Test if the permissions on the document allow it to be changed.
QString title() const
The title of the document.
std::unique_ptr< FontIterator > newFontIterator(int startPage=0) const
Creates a new FontIterator object for font scanning.
bool okToCreateFormFields() const
Test if the permissions on the document allow interactive form fields (including signature fields) to...
bool isLocked() const
Determine if the document is locked.
std::unique_ptr< PDFConverter > pdfConverter() const
Gets a new PDF converter for this document.
bool okToCopy() const
Test if the permissions on the document allow the contents to be copied / extracted.
QVector< OutlineItem > outline() const
Gets the outline of the document.
bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const
The PDF identifiers.
int numPages() const
The number of pages in the document.
bool removeInfo()
Remove the document's Info dictionary.
PageLayout
The page layout.
Definition poppler-qt6.h:1084
@ TwoPageRight
Display the pages two at a time, with odd-numbered pages on the right.
Definition poppler-qt6.h:1091
@ TwoPageLeft
Display the pages two at a time, with odd-numbered pages on the left.
Definition poppler-qt6.h:1090
@ TwoColumnLeft
Display the pages in two columns, with odd-numbered pages on the left.
Definition poppler-qt6.h:1088
@ SinglePage
Display a single page.
Definition poppler-qt6.h:1086
@ NoLayout
Layout not specified.
Definition poppler-qt6.h:1085
@ TwoColumnRight
Display the pages in two columns, with odd-numbered pages on the right.
Definition poppler-qt6.h:1089
@ OneColumn
Display a single column of pages.
Definition poppler-qt6.h:1087
std::unique_ptr< LinkDestination > linkDestination(const QString &name)
Tries to resolve the named destination name.
bool hasOptionalContent() const
Test whether this document has "optional content".
QDateTime date(const QString &type) const
The date associated with the document.
bool okToAddNotes() const
Test if the permissions on the document allow annotations to be added or modified,...
QDateTime creationDate() const
The date of the creation of the document.
static std::unique_ptr< Document > load(QIODevice *device, const QByteArray &ownerPassword=QByteArray(), const QByteArray &userPassword=QByteArray())
Load the document from a device.
bool setCreator(const QString &val)
Set the creator of the document to.
void setRenderHint(RenderHint hint, bool on=true)
Sets the render hint .
bool setProducer(const QString &val)
Set the producer of the document to.
QStringList infoKeys() const
Obtain a list of the available string information keys.
void * colorDisplayProfile() const
Return the current display profile.
void setPaperColor(const QColor &color)
Sets the paper color.
RenderBackend
The render backends available.
Definition poppler-qt6.h:1098
@ SplashBackend
Splash backend.
Definition poppler-qt6.h:1099
@ QPainterBackend
Qt backend.
Definition poppler-qt6.h:1100
std::unique_ptr< PSConverter > psConverter() const
Gets a new PS converter for this document.
bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword)
Provide the passwords required to unlock the document.
QByteArray fontData(const FontInfo &fi) const
The font data if the font is an embedded one.
std::unique_ptr< Page > page(int index) const
Get a specified Page.
bool setDate(const QString &key, const QDateTime &val)
Set the Info dict date entry specified by.
PageMode
The page mode.
Definition poppler-qt6.h:1071
@ UseOutlines
Document outline visible.
Definition poppler-qt6.h:1073
@ UseAttach
Attachments panel visible.
Definition poppler-qt6.h:1077
@ UseNone
No mode - neither document outline nor thumbnail images are visible.
Definition poppler-qt6.h:1072
@ UseThumbs
Thumbnail images visible.
Definition poppler-qt6.h:1074
@ FullScreen
Fullscreen mode (no menubar, windows controls etc).
Definition poppler-qt6.h:1075
@ UseOC
Optional content group panel visible.
Definition poppler-qt6.h:1076
PdfVersion getPdfVersion() const
The version of the PDF specification that the document conforms to.
QDateTime modificationDate() const
The date of the last change in the document.
void setRenderBackend(RenderBackend backend)
Sets the backend used to render the pages.
std::unique_ptr< Page > page(const QString &label) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RenderHint
The render hints available.
Definition poppler-qt6.h:1107
@ IgnorePaperColor
Do not compose with the paper color.
Definition poppler-qt6.h:1115
@ TextHinting
Hinting for text.
Definition poppler-qt6.h:1110
@ ThinLineShape
Enhance thin lines shape. Wins over ThinLineSolid.
Definition poppler-qt6.h:1114
@ HideAnnotations
Do not render annotations.
Definition poppler-qt6.h:1116
@ TextSlightHinting
Lighter hinting for text when combined with TextHinting.
Definition poppler-qt6.h:1111
@ OverprintPreview
Overprint preview.
Definition poppler-qt6.h:1112
@ TextAntialiasing
Antialiasing for text.
Definition poppler-qt6.h:1109
@ Antialiasing
Antialiasing for graphics.
Definition poppler-qt6.h:1108
@ ThinLineSolid
Enhance thin lines solid.
Definition poppler-qt6.h:1113
Qt::LayoutDirection textDirection() const
The predominant reading order for text as supplied by the document's viewer preferences.
QString metadata() const
Gets the metadata stream contents.
DocumentAdditionalActionsType
Describes the flags for additional document actions i.e.
Definition poppler-qt6.h:1707
@ CloseDocument
Performed before closing the document.
Definition poppler-qt6.h:1708
@ PrintDocumentStart
Performed before printing the document.
Definition poppler-qt6.h:1711
@ PrintDocumentFinish
Performed after printing the document.
Definition poppler-qt6.h:1712
@ SaveDocumentFinish
Performed after saving the document.
Definition poppler-qt6.h:1710
@ SaveDocumentStart
Performed before saving the document.
Definition poppler-qt6.h:1709
void setColorDisplayProfile(void *outputProfileA)
Set a color display profile for the current document.
bool okToPrintHighRes() const
Test if the permissions on the document allow it to be printed at high resolution.
bool okToExtractForAccessibility() const
Test if the permissions on the document allow content extraction (text and perhaps other content) for...
bool setModificationDate(const QDateTime &val)
Set the modification date of the document to.
void * colorRgbProfile() const
Return the current RGB profile.
QString author() const
The author of the document.
bool isEncrypted() const
Test if the document is encrypted.
void setColorDisplayProfileName(const QString &name)
Set a color display profile for the current document.
static QSet< RenderBackend > availableRenderBackends()
The available rendering backends.
void applyResetFormsLink(const LinkResetForm &link)
Resets the form with the details contained in the link.
QList< EmbeddedFile * > embeddedFiles() const
The documents embedded within the PDF document.
bool okToAssemble() const
Test if the permissions on the document allow it to be "assembled" - insertion, rotation and deletion...
OptContentModel * optionalContentModel()
Itemviews model for optional content.
~Document()
Destructor.
QString creator() const
The creator of the document.
bool hasEmbeddedFiles() const
Whether there are any documents embedded in this PDF document.
QString producer() const
The producer of the document.
std::vector< std::unique_ptr< FormFieldSignature > > signatures() const
Returns the signatures of this document.
PageLayout pageLayout() const
The layout that pages should be shown in when the document is first opened.
void setXRefReconstructedCallback(const std::function< void()> &callback)
Sets the document's XRef reconstruction callback, so whenever a XRef table reconstruction happens the...
bool setSubject(const QString &val)
Set the subject of the document to.
PageMode pageMode() const
The type of mode that should be used by the application when the document is opened.
FormType
Form types.
Definition poppler-qt6.h:1124
@ AcroForm
AcroForm.
Definition poppler-qt6.h:1126
@ XfaForm
Adobe XML Forms Architecture (XFA), currently unsupported.
Definition poppler-qt6.h:1127
@ NoForm
Document doesn't contain forms.
Definition poppler-qt6.h:1125
bool setCreationDate(const QDateTime &val)
Set the creation date of the document to.
FormType formType() const
Returns the type of forms contained in the document.
QList< FontInfo > fonts() const
The fonts within the PDF document.
bool xrefWasReconstructed() const
Returns whether the document's XRef table has been reconstructed or not.
QColor paperColor() const
The paper color.
QString keywords() const
The keywords of the document.
bool okToPrint() const
Test if the permissions on the document allow it to be printed.
static std::unique_ptr< Document > loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword=QByteArray(), const QByteArray &userPassword=QByteArray())
Load the document from memory.
RenderBackend renderBackend() const
The currently set render backend.
QVector< int > formCalculateOrder() const
Returns the calculate order for forms (using their id).
bool setKeywords(const QString &val)
Set the keywords of the document to.
std::unique_ptr< Link > additionalAction(DocumentAdditionalActionsType type) const
Returns the additional action of the given type for the document or 0 if no action has been defined.
QStringList scripts() const
Document-level JavaScript scripts.
QString info(const QString &type) const
Get specified information associated with the document.
bool setInfo(const QString &key, const QString &val)
Set the value of the document's Info dictionary entry specified by.
bool okToFillForm() const
Test if the permissions on the document allow interactive form fields (including signature fields) to...
bool isValid() const
Is the embedded file valid?
QString description() const
The description associated with the file, if any.
~EmbeddedFile()
Destructor.
QByteArray checksum() const
The MD5 checksum of the file.
QString name() const
The name associated with the file.
QString mimeType() const
The MIME type of the file, if known.
QDateTime createDate() const
The creation date for the embedded file, if known.
QDateTime modDate() const
The modification date for the embedded file, if known.
int size() const
The size of the file.
QByteArray data()
The data as a byte array.
Container class for information about a font within a PDF document.
Definition poppler-qt6.h:179
Type type() const
The type of font encoding.
FontInfo & operator=(const FontInfo &fi)
Standard assignment operator.
QString name() const
The name of the font.
QString typeName() const
The name of the font encoding used.
QString file() const
The path of the font file used to represent this font on this system, or a null string is the font is...
FontInfo(const FontInfo &fi)
Copy constructor.
Type
The type of font.
Definition poppler-qt6.h:187
QString substituteName() const
The name of the substitute font.
bool isSubset() const
Whether the font provided is only a subset of the full font or not.
~FontInfo()
Destructor.
bool isEmbedded() const
Whether the font is embedded in the file, or not.
int currentPage() const
Returns the current page where the iterator is.
~FontIterator()
Destructor.
bool hasNext() const
Checks whether there is at least one more page to iterate, ie returns false when the iterator is beyo...
QList< FontInfo > next()
Returns the fonts of the current page and then advances the iterator to the next page.
A form field that represents a signature.
Definition poppler-form.h:808
The base class representing a form field.
Definition poppler-form.h:90
ResetForm: an action to reset form fields.
Definition poppler-link.h:682
Container class for a movie object in a PDF document.
Definition poppler-qt6.h:1881
QString url() const
The URL of the movie to be played.
bool showControls() const
Whether show a bar with movie controls.
int rotation() const
The rotation (either 0, 90, 180, or 270 degrees clockwise) for the movie,.
bool showPosterImage() const
Returns whether a poster image should be shown if the movie is not playing.
QSize size() const
The size of the movie.
QImage posterImage() const
Returns the poster image that should be shown if the movie is not playing.
PlayMode
The play mode for playing the movie.
Definition poppler-qt6.h:1889
@ PlayPalindrome
Play forward, then backward, then again foward and so on until stopped.
Definition poppler-qt6.h:1893
@ PlayRepeat
Play continuously until stopped.
Definition poppler-qt6.h:1892
@ PlayOnce
Play the movie once, closing the movie controls at the end.
Definition poppler-qt6.h:1890
@ PlayOpen
Like PlayOnce, but leaving the controls open.
Definition poppler-qt6.h:1891
PlayMode playMode() const
How to play the movie.
Model for optional content.
Definition poppler-optcontent.h:48
QString uri() const
The URI to which the item links.
QString name() const
The name of the item which should be displayed to the user.
QVector< OutlineItem > children() const
Gets the child items of this item.
QSharedPointer< const LinkDestination > destination() const
The destination referred to by this item.
bool isOpen() const
Indicates whether the item should initially be display in an expanded or collapsed state.
OutlineItem()
Constructs a null item, i.e.
bool isNull() const
Indicates whether an item is null, i.e.
QString externalFileName() const
The external file name of the document to which the.
bool hasChildren() const
Determines if this item has any child items.
Describes how a PDF file viewer shall perform the transition from one page to another.
Definition poppler-page-transition.h:48
void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown)
The default CTM.
bool(*)(const QVariant &) ShouldRenderToImagePartialQueryFunc
Partial Update query renderToImage callback.
Definition poppler-qt6.h:535
Orientation
Types of orientations that are possible.
Definition poppler-qt6.h:850
@ UpsideDown
Upside down orientation (portrait, with 180 degrees rotation).
Definition poppler-qt6.h:854
@ Seascape
Seascape orientation (portrait, with 270 degrees clockwise rotation).
Definition poppler-qt6.h:853
@ Landscape
Landscape orientation (portrait, with 90 degrees clockwise rotation ).
Definition poppler-qt6.h:851
@ Portrait
Normal portrait orientation.
Definition poppler-qt6.h:852
SearchFlag
Flags to modify the search behaviour.
Definition poppler-qt6.h:744
@ IgnoreCase
Case differences are ignored.
Definition poppler-qt6.h:746
@ WholeWords
Only whole words are matched.
Definition poppler-qt6.h:747
@ AcrossLines
Allows to match on text spanning from end of a line to the next line.
Definition poppler-qt6.h:751
@ IgnoreDiacritics
Diacritic differences (eg.
Definition poppler-qt6.h:748
bool search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags=NoSearchFlags, Rotation rotate=Rotate0) const
Returns true if the specified text was found.
std::vector< std::unique_ptr< FormField > > formFields() const
Returns the form fields on the page.
std::vector< std::unique_ptr< Annotation > > annotations() const
Returns the annotations of the page.
void addAnnotation(const Annotation *ann)
Adds an annotation to the page.
QString text(const QRectF &rect, TextLayout textLayout) const
Returns the text that is inside a specified rectangle.
std::vector< std::unique_ptr< Link > > links() const
Gets the links of the page.
QSizeF pageSizeF() const
std::unique_ptr< Link > action(PageAction act) const
Gets the page action specified, or empty unique pointer if there is no action.
PageTransition * transition() const
Returns the transition of this page.
int index() const
Returns the index of the page.
SearchDirection
The starting point for a search.
Definition poppler-qt6.h:725
@ PreviousResult
Find the previous result, moving "up the page".
Definition poppler-qt6.h:728
@ FromTop
Start sorting at the top of the document.
Definition poppler-qt6.h:726
@ NextResult
Find the next result, moving "down the page".
Definition poppler-qt6.h:727
PainterFlag
Additional flags for the renderToPainter method.
Definition poppler-qt6.h:469
@ DontSaveAndRestore
Do not save/restore the caller-owned painter.
Definition poppler-qt6.h:478
QImage thumbnail() const
Get the page thumbnail if it exists.
Rotation
The type of rotation to apply for an operation.
Definition poppler-qt6.h:439
@ Rotate270
Rotate 270 degrees clockwise (90 degrees counterclockwise).
Definition poppler-qt6.h:443
@ Rotate90
Rotate 90 degrees clockwise.
Definition poppler-qt6.h:441
@ Rotate0
Do not rotate.
Definition poppler-qt6.h:440
@ Rotate180
Rotate 180 degrees.
Definition poppler-qt6.h:442
~Page()
Destructor.
Orientation orientation() const
The orientation of the page.
SearchMode
The type of search to perform.
Definition poppler-qt6.h:735
@ CaseSensitive
Case differences cause no match in searching.
Definition poppler-qt6.h:736
@ CaseInsensitive
Case differences are ignored in matching.
Definition poppler-qt6.h:737
std::vector< std::unique_ptr< TextBox > > textList(Rotation rotate=Rotate0) const
Returns a list of text of the page.
std::vector< std::unique_ptr< Annotation > > annotations(const QSet< Annotation::SubType > &subtypes) const
Returns the annotations of the page.
TextLayout
How the text is going to be returned.
Definition poppler-qt6.h:459
@ ReadingOrder
The text is returned in reading order,.
Definition poppler-qt6.h:462
@ RawOrderLayout
The text is returned without any type of processing.
Definition poppler-qt6.h:461
@ PhysicalLayout
The text is layouted to resemble the real page layout.
Definition poppler-qt6.h:460
PageAction
The kinds of page actions.
Definition poppler-qt6.h:450
@ Closing
The action when a page is "closed".
Definition poppler-qt6.h:452
@ Opening
The action when a page is "opened".
Definition poppler-qt6.h:451
QSize pageSize() const
double duration() const
Returns the page duration.
void(*)(const QImage &, const QVariant &) RenderToImagePartialUpdateFunc
Partial Update renderToImage callback.
Definition poppler-qt6.h:527
QString label() const
Returns the label of the page, or a null string is the page has no label.
QImage renderToImage(double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1, Rotation rotate=Rotate0) const
Render the page to a QImage using the current Document renderer.
bool renderToPainter(QPainter *painter, double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1, Rotation rotate=Rotate0, PainterFlags flags=NoPainterFlags) const
Render the page to the specified QPainter using the current Document renderer.
void removeAnnotation(const Annotation *ann)
Removes an annotation from the page and destroys the annotation object.
bool(*)(const QVariant &) ShouldAbortQueryFunc
Abort query function callback.
Definition poppler-qt6.h:592
Container class for a sound file in a PDF document.
Definition poppler-qt6.h:1805
double samplingRate() const
The sampling rate of the sound.
SoundEncoding soundEncoding() const
The encoding used for the sound.
int channels() const
The number of sound channels to use to play the sound.
SoundType soundType() const
Is the sound embedded (SoundObject::Embedded) or external (SoundObject::External)?
QString url() const
The URL of the sound file to be played, in case of SoundObject::External.
SoundEncoding
The encoding format used for the sound.
Definition poppler-qt6.h:1820
@ ALaw
A-law-encoded samples.
Definition poppler-qt6.h:1824
@ muLaw
mu-law-encoded samples
Definition poppler-qt6.h:1823
@ Signed
Twos-complement values.
Definition poppler-qt6.h:1822
@ Raw
Raw encoding, with unspecified or unsigned values in the range [ 0, 2^B - 1 ].
Definition poppler-qt6.h:1821
SoundType
The type of sound.
Definition poppler-qt6.h:1811
@ External
The real sound file is external.
Definition poppler-qt6.h:1812
@ Embedded
The sound is contained in the data.
Definition poppler-qt6.h:1813
int bitsPerSample() const
The number of bits per sample value per channel.
QByteArray data() const
The data of the sound, in case of SoundObject::Embedded.
Describes the physical location of text on a document page.
Definition poppler-qt6.h:124
bool hasSpaceAfter() const
Returns whether there is a space character after this text box.
TextBox(const QString &text, const QRectF &bBox)
The default constructor sets the text and the rectangle that contains the text.
QString text() const
Returns the text of this text box.
~TextBox()
Destructor.
QRectF charBoundingBox(int i) const
Returns the bounding box of the i -th characted of the word.
TextBox * nextWord() const
Returns the pointer to the next text box, if there is one.
QRectF boundingBox() const
Returns the position of the text, in point, i.e., 1/72 of an inch.
The Poppler Qt6 binding.
Definition poppler-annotation.h:52
QDateTime convertDate(const char *dateString)
Conversion from PDF date string format to QDateTime.
void(*)(const QString &, const QVariant &) PopplerDebugFunc
Debug/error function.
Definition poppler-qt6.h:101
bool isOverprintPreviewAvailable()
Whether the overprint preview functionality is available.
bool isCmsAvailable()
Whether the color management functions are available.
void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure)
Set a new debug/error output function.
The version specification of a pdf file.
Definition poppler-qt6.h:1530