Poppler Qt6 22.11.0
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, 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 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 *
33 * This program is free software; you can redistribute it and/or modify
34 * it under the terms of the GNU General Public License as published by
35 * the Free Software Foundation; either version 2, or (at your option)
36 * any later version.
37 *
38 * This program is distributed in the hope that it will be useful,
39 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41 * GNU General Public License for more details.
42 *
43 * You should have received a copy of the GNU General Public License
44 * along with this program; if not, write to the Free Software
45 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
46 */
47
48#ifndef __POPPLER_QT_H__
49#define __POPPLER_QT_H__
50
51#include <functional>
52#include <memory>
53#include <vector>
54
55#include "poppler-annotation.h"
56#include "poppler-link.h"
57#include "poppler-optcontent.h"
58#include "poppler-page-transition.h"
59
60#include <QtCore/QByteArray>
61#include <QtCore/QDateTime>
62#include <QtCore/QIODevice>
63#include <QtCore/QSet>
64#include "poppler-export.h"
65
66class EmbFile;
67class Sound;
68class AnnotMovie;
69
73namespace Poppler {
74
75class Document;
76class DocumentData;
77
78class PageData;
79
80class FormField;
81class FormFieldSignature;
82
83class TextBoxData;
84
85class PDFConverter;
86class PSConverter;
87
88struct OutlineItemData;
89
97using PopplerDebugFunc = void (*)(const QString & /*message*/, const QVariant & /*closure*/);
98
108POPPLER_QT6_EXPORT void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure);
109
119class POPPLER_QT6_EXPORT TextBox
120{
121 friend class Page;
122
123public:
129 TextBox(const QString &text, const QRectF &bBox);
134
138 QString text() const;
139
144 QRectF boundingBox() const;
145
152
156 QRectF charBoundingBox(int i) const;
157
161 bool hasSpaceAfter() const;
162
163private:
164 Q_DISABLE_COPY(TextBox)
165
166 TextBoxData *m_data;
167};
168
169class FontInfoData;
174class POPPLER_QT6_EXPORT FontInfo
175{
176 friend class Document;
177
178public:
182 enum Type
183 {
184 unknown,
185 Type1,
186 Type1C,
187 Type1COT,
188 Type3,
189 TrueType,
190 TrueTypeOT,
191 CIDType0,
192 CIDType0C,
193 CIDType0COT,
194 CIDTrueType,
195 CIDTrueTypeOT
196 };
197
199
202 FontInfo();
203
207 explicit FontInfo(const FontInfoData &fid);
209
213 FontInfo(const FontInfo &fi);
214
219
223 QString name() const;
224
228 QString substituteName() const;
229
234 QString file() const;
235
241 bool isEmbedded() const;
242
249 bool isSubset() const;
250
258 Type type() const;
259
268 QString typeName() const;
269
274
275private:
276 FontInfoData *m_data;
277};
278
279class FontIteratorData;
296class POPPLER_QT6_EXPORT FontIterator
297{
298 friend class Document;
299 friend class DocumentData;
300
301public:
306
311 QList<FontInfo> next();
312
317 bool hasNext() const;
318
322 int currentPage() const;
323
324private:
325 Q_DISABLE_COPY(FontIterator)
326 FontIterator(int, DocumentData *dd);
327
328 FontIteratorData *d;
329};
330
331class EmbeddedFileData;
335class POPPLER_QT6_EXPORT EmbeddedFile
336{
337 friend class DocumentData;
338 friend class AnnotationPrivate;
339
340public:
342 explicit EmbeddedFile(EmbFile *embfile);
344
349
353 QString name() const;
354
360 QString description() const;
361
367 int size() const;
368
372 QDateTime modDate() const;
373
377 QDateTime createDate() const;
378
384 QByteArray checksum() const;
385
389 QString mimeType() const;
390
394 QByteArray data();
395
399 bool isValid() const;
400
404 // QDataStream dataStream() const;
405
406private:
407 Q_DISABLE_COPY(EmbeddedFile)
408 explicit EmbeddedFile(EmbeddedFileData &dd);
409
410 EmbeddedFileData *m_embeddedFile;
411};
412
421class POPPLER_QT6_EXPORT Page
422{
423 friend class Document;
424
425public:
430
435 {
436 Rotate0 = 0,
437 Rotate90 = 1,
438 Rotate180 = 2,
439 Rotate270 = 3
440 };
441
446 {
448 Closing
449 };
450
455 {
457 RawOrderLayout
458 };
459
464 {
465 NoPainterFlags = 0x00000000,
473 DontSaveAndRestore = 0x00000001
474 };
475 Q_DECLARE_FLAGS(PainterFlags, PainterFlag)
476
477
513 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;
514
522 using RenderToImagePartialUpdateFunc = void (*)(const QImage & /*image*/, const QVariant & /*closure*/);
523
530 using ShouldRenderToImagePartialQueryFunc = bool (*)(const QVariant & /*closure*/);
531
579 QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
580 const QVariant &payload) const;
581
587 using ShouldAbortQueryFunc = bool (*)(const QVariant & /*closure*/);
588
640 QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
641 ShouldAbortQueryFunc shouldAbortRenderCallback, const QVariant &payload) const;
642
683 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;
684
691 QImage thumbnail() const;
692
700 QString text(const QRectF &rect, TextLayout textLayout) const;
701
710 QString text(const QRectF &rect) const;
711
716 {
719 PreviousResult
720 };
721
726 {
728 CaseInsensitive
729 };
730
735 {
736 NoSearchFlags = 0x00000000,
737 IgnoreCase = 0x00000001,
738 WholeWords = 0x00000002,
739 IgnoreDiacritics = 0x00000004,
742 AcrossLines = 0x00000008
745 };
746 Q_DECLARE_FLAGS(SearchFlags, SearchFlag)
747
748
758 bool search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
759
772 QList<QRectF> search(const QString &text, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
773
787 std::vector<std::unique_ptr<TextBox>> textList(Rotation rotate = Rotate0) const;
788
808 std::vector<std::unique_ptr<TextBox>> textList(Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const;
809
813 QSizeF pageSizeF() const;
814
818 QSize pageSize() const;
819
830 PageTransition *transition() const;
831
835 std::unique_ptr<Link> action(PageAction act) const;
836
841 {
845 UpsideDown
846 };
847
852
856 void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown);
857
861 std::vector<std::unique_ptr<Link>> links() const;
862
869 std::vector<std::unique_ptr<Annotation>> annotations() const;
870
879 std::vector<std::unique_ptr<Annotation>> annotations(const QSet<Annotation::SubType> &subtypes) const;
880
887 void addAnnotation(const Annotation *ann);
888
894 void removeAnnotation(const Annotation *ann);
895
899 std::vector<std::unique_ptr<FormField>> formFields() const;
900
906 double duration() const;
907
911 QString label() const;
912
916 int index() const;
917
918private:
919 Q_DISABLE_COPY(Page)
920
921 Page(DocumentData *doc, int index);
922 PageData *m_page;
923};
924
930class POPPLER_QT6_EXPORT OutlineItem
931{
932 friend class Document;
933
934public:
939 ~OutlineItem();
940
941 OutlineItem(const OutlineItem &other);
942 OutlineItem &operator=(const OutlineItem &other);
943
944 OutlineItem(OutlineItem &&other) noexcept;
945 OutlineItem &operator=(OutlineItem &&other) noexcept;
946
950 bool isNull() const;
951
955 QString name() const;
956
960 bool isOpen() const;
961
967 QSharedPointer<const LinkDestination> destination() const;
968
974 QString externalFileName() const;
975
981 QString uri() const;
982
988 bool hasChildren() const;
989
995 QVector<OutlineItem> children() const;
996
997private:
998 explicit OutlineItem(OutlineItemData *data);
999 OutlineItemData *m_data;
1000};
1001
1052class POPPLER_QT6_EXPORT Document
1053{
1054 friend class Page;
1055 friend class DocumentData;
1056
1057public:
1062 {
1068 UseAttach
1070
1075 {
1082 TwoPageRight
1084
1089 {
1091 QPainterBackend
1093
1098 {
1099 Antialiasing = 0x00000001,
1100 TextAntialiasing = 0x00000002,
1101 TextHinting = 0x00000004,
1102 TextSlightHinting = 0x00000008,
1103 OverprintPreview = 0x00000010,
1104 ThinLineSolid = 0x00000020,
1105 ThinLineShape = 0x00000040,
1106 IgnorePaperColor = 0x00000080,
1107 HideAnnotations = 0x00000100
1109 Q_DECLARE_FLAGS(RenderHints, RenderHint)
1110
1111
1115 {
1118 XfaForm
1120
1131 void setColorDisplayProfile(void *outputProfileA);
1139 void setColorDisplayProfileName(const QString &name);
1148 void *colorRgbProfile() const;
1157 void *colorDisplayProfile() const;
1158
1173 static std::unique_ptr<Document> load(const QString &filePath, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1174
1192 static std::unique_ptr<Document> load(QIODevice *device, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1193
1210 static std::unique_ptr<Document> loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1211
1227 std::unique_ptr<Page> page(int index) const;
1228
1241 std::unique_ptr<Page> page(const QString &label) const;
1242
1246 int numPages() const;
1247
1254
1261
1266 Qt::LayoutDirection textDirection() const;
1267
1276 bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword);
1277
1281 bool isLocked() const;
1282
1298 QDateTime date(const QString &type) const;
1299
1305 bool setDate(const QString &key, const QDateTime &val);
1306
1310 QDateTime creationDate() const;
1311
1317 bool setCreationDate(const QDateTime &val);
1318
1322 QDateTime modificationDate() const;
1323
1329 bool setModificationDate(const QDateTime &val);
1330
1347 QString info(const QString &type) const;
1348
1354 bool setInfo(const QString &key, const QString &val);
1355
1359 QString title() const;
1360
1366 bool setTitle(const QString &val);
1367
1371 QString author() const;
1372
1378 bool setAuthor(const QString &val);
1379
1383 QString subject() const;
1384
1390 bool setSubject(const QString &val);
1391
1395 QString keywords() const;
1396
1402 bool setKeywords(const QString &val);
1403
1407 QString creator() const;
1408
1414 bool setCreator(const QString &val);
1415
1419 QString producer() const;
1420
1426 bool setProducer(const QString &val);
1427
1434
1438 QStringList infoKeys() const;
1439
1443 bool isEncrypted() const;
1444
1451 bool isLinearized() const;
1452
1457 bool okToPrint() const;
1458
1463 bool okToPrintHighRes() const;
1464
1472 bool okToChange() const;
1473
1478 bool okToCopy() const;
1479
1485 bool okToAddNotes() const;
1486
1494 bool okToFillForm() const;
1495
1502
1509
1517 bool okToAssemble() const;
1518
1521 {
1522 int major;
1523 int minor;
1524 };
1525
1533
1545 QList<FontInfo> fonts() const;
1546
1557 std::unique_ptr<FontIterator> newFontIterator(int startPage = 0) const;
1558
1562 QByteArray fontData(const FontInfo &fi) const;
1563
1572 QList<EmbeddedFile *> embeddedFiles() const;
1573
1577 bool hasEmbeddedFiles() const;
1578
1584 QVector<OutlineItem> outline() const;
1585
1594 std::unique_ptr<LinkDestination> linkDestination(const QString &name);
1595
1601 void setPaperColor(const QColor &color);
1607 QColor paperColor() const;
1608
1621
1625 static QSet<RenderBackend> availableRenderBackends();
1626
1634 void setRenderHint(RenderHint hint, bool on = true);
1638 RenderHints renderHints() const;
1639
1643 std::unique_ptr<PSConverter> psConverter() const;
1644
1648 std::unique_ptr<PDFConverter> pdfConverter() const;
1649
1653 QString metadata() const;
1654
1666
1673
1680 QStringList scripts() const;
1681
1692 bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const;
1693
1698
1702 QVector<int> formCalculateOrder() const;
1703
1710 std::vector<std::unique_ptr<FormFieldSignature>> signatures() const;
1711
1718
1725 void setXRefReconstructedCallback(const std::function<void()> &callback);
1726
1731
1732private:
1733 Q_DISABLE_COPY(Document)
1734
1735 DocumentData *m_doc;
1736
1737 explicit Document(DocumentData *dataA);
1738};
1739
1740class BaseConverterPrivate;
1741class PSConverterPrivate;
1742class PDFConverterPrivate;
1748class POPPLER_QT6_EXPORT BaseConverter
1749{
1750 friend class Document;
1751
1752public:
1757
1759 void setOutputFileName(const QString &outputFileName);
1760
1764 void setOutputDevice(QIODevice *device);
1765
1771 virtual bool convert() = 0;
1772
1773 enum Error
1774 {
1775 NoError,
1776 FileLockedError,
1777 OpenOutputError,
1778 NotSupportedInputFileError
1779 };
1780
1784 Error lastError() const;
1785
1786protected:
1788 explicit BaseConverter(BaseConverterPrivate &dd);
1789 Q_DECLARE_PRIVATE(BaseConverter)
1790 BaseConverterPrivate *d_ptr;
1792
1793private:
1794 Q_DISABLE_COPY(BaseConverter)
1795};
1796
1811class POPPLER_QT6_EXPORT PSConverter : public BaseConverter
1812{
1813 friend class Document;
1814
1815public:
1820 {
1821 Printing = 0x00000001,
1822 StrictMargins = 0x00000002,
1823 ForceRasterization = 0x00000004,
1824 PrintToEPS = 0x00000008,
1825 HideAnnotations = 0x00000010
1827 Q_DECLARE_FLAGS(PSOptions, PSOption)
1828
1829
1832 ~PSConverter() override;
1833
1835 void setPageList(const QList<int> &pageList);
1836
1840 void setTitle(const QString &title);
1841
1845 void setHDPI(double hDPI);
1846
1850 void setVDPI(double vDPI);
1851
1855 void setRotate(int rotate);
1856
1860 void setPaperWidth(int paperWidth);
1861
1865 void setPaperHeight(int paperHeight);
1866
1870 void setRightMargin(int marginRight);
1871
1875 void setBottomMargin(int marginBottom);
1876
1880 void setLeftMargin(int marginLeft);
1881
1885 void setTopMargin(int marginTop);
1886
1894 void setStrictMargins(bool strictMargins);
1895
1897 void setForceRasterize(bool forceRasterize);
1898
1902 void setPSOptions(PSOptions options);
1903
1909 PSOptions psOptions() const;
1910
1916 void setPageConvertedCallback(void (*callback)(int page, void *payload), void *payload);
1917
1918 bool convert() override;
1919
1920private:
1921 Q_DECLARE_PRIVATE(PSConverter)
1922 Q_DISABLE_COPY(PSConverter)
1923
1924 explicit PSConverter(DocumentData *document);
1925};
1926
1930class POPPLER_QT6_EXPORT PDFConverter : public BaseConverter
1931{
1932 friend class Document;
1933
1934public:
1939 {
1940 WithChanges = 0x00000001
1942 Q_DECLARE_FLAGS(PDFOptions, PDFOption)
1943
1944
1947 ~PDFConverter() override;
1948
1952 void setPDFOptions(PDFOptions options);
1956 PDFOptions pdfOptions() const;
1957
1970 class POPPLER_QT6_EXPORT NewSignatureData
1971 {
1972 public:
1975 NewSignatureData(const NewSignatureData &) = delete;
1976 NewSignatureData &operator=(const NewSignatureData &) = delete;
1977
1978 QString certNickname() const;
1979 void setCertNickname(const QString &certNickname);
1980
1981 QString password() const;
1982 void setPassword(const QString &password);
1983
1984 int page() const;
1985 void setPage(int page);
1986
1987 QRectF boundingRectangle() const;
1988 void setBoundingRectangle(const QRectF &rect);
1989
1990 QString signatureText() const;
1991 void setSignatureText(const QString &text);
1992
2000 QString signatureLeftText() const;
2001 void setSignatureLeftText(const QString &text);
2002
2010 QString reason() const;
2011 void setReason(const QString &reason);
2012
2020 QString location() const;
2021 void setLocation(const QString &location);
2022
2026 double fontSize() const;
2027 void setFontSize(double fontSize);
2028
2034 double leftFontSize() const;
2035 void setLeftFontSize(double fontSize);
2036
2040 QColor fontColor() const;
2041 void setFontColor(const QColor &color);
2042
2046 QColor borderColor() const;
2047 void setBorderColor(const QColor &color);
2048
2056 double borderWidth() const;
2057 void setBorderWidth(double width);
2058
2062 QColor backgroundColor() const;
2063 void setBackgroundColor(const QColor &color);
2064
2068 QString fieldPartialName() const;
2069 void setFieldPartialName(const QString &name);
2070
2078 QByteArray documentOwnerPassword() const;
2079 void setDocumentOwnerPassword(const QByteArray &password);
2080
2088 QByteArray documentUserPassword() const;
2089 void setDocumentUserPassword(const QByteArray &password);
2090
2099 QString imagePath() const;
2100 void setImagePath(const QString &path);
2101
2102 private:
2103 struct NewSignatureDataPrivate;
2104 NewSignatureDataPrivate *const d;
2105 };
2106
2116 bool sign(const NewSignatureData &data);
2117
2118 bool convert() override;
2119
2120private:
2121 Q_DECLARE_PRIVATE(PDFConverter)
2122 Q_DISABLE_COPY(PDFConverter)
2123
2124 explicit PDFConverter(DocumentData *document);
2125};
2126
2130POPPLER_QT6_EXPORT QDateTime convertDate(const char *dateString);
2131
2135POPPLER_QT6_EXPORT bool isCmsAvailable();
2136
2140POPPLER_QT6_EXPORT bool isOverprintPreviewAvailable();
2141
2142class SoundData;
2150class POPPLER_QT6_EXPORT SoundObject
2151{
2152public:
2157 {
2159 Embedded
2161
2166 {
2170 ALaw
2172
2176 explicit SoundObject(Sound *popplersound);
2178
2179 ~SoundObject();
2180
2185
2189 QString url() const;
2190
2194 QByteArray data() const;
2195
2199 double samplingRate() const;
2200
2204 int channels() const;
2205
2209 int bitsPerSample() const;
2210
2215
2216private:
2217 Q_DISABLE_COPY(SoundObject)
2218
2219 SoundData *m_soundData;
2220};
2221
2222class MovieData;
2226class POPPLER_QT6_EXPORT MovieObject
2227{
2228 friend class AnnotationPrivate;
2229
2230public:
2235 {
2239 PlayPalindrome
2241
2242 ~MovieObject();
2243
2247 QString url() const;
2248
2252 QSize size() const;
2253
2257 int rotation() const;
2258
2262 bool showControls() const;
2263
2268
2272 bool showPosterImage() const;
2273
2279 QImage posterImage() const;
2280
2281private:
2283 explicit MovieObject(AnnotMovie *ann);
2285
2286 Q_DISABLE_COPY(MovieObject)
2287
2288 MovieData *m_movieData;
2289};
2290
2291}
2292
2293Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::PainterFlags)
2294Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::SearchFlags)
2295Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints)
2296Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PDFConverter::PDFOptions)
2297Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PSConverter::PSOptions)
2298
2299#endif
Annotation class holding properties shared by all annotations.
Definition: poppler-annotation.h:174
Base converter.
Definition: poppler-qt6.h:1749
virtual bool convert()=0
Does the conversion.
void setOutputDevice(QIODevice *device)
Sets the output device.
Error lastError() const
Returns the last error.
void setOutputFileName(const QString &outputFileName)
Sets the output file name.
virtual ~BaseConverter()
Destructor.
PDF document.
Definition: poppler-qt6.h:1053
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:1075
@ TwoPageLeft
Display the pages two at a time, with odd-numbered pages on the left.
Definition: poppler-qt6.h:1081
@ TwoColumnLeft
Display the pages in two columns, with odd-numbered pages on the left.
Definition: poppler-qt6.h:1079
@ SinglePage
Display a single page.
Definition: poppler-qt6.h:1077
@ NoLayout
Layout not specified.
Definition: poppler-qt6.h:1076
@ TwoColumnRight
Display the pages in two columns, with odd-numbered pages on the right.
Definition: poppler-qt6.h:1080
@ OneColumn
Display a single column of pages.
Definition: poppler-qt6.h:1078
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
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:1089
@ SplashBackend
Splash backend.
Definition: poppler-qt6.h:1090
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:1062
@ UseOutlines
Document outline visible.
Definition: poppler-qt6.h:1064
@ UseNone
No mode - neither document outline nor thumbnail images are visible.
Definition: poppler-qt6.h:1063
@ UseThumbs
Thumbnail images visible.
Definition: poppler-qt6.h:1065
@ FullScreen
Fullscreen mode (no menubar, windows controls etc)
Definition: poppler-qt6.h:1066
@ UseOC
Optional content group panel visible.
Definition: poppler-qt6.h:1067
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:1098
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.
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.
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:1115
@ AcroForm
AcroForm.
Definition: poppler-qt6.h:1117
@ NoForm
Document doesn't contain forms.
Definition: poppler-qt6.h:1116
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.
QStringList scripts() const
Document-level JavaScript scripts.
QString info(const QString &type) const
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...
Container class for an embedded file with a PDF document.
Definition: poppler-qt6.h:336
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:175
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:183
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.
Iterator for reading the fonts in a document.
Definition: poppler-qt6.h:297
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.
Container class for a movie object in a PDF document.
Definition: poppler-qt6.h:2227
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:2235
@ PlayRepeat
Play continuously until stopped.
Definition: poppler-qt6.h:2238
@ PlayOnce
Play the movie once, closing the movie controls at the end.
Definition: poppler-qt6.h:2236
@ PlayOpen
Like PlayOnce, but leaving the controls open.
Definition: poppler-qt6.h:2237
PlayMode playMode() const
How to play the movie.
Model for optional content.
Definition: poppler-optcontent.h:47
Item in the outline of a PDF document.
Definition: poppler-qt6.h:931
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.
Holds data for a new signature.
Definition: poppler-qt6.h:1971
QColor backgroundColor() const
Default: QColor(240, 240, 240)
QColor fontColor() const
Default: red.
QColor borderColor() const
Default: red.
double fontSize() const
Default: 10.
double borderWidth() const
border width in points
QString location() const
Signature's property Location.
QString signatureLeftText() const
If this text is not empty, the signature representation will split in two, with this text on the left...
QString fieldPartialName() const
Default: QUuid::createUuid().toString()
double leftFontSize() const
Default: 20.
QByteArray documentOwnerPassword() const
Document owner password (needed if the document that is being signed is password protected)
QString reason() const
Signature's property Reason.
QByteArray documentUserPassword() const
Document user password (needed if the document that is being signed is password protected)
QString imagePath() const
Filesystem path to an image file to be used as background image for the signature annotation widget.
Converts a PDF to PDF (thus saves a copy of the document).
Definition: poppler-qt6.h:1931
bool convert() override
Does the conversion.
PDFOption
Options for the PDF export.
Definition: poppler-qt6.h:1939
~PDFConverter() override
Destructor.
void setPDFOptions(PDFOptions options)
Sets the options for the PDF export.
PDFOptions pdfOptions() const
The currently set options for the PDF export.
bool sign(const NewSignatureData &data)
Sign PDF at given Annotation / signature form.
Converts a PDF to PS.
Definition: poppler-qt6.h:1812
void setPSOptions(PSOptions options)
Sets the options for the PS export.
void setStrictMargins(bool strictMargins)
Defines if margins have to be strictly followed (even if that means changing aspect ratio),...
PSOption
Options for the PS export.
Definition: poppler-qt6.h:1820
void setPageConvertedCallback(void(*callback)(int page, void *payload), void *payload)
Sets a function that will be called each time a page is converted.
void setRightMargin(int marginRight)
Sets the output right margin.
void setBottomMargin(int marginBottom)
Sets the output bottom margin.
bool convert() override
Does the conversion.
void setTopMargin(int marginTop)
Sets the output top margin.
~PSConverter() override
Destructor.
void setVDPI(double vDPI)
Sets the vertical DPI.
void setLeftMargin(int marginLeft)
Sets the output left margin.
void setPaperHeight(int paperHeight)
Sets the output paper height.
void setTitle(const QString &title)
Sets the title of the PS Document.
void setPageList(const QList< int > &pageList)
Sets the list of pages to print.
void setForceRasterize(bool forceRasterize)
Defines if the page will be rasterized to an image before printing.
void setHDPI(double hDPI)
Sets the horizontal DPI.
void setPaperWidth(int paperWidth)
Sets the output paper width.
void setRotate(int rotate)
Sets the rotate.
PSOptions psOptions() const
The currently set options for the PS export.
Describes how a PDF file viewer shall perform the transition from one page to another.
Definition: poppler-page-transition.h:48
A page in a document.
Definition: poppler-qt6.h:422
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:530
Orientation
Types of orientations that are possible.
Definition: poppler-qt6.h:841
@ Seascape
Seascape orientation (portrait, with 270 degrees clockwise rotation)
Definition: poppler-qt6.h:844
@ Landscape
Landscape orientation (portrait, with 90 degrees clockwise rotation )
Definition: poppler-qt6.h:842
@ Portrait
Normal portrait orientation.
Definition: poppler-qt6.h:843
SearchFlag
Flags to modify the search behaviour.
Definition: poppler-qt6.h:735
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.
std::vector< std::unique_ptr< Link > > links() const
Gets the links of the page.
int index() const
Returns the index of the page.
SearchDirection
The starting point for a search.
Definition: poppler-qt6.h:716
@ FromTop
Start sorting at the top of the document.
Definition: poppler-qt6.h:717
@ NextResult
Find the next result, moving "down the page".
Definition: poppler-qt6.h:718
PainterFlag
Additional flags for the renderToPainter method.
Definition: poppler-qt6.h:464
Rotation
The type of rotation to apply for an operation.
Definition: poppler-qt6.h:435
~Page()
Destructor.
Orientation orientation() const
The orientation of the page.
SearchMode
The type of search to perform.
Definition: poppler-qt6.h:726
@ CaseSensitive
Case differences cause no match in searching.
Definition: poppler-qt6.h:727
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:455
@ PhysicalLayout
The text is layouted to resemble the real page layout.
Definition: poppler-qt6.h:456
PageAction
The kinds of page actions.
Definition: poppler-qt6.h:446
@ Opening
The action when a page is "opened".
Definition: poppler-qt6.h:447
double duration() const
Returns the page duration.
void(*)(const QImage &, const QVariant &) RenderToImagePartialUpdateFunc
Partial Update renderToImage callback.
Definition: poppler-qt6.h:522
QString label() const
Returns the label of the page, or a null string is the page has no label.
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:587
Container class for a sound file in a PDF document.
Definition: poppler-qt6.h:2151
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:2166
@ muLaw
mu-law-encoded samples
Definition: poppler-qt6.h:2169
@ Signed
Twos-complement values.
Definition: poppler-qt6.h:2168
@ Raw
Raw encoding, with unspecified or unsigned values in the range [ 0, 2^B - 1 ].
Definition: poppler-qt6.h:2167
SoundType
The type of sound.
Definition: poppler-qt6.h:2157
@ External
The real sound file is external.
Definition: poppler-qt6.h:2158
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:120
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:49
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:97
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:1521