Poppler Qt6 24.07.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 * 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 *
35 * This program is free software; you can redistribute it and/or modify
36 * it under the terms of the GNU General Public License as published by
37 * the Free Software Foundation; either version 2, or (at your option)
38 * any later version.
39 *
40 * This program is distributed in the hope that it will be useful,
41 * but WITHOUT ANY WARRANTY; without even the implied warranty of
42 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43 * GNU General Public License for more details.
44 *
45 * You should have received a copy of the GNU General Public License
46 * along with this program; if not, write to the Free Software
47 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
48 */
49
50#ifndef __POPPLER_QT_H__
51#define __POPPLER_QT_H__
52
53#include <functional>
54#include <memory>
55#include <vector>
56
57#include "poppler-annotation.h"
58#include "poppler-link.h"
59#include "poppler-optcontent.h"
60#include "poppler-page-transition.h"
61
62#include <QtCore/QByteArray>
63#include <QtCore/QDateTime>
64#include <QtCore/QIODevice>
65#include <QtCore/QSet>
66#include "poppler-export.h"
67
68class EmbFile;
69class Sound;
70class AnnotMovie;
71
75namespace Poppler {
76
77class Document;
78class DocumentData;
79
80class PageData;
81
82class FormField;
83class FormFieldSignature;
84
85class TextBoxData;
86
87class PDFConverter;
88class PSConverter;
89
90struct OutlineItemData;
91
99using PopplerDebugFunc = void (*)(const QString & /*message*/, const QVariant & /*closure*/);
100
110POPPLER_QT6_EXPORT void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure);
111
121class POPPLER_QT6_EXPORT TextBox
122{
123 friend class Page;
124
125public:
131 TextBox(const QString &text, const QRectF &bBox);
136
140 QString text() const;
141
146 QRectF boundingBox() const;
147
154
158 QRectF charBoundingBox(int i) const;
159
163 bool hasSpaceAfter() const;
164
165private:
166 Q_DISABLE_COPY(TextBox)
167
168 TextBoxData *m_data;
169};
170
171class FontInfoData;
176class POPPLER_QT6_EXPORT FontInfo
177{
178 friend class Document;
179
180public:
184 enum Type
185 {
186 unknown,
187 Type1,
188 Type1C,
189 Type1COT,
190 Type3,
191 TrueType,
192 TrueTypeOT,
193 CIDType0,
194 CIDType0C,
195 CIDType0COT,
196 CIDTrueType,
197 CIDTrueTypeOT
198 };
199
201
204 FontInfo();
205
209 explicit FontInfo(const FontInfoData &fid);
211
215 FontInfo(const FontInfo &fi);
216
221
225 QString name() const;
226
230 QString substituteName() const;
231
236 QString file() const;
237
243 bool isEmbedded() const;
244
251 bool isSubset() const;
252
260 Type type() const;
261
270 QString typeName() const;
271
276
277private:
278 FontInfoData *m_data;
279};
280
281class FontIteratorData;
298class POPPLER_QT6_EXPORT FontIterator
299{
300 friend class Document;
301 friend class DocumentData;
302
303public:
308
313 QList<FontInfo> next();
314
319 bool hasNext() const;
320
324 int currentPage() const;
325
326private:
327 Q_DISABLE_COPY(FontIterator)
328 FontIterator(int, DocumentData *dd);
329
330 FontIteratorData *d;
331};
332
333class EmbeddedFileData;
337class POPPLER_QT6_EXPORT EmbeddedFile
338{
339 friend class DocumentData;
340 friend class AnnotationPrivate;
341
342public:
344 explicit EmbeddedFile(EmbFile *embfile);
346
351
355 QString name() const;
356
362 QString description() const;
363
369 int size() const;
370
374 QDateTime modDate() const;
375
379 QDateTime createDate() const;
380
386 QByteArray checksum() const;
387
391 QString mimeType() const;
392
396 QByteArray data();
397
401 bool isValid() const;
402
406 // QDataStream dataStream() const;
407
408private:
409 Q_DISABLE_COPY(EmbeddedFile)
410 explicit EmbeddedFile(EmbeddedFileData &dd);
411
412 EmbeddedFileData *m_embeddedFile;
413};
414
423class POPPLER_QT6_EXPORT Page
424{
425 friend class Document;
426
427public:
432
437 {
438 Rotate0 = 0,
439 Rotate90 = 1,
440 Rotate180 = 2,
441 Rotate270 = 3
442 };
443
448 {
450 Closing
451 };
452
457 {
459 RawOrderLayout
460 };
461
466 {
467 NoPainterFlags = 0x00000000,
475 DontSaveAndRestore = 0x00000001
476 };
477 Q_DECLARE_FLAGS(PainterFlags, PainterFlag)
478
479
515 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;
516
524 using RenderToImagePartialUpdateFunc = void (*)(const QImage & /*image*/, const QVariant & /*closure*/);
525
532 using ShouldRenderToImagePartialQueryFunc = bool (*)(const QVariant & /*closure*/);
533
581 QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
582 const QVariant &payload) const;
583
589 using ShouldAbortQueryFunc = bool (*)(const QVariant & /*closure*/);
590
642 QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
643 ShouldAbortQueryFunc shouldAbortRenderCallback, const QVariant &payload) const;
644
685 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;
686
693 QImage thumbnail() const;
694
702 QString text(const QRectF &rect, TextLayout textLayout) const;
703
712 QString text(const QRectF &rect) const;
713
718 {
721 PreviousResult
722 };
723
728 {
730 CaseInsensitive
731 };
732
737 {
738 NoSearchFlags = 0x00000000,
739 IgnoreCase = 0x00000001,
740 WholeWords = 0x00000002,
741 IgnoreDiacritics = 0x00000004,
744 AcrossLines = 0x00000008
747 };
748 Q_DECLARE_FLAGS(SearchFlags, SearchFlag)
749
750
760 bool search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
761
774 QList<QRectF> search(const QString &text, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
775
789 std::vector<std::unique_ptr<TextBox>> textList(Rotation rotate = Rotate0) const;
790
810 std::vector<std::unique_ptr<TextBox>> textList(Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const;
811
815 QSizeF pageSizeF() const;
816
820 QSize pageSize() const;
821
832 PageTransition *transition() const;
833
837 std::unique_ptr<Link> action(PageAction act) const;
838
849
854
858 void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown);
859
863 std::vector<std::unique_ptr<Link>> links() const;
864
871 std::vector<std::unique_ptr<Annotation>> annotations() const;
872
881 std::vector<std::unique_ptr<Annotation>> annotations(const QSet<Annotation::SubType> &subtypes) const;
882
889 void addAnnotation(const Annotation *ann);
890
896 void removeAnnotation(const Annotation *ann);
897
901 std::vector<std::unique_ptr<FormField>> formFields() const;
902
908 double duration() const;
909
913 QString label() const;
914
918 int index() const;
919
920private:
921 Q_DISABLE_COPY(Page)
922
923 Page(DocumentData *doc, int index);
924 PageData *m_page;
925};
926
932class POPPLER_QT6_EXPORT OutlineItem
933{
934 friend class Document;
935
936public:
941 ~OutlineItem();
942
943 OutlineItem(const OutlineItem &other);
944 OutlineItem &operator=(const OutlineItem &other);
945
946 OutlineItem(OutlineItem &&other) noexcept;
947 OutlineItem &operator=(OutlineItem &&other) noexcept;
948
952 bool isNull() const;
953
957 QString name() const;
958
962 bool isOpen() const;
963
969 QSharedPointer<const LinkDestination> destination() const;
970
976 QString externalFileName() const;
977
983 QString uri() const;
984
990 bool hasChildren() const;
991
997 QVector<OutlineItem> children() const;
998
999private:
1000 explicit OutlineItem(OutlineItemData *data);
1001 OutlineItemData *m_data;
1002};
1003
1054class POPPLER_QT6_EXPORT Document
1055{
1056 friend class Page;
1057 friend class DocumentData;
1058
1059public:
1072
1086
1091 {
1093 QPainterBackend
1095
1100 {
1101 Antialiasing = 0x00000001,
1102 TextAntialiasing = 0x00000002,
1103 TextHinting = 0x00000004,
1104 TextSlightHinting = 0x00000008,
1105 OverprintPreview = 0x00000010,
1106 ThinLineSolid = 0x00000020,
1107 ThinLineShape = 0x00000040,
1108 IgnorePaperColor = 0x00000080,
1109 HideAnnotations = 0x00000100
1111 Q_DECLARE_FLAGS(RenderHints, RenderHint)
1112
1113
1117 {
1120 XfaForm
1122
1133 void setColorDisplayProfile(void *outputProfileA);
1141 void setColorDisplayProfileName(const QString &name);
1150 void *colorRgbProfile() const;
1159 void *colorDisplayProfile() const;
1160
1175 static std::unique_ptr<Document> load(const QString &filePath, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1176
1194 static std::unique_ptr<Document> load(QIODevice *device, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1195
1212 static std::unique_ptr<Document> loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1213
1229 std::unique_ptr<Page> page(int index) const;
1230
1243 std::unique_ptr<Page> page(const QString &label) const;
1244
1248 int numPages() const;
1249
1256
1263
1268 Qt::LayoutDirection textDirection() const;
1269
1278 bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword);
1279
1283 bool isLocked() const;
1284
1300 QDateTime date(const QString &type) const;
1301
1307 bool setDate(const QString &key, const QDateTime &val);
1308
1312 QDateTime creationDate() const;
1313
1319 bool setCreationDate(const QDateTime &val);
1320
1324 QDateTime modificationDate() const;
1325
1331 bool setModificationDate(const QDateTime &val);
1332
1349 QString info(const QString &type) const;
1350
1356 bool setInfo(const QString &key, const QString &val);
1357
1361 QString title() const;
1362
1368 bool setTitle(const QString &val);
1369
1373 QString author() const;
1374
1380 bool setAuthor(const QString &val);
1381
1385 QString subject() const;
1386
1392 bool setSubject(const QString &val);
1393
1397 QString keywords() const;
1398
1404 bool setKeywords(const QString &val);
1405
1409 QString creator() const;
1410
1416 bool setCreator(const QString &val);
1417
1421 QString producer() const;
1422
1428 bool setProducer(const QString &val);
1429
1436
1440 QStringList infoKeys() const;
1441
1445 bool isEncrypted() const;
1446
1453 bool isLinearized() const;
1454
1459 bool okToPrint() const;
1460
1465 bool okToPrintHighRes() const;
1466
1474 bool okToChange() const;
1475
1480 bool okToCopy() const;
1481
1487 bool okToAddNotes() const;
1488
1496 bool okToFillForm() const;
1497
1504
1511
1519 bool okToAssemble() const;
1520
1523 {
1524 int major;
1525 int minor;
1526 };
1527
1535
1547 QList<FontInfo> fonts() const;
1548
1559 std::unique_ptr<FontIterator> newFontIterator(int startPage = 0) const;
1560
1564 QByteArray fontData(const FontInfo &fi) const;
1565
1574 QList<EmbeddedFile *> embeddedFiles() const;
1575
1579 bool hasEmbeddedFiles() const;
1580
1586 QVector<OutlineItem> outline() const;
1587
1596 std::unique_ptr<LinkDestination> linkDestination(const QString &name);
1597
1603 void setPaperColor(const QColor &color);
1609 QColor paperColor() const;
1610
1623
1627 static QSet<RenderBackend> availableRenderBackends();
1628
1636 void setRenderHint(RenderHint hint, bool on = true);
1640 RenderHints renderHints() const;
1641
1645 std::unique_ptr<PSConverter> psConverter() const;
1646
1650 std::unique_ptr<PDFConverter> pdfConverter() const;
1651
1655 QString metadata() const;
1656
1668
1675
1682
1689 QStringList scripts() const;
1690
1707
1714 std::unique_ptr<Link> additionalAction(DocumentAdditionalActionsType type) const;
1715
1726 bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const;
1727
1732
1736 QVector<int> formCalculateOrder() const;
1737
1744 std::vector<std::unique_ptr<FormFieldSignature>> signatures() const;
1745
1752
1759 void setXRefReconstructedCallback(const std::function<void()> &callback);
1760
1765
1766private:
1767 Q_DISABLE_COPY(Document)
1768
1769 DocumentData *m_doc;
1770
1771 explicit Document(DocumentData *dataA);
1772};
1773
1774class BaseConverterPrivate;
1775class PSConverterPrivate;
1776class PDFConverterPrivate;
1782class POPPLER_QT6_EXPORT BaseConverter
1783{
1784 friend class Document;
1785
1786public:
1791
1793 void setOutputFileName(const QString &outputFileName);
1794
1798 void setOutputDevice(QIODevice *device);
1799
1805 virtual bool convert() = 0;
1806
1807 enum Error
1808 {
1809 NoError,
1810 FileLockedError,
1811 OpenOutputError,
1812 NotSupportedInputFileError
1813 };
1814
1818 Error lastError() const;
1819
1820protected:
1822 explicit BaseConverter(BaseConverterPrivate &dd);
1823 Q_DECLARE_PRIVATE(BaseConverter)
1824 BaseConverterPrivate *d_ptr;
1826
1827private:
1828 Q_DISABLE_COPY(BaseConverter)
1829};
1830
1845class POPPLER_QT6_EXPORT PSConverter : public BaseConverter
1846{
1847 friend class Document;
1848
1849public:
1854 {
1855 Printing = 0x00000001,
1856 StrictMargins = 0x00000002,
1857 ForceRasterization = 0x00000004,
1858 PrintToEPS = 0x00000008,
1859 HideAnnotations = 0x00000010,
1860 ForceOverprintPreview = 0x00000020
1862 Q_DECLARE_FLAGS(PSOptions, PSOption)
1863
1864
1867 ~PSConverter() override;
1868
1870 void setPageList(const QList<int> &pageList);
1871
1875 void setTitle(const QString &title);
1876
1880 void setHDPI(double hDPI);
1881
1885 void setVDPI(double vDPI);
1886
1890 void setRotate(int rotate);
1891
1895 void setPaperWidth(int paperWidth);
1896
1900 void setPaperHeight(int paperHeight);
1901
1905 void setRightMargin(int marginRight);
1906
1910 void setBottomMargin(int marginBottom);
1911
1915 void setLeftMargin(int marginLeft);
1916
1920 void setTopMargin(int marginTop);
1921
1929 void setStrictMargins(bool strictMargins);
1930
1939 void setForceOverprintPreview(bool forceOverprintPreview);
1940
1942 void setForceRasterize(bool forceRasterize);
1943
1947 void setPSOptions(PSOptions options);
1948
1954 PSOptions psOptions() const;
1955
1961 void setPageConvertedCallback(void (*callback)(int page, void *payload), void *payload);
1962
1963 bool convert() override;
1964
1965private:
1966 Q_DECLARE_PRIVATE(PSConverter)
1967 Q_DISABLE_COPY(PSConverter)
1968
1969 explicit PSConverter(DocumentData *document);
1970};
1971
1975class POPPLER_QT6_EXPORT PDFConverter : public BaseConverter
1976{
1977 friend class Document;
1978
1979public:
1984 {
1985 WithChanges = 0x00000001
1987 Q_DECLARE_FLAGS(PDFOptions, PDFOption)
1988
1989
1992 ~PDFConverter() override;
1993
1997 void setPDFOptions(PDFOptions options);
2001 PDFOptions pdfOptions() const;
2002
2015 class POPPLER_QT6_EXPORT NewSignatureData
2016 {
2017 public:
2020 NewSignatureData(const NewSignatureData &) = delete;
2021 NewSignatureData &operator=(const NewSignatureData &) = delete;
2022
2023 QString certNickname() const;
2024 void setCertNickname(const QString &certNickname);
2025
2026 QString password() const;
2027 void setPassword(const QString &password);
2028
2029 int page() const;
2030 void setPage(int page);
2031
2032 QRectF boundingRectangle() const;
2033 void setBoundingRectangle(const QRectF &rect);
2034
2035 QString signatureText() const;
2036 void setSignatureText(const QString &text);
2037
2045 QString signatureLeftText() const;
2046 void setSignatureLeftText(const QString &text);
2047
2055 QString reason() const;
2056 void setReason(const QString &reason);
2057
2065 QString location() const;
2066 void setLocation(const QString &location);
2067
2071 double fontSize() const;
2072 void setFontSize(double fontSize);
2073
2079 double leftFontSize() const;
2080 void setLeftFontSize(double fontSize);
2081
2085 QColor fontColor() const;
2086 void setFontColor(const QColor &color);
2087
2091 QColor borderColor() const;
2092 void setBorderColor(const QColor &color);
2093
2101 double borderWidth() const;
2102 void setBorderWidth(double width);
2103
2107 QColor backgroundColor() const;
2108 void setBackgroundColor(const QColor &color);
2109
2113 QString fieldPartialName() const;
2114 void setFieldPartialName(const QString &name);
2115
2123 QByteArray documentOwnerPassword() const;
2124 void setDocumentOwnerPassword(const QByteArray &password);
2125
2133 QByteArray documentUserPassword() const;
2134 void setDocumentUserPassword(const QByteArray &password);
2135
2144 QString imagePath() const;
2145 void setImagePath(const QString &path);
2146
2147 private:
2148 struct NewSignatureDataPrivate;
2149 NewSignatureDataPrivate *const d;
2150 };
2151
2161 bool sign(const NewSignatureData &data);
2162
2163 bool convert() override;
2164
2165private:
2166 Q_DECLARE_PRIVATE(PDFConverter)
2167 Q_DISABLE_COPY(PDFConverter)
2168
2169 explicit PDFConverter(DocumentData *document);
2170};
2171
2175POPPLER_QT6_EXPORT QDateTime convertDate(const char *dateString);
2176
2180POPPLER_QT6_EXPORT bool isCmsAvailable();
2181
2185POPPLER_QT6_EXPORT bool isOverprintPreviewAvailable();
2186
2187class SoundData;
2195class POPPLER_QT6_EXPORT SoundObject
2196{
2197public:
2202 {
2204 Embedded
2206
2217
2221 explicit SoundObject(Sound *popplersound);
2223
2224 ~SoundObject();
2225
2230
2234 QString url() const;
2235
2239 QByteArray data() const;
2240
2244 double samplingRate() const;
2245
2249 int channels() const;
2250
2254 int bitsPerSample() const;
2255
2260
2261private:
2262 Q_DISABLE_COPY(SoundObject)
2263
2264 SoundData *m_soundData;
2265};
2266
2267class MovieData;
2271class POPPLER_QT6_EXPORT MovieObject
2272{
2273 friend class AnnotationPrivate;
2274
2275public:
2280 {
2284 PlayPalindrome
2286
2287 ~MovieObject();
2288
2292 QString url() const;
2293
2297 QSize size() const;
2298
2302 int rotation() const;
2303
2307 bool showControls() const;
2308
2313
2317 bool showPosterImage() const;
2318
2324 QImage posterImage() const;
2325
2326private:
2328 explicit MovieObject(AnnotMovie *ann);
2330
2331 Q_DISABLE_COPY(MovieObject)
2332
2333 MovieData *m_movieData;
2334};
2335
2336}
2337
2338Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::PainterFlags)
2339Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::SearchFlags)
2340Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints)
2341Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PDFConverter::PDFOptions)
2342Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PSConverter::PSOptions)
2343
2344#endif
Annotation class holding properties shared by all annotations.
Definition poppler-annotation.h:174
Base converter.
Definition poppler-qt6.h:1783
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:1055
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:1077
@ TwoPageLeft
Display the pages two at a time, with odd-numbered pages on the left.
Definition poppler-qt6.h:1083
@ TwoColumnLeft
Display the pages in two columns, with odd-numbered pages on the left.
Definition poppler-qt6.h:1081
@ SinglePage
Display a single page.
Definition poppler-qt6.h:1079
@ NoLayout
Layout not specified.
Definition poppler-qt6.h:1078
@ TwoColumnRight
Display the pages in two columns, with odd-numbered pages on the right.
Definition poppler-qt6.h:1082
@ OneColumn
Display a single column of pages.
Definition poppler-qt6.h:1080
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:1091
@ SplashBackend
Splash backend.
Definition poppler-qt6.h:1092
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:1064
@ UseOutlines
Document outline visible.
Definition poppler-qt6.h:1066
@ UseNone
No mode - neither document outline nor thumbnail images are visible.
Definition poppler-qt6.h:1065
@ UseThumbs
Thumbnail images visible.
Definition poppler-qt6.h:1067
@ FullScreen
Fullscreen mode (no menubar, windows controls etc)
Definition poppler-qt6.h:1068
@ UseOC
Optional content group panel visible.
Definition poppler-qt6.h:1069
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:1100
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:1700
@ CloseDocument
Performed before closing the document.
Definition poppler-qt6.h:1701
@ PrintDocumentStart
Performed before printing the document.
Definition poppler-qt6.h:1704
@ PrintDocumentFinish
Performed after printing the document.
Definition poppler-qt6.h:1705
@ SaveDocumentFinish
Performed after saving the document.
Definition poppler-qt6.h:1703
@ SaveDocumentStart
Performed before saving the document.
Definition poppler-qt6.h:1702
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:1117
@ AcroForm
AcroForm.
Definition poppler-qt6.h:1119
@ NoForm
Document doesn't contain forms.
Definition poppler-qt6.h:1118
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
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:338
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:177
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:185
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:299
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.
ResetForm: an action to reset form fields.
Definition poppler-link.h:680
Container class for a movie object in a PDF document.
Definition poppler-qt6.h:2272
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:2280
@ PlayRepeat
Play continuously until stopped.
Definition poppler-qt6.h:2283
@ PlayOnce
Play the movie once, closing the movie controls at the end.
Definition poppler-qt6.h:2281
@ PlayOpen
Like PlayOnce, but leaving the controls open.
Definition poppler-qt6.h:2282
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:933
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:2016
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:1976
bool convert() override
Does the conversion.
PDFOption
Options for the PDF export.
Definition poppler-qt6.h:1984
~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:1846
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:1854
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.
void setForceOverprintPreview(bool forceOverprintPreview)
Defines if the page will be rasterized to an image with overprint preview enabled before printing.
~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:424
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:532
Orientation
Types of orientations that are possible.
Definition poppler-qt6.h:843
@ Seascape
Seascape orientation (portrait, with 270 degrees clockwise rotation)
Definition poppler-qt6.h:846
@ Landscape
Landscape orientation (portrait, with 90 degrees clockwise rotation )
Definition poppler-qt6.h:844
@ Portrait
Normal portrait orientation.
Definition poppler-qt6.h:845
SearchFlag
Flags to modify the search behaviour.
Definition poppler-qt6.h:737
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:718
@ FromTop
Start sorting at the top of the document.
Definition poppler-qt6.h:719
@ NextResult
Find the next result, moving "down the page".
Definition poppler-qt6.h:720
PainterFlag
Additional flags for the renderToPainter method.
Definition poppler-qt6.h:466
Rotation
The type of rotation to apply for an operation.
Definition poppler-qt6.h:437
~Page()
Destructor.
Orientation orientation() const
The orientation of the page.
SearchMode
The type of search to perform.
Definition poppler-qt6.h:728
@ CaseSensitive
Case differences cause no match in searching.
Definition poppler-qt6.h:729
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:457
@ PhysicalLayout
The text is layouted to resemble the real page layout.
Definition poppler-qt6.h:458
PageAction
The kinds of page actions.
Definition poppler-qt6.h:448
@ Opening
The action when a page is "opened".
Definition poppler-qt6.h:449
double duration() const
Returns the page duration.
void(*)(const QImage &, const QVariant &) RenderToImagePartialUpdateFunc
Partial Update renderToImage callback.
Definition poppler-qt6.h:524
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:589
Container class for a sound file in a PDF document.
Definition poppler-qt6.h:2196
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:2211
@ muLaw
mu-law-encoded samples
Definition poppler-qt6.h:2214
@ Signed
Twos-complement values.
Definition poppler-qt6.h:2213
@ Raw
Raw encoding, with unspecified or unsigned values in the range [ 0, 2^B - 1 ].
Definition poppler-qt6.h:2212
SoundType
The type of sound.
Definition poppler-qt6.h:2202
@ External
The real sound file is external.
Definition poppler-qt6.h:2203
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:122
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:99
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:1523