Poppler Qt5 24.05.0
poppler-qt5.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 *
34 * This program is free software; you can redistribute it and/or modify
35 * it under the terms of the GNU General Public License as published by
36 * the Free Software Foundation; either version 2, or (at your option)
37 * any later version.
38 *
39 * This program is distributed in the hope that it will be useful,
40 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42 * GNU General Public License for more details.
43 *
44 * You should have received a copy of the GNU General Public License
45 * along with this program; if not, write to the Free Software
46 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
47 */
48
49#ifndef __POPPLER_QT_H__
50#define __POPPLER_QT_H__
51
52#include <functional>
53
54#include "poppler-annotation.h"
55#include "poppler-link.h"
56#include "poppler-optcontent.h"
57#include "poppler-page-transition.h"
58
59#include <QtCore/QByteArray>
60#include <QtCore/QDateTime>
61#include <QtCore/QSet>
62#include <QtXml/QDomDocument>
63#include "poppler-export.h"
64
65class EmbFile;
66class Sound;
67class AnnotMovie;
68
72namespace Poppler {
73
74class Document;
75class DocumentData;
76
77class PageData;
78
79class FormField;
80class FormFieldSignature;
81
82class TextBoxData;
83
84class PDFConverter;
85class PSConverter;
86
87struct OutlineItemData;
88
98using PopplerDebugFunc = void (*)(const QString & /*message*/, const QVariant & /*closure*/);
99
111POPPLER_QT5_EXPORT void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure);
112
122class POPPLER_QT5_EXPORT TextBox
123{
124 friend class Page;
125
126public:
132 TextBox(const QString &text, const QRectF &bBox);
137
141 QString text() const;
142
149 QRectF boundingBox() const;
150
157
161 QRectF charBoundingBox(int i) const;
162
166 bool hasSpaceAfter() const;
167
168private:
169 Q_DISABLE_COPY(TextBox)
170
171 TextBoxData *m_data;
172};
173
174class FontInfoData;
179class POPPLER_QT5_EXPORT FontInfo
180{
181 friend class Document;
182
183public:
187 enum Type
188 {
189 unknown,
190 Type1,
191 Type1C,
192 Type1COT,
193 Type3,
194 TrueType,
195 TrueTypeOT,
196 CIDType0,
197 CIDType0C,
198 CIDType0COT,
199 CIDTrueType,
200 CIDTrueTypeOT
201 };
202
204
207 FontInfo();
208
212 explicit FontInfo(const FontInfoData &fid);
214
218 FontInfo(const FontInfo &fi);
219
224
228 QString name() const;
229
234 QString substituteName() const;
235
240 QString file() const;
241
247 bool isEmbedded() const;
248
255 bool isSubset() const;
256
264 Type type() const;
265
274 QString typeName() const;
275
280
281private:
282 FontInfoData *m_data;
283};
284
285class FontIteratorData;
305class POPPLER_QT5_EXPORT FontIterator
306{
307 friend class Document;
308 friend class DocumentData;
309
310public:
315
320 QList<FontInfo> next();
321
326 bool hasNext() const;
327
331 int currentPage() const;
332
333private:
334 Q_DISABLE_COPY(FontIterator)
335 FontIterator(int, DocumentData *dd);
336
337 FontIteratorData *d;
338};
339
340class EmbeddedFileData;
344class POPPLER_QT5_EXPORT EmbeddedFile
345{
346 friend class DocumentData;
347 friend class AnnotationPrivate;
348
349public:
351 explicit EmbeddedFile(EmbFile *embfile);
353
358
362 QString name() const;
363
369 QString description() const;
370
376 int size() const;
377
381 QDateTime modDate() const;
382
386 QDateTime createDate() const;
387
393 QByteArray checksum() const;
394
400 QString mimeType() const;
401
405 QByteArray data();
406
412 bool isValid() const;
413
417 // QDataStream dataStream() const;
418
419private:
420 Q_DISABLE_COPY(EmbeddedFile)
421 explicit EmbeddedFile(EmbeddedFileData &dd);
422
423 EmbeddedFileData *m_embeddedFile;
424};
425
434class POPPLER_QT5_EXPORT Page
435{
436 friend class Document;
437
438public:
443
448 {
449 Rotate0 = 0,
450 Rotate90 = 1,
451 Rotate180 = 2,
452 Rotate270 = 3
453 };
454
459 {
461 Closing
462 };
463
469 {
471 RawOrderLayout
472 };
473
479 {
480 NoPainterFlags = 0x00000000,
488 DontSaveAndRestore = 0x00000001
489 };
490 Q_DECLARE_FLAGS(PainterFlags, PainterFlag)
491
492
530 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;
531
541 using RenderToImagePartialUpdateFunc = void (*)(const QImage & /*image*/, const QVariant & /*closure*/);
542
551 using ShouldRenderToImagePartialQueryFunc = bool (*)(const QVariant & /*closure*/);
552
602 QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
603 const QVariant &payload) const;
604
612 using ShouldAbortQueryFunc = bool (*)(const QVariant & /*closure*/);
613
667 QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
668 ShouldAbortQueryFunc shouldAbortRenderCallback, const QVariant &payload) const;
669
712 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;
713
722 QImage thumbnail() const;
723
733 QString text(const QRectF &rect, TextLayout textLayout) const;
734
743 QString text(const QRectF &rect) const;
744
749 {
752 PreviousResult
753 };
754
759 {
761 CaseInsensitive
762 };
763
768 {
769 NoSearchFlags = 0x00000000,
770 IgnoreCase = 0x00000001,
771 WholeWords = 0x00000002,
772 IgnoreDiacritics = 0x00000004,
775 AcrossLines = 0x00000008
778 };
779 Q_DECLARE_FLAGS(SearchFlags, SearchFlag)
780
781
792 Q_DECL_DEPRECATED bool search(const QString &text, double &rectLeft, double &rectTop, double &rectRight, double &rectBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
793
806 bool search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
807
819 Q_DECL_DEPRECATED QList<QRectF> search(const QString &text, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
820
835 QList<QRectF> search(const QString &text, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
836
853 QList<TextBox *> textList(Rotation rotate = Rotate0) const;
854
879 QList<TextBox *> textList(Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const;
880
884 QSizeF pageSizeF() const;
885
889 QSize pageSize() const;
890
901 PageTransition *transition() const;
902
908 Link *action(PageAction act) const;
909
920
925
929 void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown);
930
934 QList<Link *> links() const;
935
944 QList<Annotation *> annotations() const;
945
958 QList<Annotation *> annotations(const QSet<Annotation::SubType> &subtypes) const;
959
967 void addAnnotation(const Annotation *ann);
968
975 void removeAnnotation(const Annotation *ann);
976
983 QList<FormField *> formFields() const;
984
992 double duration() const;
993
999 QString label() const;
1000
1006 int index() const;
1007
1008private:
1009 Q_DISABLE_COPY(Page)
1010
1011 Page(DocumentData *doc, int index);
1012 PageData *m_page;
1013};
1014
1022class POPPLER_QT5_EXPORT OutlineItem
1023{
1024 friend class Document;
1025
1026public:
1031 ~OutlineItem();
1032
1033 OutlineItem(const OutlineItem &other);
1034 OutlineItem &operator=(const OutlineItem &other);
1035
1036 OutlineItem(OutlineItem &&other) noexcept;
1037 OutlineItem &operator=(OutlineItem &&other) noexcept;
1038
1042 bool isNull() const;
1043
1047 QString name() const;
1048
1052 bool isOpen() const;
1053
1059 QSharedPointer<const LinkDestination> destination() const;
1060
1066 QString externalFileName() const;
1067
1073 QString uri() const;
1074
1080 bool hasChildren() const;
1081
1087 QVector<OutlineItem> children() const;
1088
1089private:
1090 explicit OutlineItem(OutlineItemData *data);
1091 OutlineItemData *m_data;
1092};
1093
1144class POPPLER_QT5_EXPORT Document
1145{
1146 friend class Page;
1147 friend class DocumentData;
1148
1149public:
1162
1176
1183 {
1186 QPainterBackend = ArthurBackend
1188
1195 {
1196 Antialiasing = 0x00000001,
1197 TextAntialiasing = 0x00000002,
1198 TextHinting = 0x00000004,
1199 TextSlightHinting = 0x00000008,
1200 OverprintPreview = 0x00000010,
1201 ThinLineSolid = 0x00000020,
1202 ThinLineShape = 0x00000040,
1203 IgnorePaperColor = 0x00000080,
1204 HideAnnotations = 0x00000100
1206 Q_DECLARE_FLAGS(RenderHints, RenderHint)
1207
1208
1214 {
1217 XfaForm
1219
1232 void setColorDisplayProfile(void *outputProfileA);
1242 void setColorDisplayProfileName(const QString &name);
1253 void *colorRgbProfile() const;
1264 void *colorDisplayProfile() const;
1265
1283 static Document *load(const QString &filePath, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1284
1309 static Document *load(QIODevice *device, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1310
1332 static Document *loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1333
1351 Page *page(int index) const;
1352
1365 Page *page(const QString &label) const;
1366
1370 int numPages() const;
1371
1378
1385
1392 Qt::LayoutDirection textDirection() const;
1393
1402 bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword);
1403
1407 bool isLocked() const;
1408
1424 QDateTime date(const QString &type) const;
1425
1431 bool setDate(const QString &key, const QDateTime &val);
1432
1436 QDateTime creationDate() const;
1437
1443 bool setCreationDate(const QDateTime &val);
1444
1448 QDateTime modificationDate() const;
1449
1455 bool setModificationDate(const QDateTime &val);
1456
1473 QString info(const QString &type) const;
1474
1480 bool setInfo(const QString &key, const QString &val);
1481
1485 QString title() const;
1486
1492 bool setTitle(const QString &val);
1493
1497 QString author() const;
1498
1504 bool setAuthor(const QString &val);
1505
1509 QString subject() const;
1510
1516 bool setSubject(const QString &val);
1517
1521 QString keywords() const;
1522
1528 bool setKeywords(const QString &val);
1529
1533 QString creator() const;
1534
1540 bool setCreator(const QString &val);
1541
1545 QString producer() const;
1546
1552 bool setProducer(const QString &val);
1553
1560
1564 QStringList infoKeys() const;
1565
1569 bool isEncrypted() const;
1570
1577 bool isLinearized() const;
1578
1583 bool okToPrint() const;
1584
1589 bool okToPrintHighRes() const;
1590
1598 bool okToChange() const;
1599
1604 bool okToCopy() const;
1605
1611 bool okToAddNotes() const;
1612
1620 bool okToFillForm() const;
1621
1628
1635
1643 bool okToAssemble() const;
1644
1659 Q_DECL_DEPRECATED void getPdfVersion(int *major, int *minor) const;
1660
1663 {
1664 int major;
1665 int minor;
1666 };
1667
1675
1687 QList<FontInfo> fonts() const;
1688
1704 FontIterator *newFontIterator(int startPage = 0) const;
1705
1711 QByteArray fontData(const FontInfo &fi) const;
1712
1719 QList<EmbeddedFile *> embeddedFiles() const;
1720
1724 bool hasEmbeddedFiles() const;
1725
1749 Q_DECL_DEPRECATED QDomDocument *toc() const;
1750
1758 QVector<OutlineItem> outline() const;
1759
1768 LinkDestination *linkDestination(const QString &name);
1769
1775 void setPaperColor(const QColor &color);
1781 QColor paperColor() const;
1782
1799
1805 static QSet<RenderBackend> availableRenderBackends();
1806
1816 void setRenderHint(RenderHint hint, bool on = true);
1822 RenderHints renderHints() const;
1823
1832
1841
1847 QString metadata() const;
1848
1862
1871
1880 QStringList scripts() const;
1881
1894 bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const;
1895
1902
1908 QVector<int> formCalculateOrder() const;
1909
1918 QVector<FormFieldSignature *> signatures() const;
1919
1926
1933 void setXRefReconstructedCallback(const std::function<void()> &callback);
1934
1939
1940private:
1941 Q_DISABLE_COPY(Document)
1942
1943 DocumentData *m_doc;
1944
1945 explicit Document(DocumentData *dataA);
1946};
1947
1948class BaseConverterPrivate;
1949class PSConverterPrivate;
1950class PDFConverterPrivate;
1958class POPPLER_QT5_EXPORT BaseConverter
1959{
1960 friend class Document;
1961
1962public:
1967
1969 void setOutputFileName(const QString &outputFileName);
1970
1976 void setOutputDevice(QIODevice *device);
1977
1983 virtual bool convert() = 0;
1984
1985 enum Error
1986 {
1987 NoError,
1988 FileLockedError,
1989 OpenOutputError,
1990 NotSupportedInputFileError
1991 };
1992
1997 Error lastError() const;
1998
1999protected:
2001 explicit BaseConverter(BaseConverterPrivate &dd);
2002 Q_DECLARE_PRIVATE(BaseConverter)
2003 BaseConverterPrivate *d_ptr;
2005
2006private:
2007 Q_DISABLE_COPY(BaseConverter)
2008};
2009
2026class POPPLER_QT5_EXPORT PSConverter : public BaseConverter
2027{
2028 friend class Document;
2029
2030public:
2037 {
2038 Printing = 0x00000001,
2039 StrictMargins = 0x00000002,
2040 ForceRasterization = 0x00000004,
2041 PrintToEPS = 0x00000008,
2042 HideAnnotations = 0x00000010,
2043 ForceOverprintPreview = 0x00000020
2045 Q_DECLARE_FLAGS(PSOptions, PSOption)
2046
2047
2050 ~PSConverter() override;
2051
2053 void setPageList(const QList<int> &pageList);
2054
2058 void setTitle(const QString &title);
2059
2063 void setHDPI(double hDPI);
2064
2068 void setVDPI(double vDPI);
2069
2073 void setRotate(int rotate);
2074
2078 void setPaperWidth(int paperWidth);
2079
2083 void setPaperHeight(int paperHeight);
2084
2088 void setRightMargin(int marginRight);
2089
2093 void setBottomMargin(int marginBottom);
2094
2098 void setLeftMargin(int marginLeft);
2099
2103 void setTopMargin(int marginTop);
2104
2112 void setStrictMargins(bool strictMargins);
2113
2122 void setForceOverprintPreview(bool forceOverprintPreview);
2123
2125 void setForceRasterize(bool forceRasterize);
2126
2132 void setPSOptions(PSOptions options);
2133
2141 PSOptions psOptions() const;
2142
2150 void setPageConvertedCallback(void (*callback)(int page, void *payload), void *payload);
2151
2152 bool convert() override;
2153
2154private:
2155 Q_DECLARE_PRIVATE(PSConverter)
2156 Q_DISABLE_COPY(PSConverter)
2157
2158 explicit PSConverter(DocumentData *document);
2159};
2160
2166class POPPLER_QT5_EXPORT PDFConverter : public BaseConverter
2167{
2168 friend class Document;
2169
2170public:
2175 {
2176 WithChanges = 0x00000001
2178 Q_DECLARE_FLAGS(PDFOptions, PDFOption)
2179
2180
2183 ~PDFConverter() override;
2184
2188 void setPDFOptions(PDFOptions options);
2192 PDFOptions pdfOptions() const;
2193
2206 class POPPLER_QT5_EXPORT NewSignatureData
2207 {
2208 public:
2211 NewSignatureData(const NewSignatureData &) = delete;
2212 NewSignatureData &operator=(const NewSignatureData &) = delete;
2213
2214 QString certNickname() const;
2215 void setCertNickname(const QString &certNickname);
2216
2217 QString password() const;
2218 void setPassword(const QString &password);
2219
2220 int page() const;
2221 void setPage(int page);
2222
2223 QRectF boundingRectangle() const;
2224 void setBoundingRectangle(const QRectF &rect);
2225
2226 QString signatureText() const;
2227 void setSignatureText(const QString &text);
2228
2236 QString signatureLeftText() const;
2237 void setSignatureLeftText(const QString &text);
2238
2246 QString reason() const;
2247 void setReason(const QString &reason);
2248
2256 QString location() const;
2257 void setLocation(const QString &location);
2258
2262 double fontSize() const;
2263 void setFontSize(double fontSize);
2264
2270 double leftFontSize() const;
2271 void setLeftFontSize(double fontSize);
2272
2276 QColor fontColor() const;
2277 void setFontColor(const QColor &color);
2278
2282 QColor borderColor() const;
2283 void setBorderColor(const QColor &color);
2284
2292 double borderWidth() const;
2293 void setBorderWidth(double width);
2294
2298 QColor backgroundColor() const;
2299 void setBackgroundColor(const QColor &color);
2300
2304 QString fieldPartialName() const;
2305 void setFieldPartialName(const QString &name);
2306
2314 QByteArray documentOwnerPassword() const;
2315 void setDocumentOwnerPassword(const QByteArray &password);
2316
2324 QByteArray documentUserPassword() const;
2325 void setDocumentUserPassword(const QByteArray &password);
2326
2335 QString imagePath() const;
2336 void setImagePath(const QString &path);
2337
2338 private:
2339 struct NewSignatureDataPrivate;
2340 NewSignatureDataPrivate *const d;
2341 };
2342
2352 bool sign(const NewSignatureData &data);
2353
2354 bool convert() override;
2355
2356private:
2357 Q_DECLARE_PRIVATE(PDFConverter)
2358 Q_DISABLE_COPY(PDFConverter)
2359
2360 explicit PDFConverter(DocumentData *document);
2361};
2362
2366POPPLER_QT5_EXPORT Q_DECL_DEPRECATED QDateTime convertDate(char *dateString);
2367
2373POPPLER_QT5_EXPORT QDateTime convertDate(const char *dateString);
2374
2380POPPLER_QT5_EXPORT bool isCmsAvailable();
2381
2387POPPLER_QT5_EXPORT bool isOverprintPreviewAvailable();
2388
2389class SoundData;
2399class POPPLER_QT5_EXPORT SoundObject
2400{
2401public:
2406 {
2408 Embedded
2410
2421
2423 explicit SoundObject(Sound *popplersound);
2425
2426 ~SoundObject();
2427
2432
2436 QString url() const;
2437
2441 QByteArray data() const;
2442
2446 double samplingRate() const;
2447
2451 int channels() const;
2452
2456 int bitsPerSample() const;
2457
2462
2463private:
2464 Q_DISABLE_COPY(SoundObject)
2465
2466 SoundData *m_soundData;
2467};
2468
2469class MovieData;
2475class POPPLER_QT5_EXPORT MovieObject
2476{
2477 friend class AnnotationPrivate;
2478
2479public:
2484 {
2488 PlayPalindrome
2490
2491 ~MovieObject();
2492
2496 QString url() const;
2497
2501 QSize size() const;
2502
2506 int rotation() const;
2507
2511 bool showControls() const;
2512
2517
2522 bool showPosterImage() const;
2523
2530 QImage posterImage() const;
2531
2532private:
2534 explicit MovieObject(AnnotMovie *ann);
2536
2537 Q_DISABLE_COPY(MovieObject)
2538
2539 MovieData *m_movieData;
2540};
2541
2542}
2543
2544Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::PainterFlags)
2545Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::SearchFlags)
2546Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints)
2547Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PDFConverter::PDFOptions)
2548Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PSConverter::PSOptions)
2549
2550#endif
Annotation class holding properties shared by all annotations.
Definition poppler-annotation.h:203
Base converter.
Definition poppler-qt5.h:1959
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-qt5.h:1145
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.
bool setTitle(const QString &val)
Set the title of the document to.
static Document * load(const QString &filePath, const QByteArray &ownerPassword=QByteArray(), const QByteArray &userPassword=QByteArray())
Load the document from a file on disk.
bool okToChange() const
Test if the permissions on the document allow it to be changed.
QString title() const
The title of the document.
bool okToCreateFormFields() const
Test if the permissions on the document allow interactive form fields (including signature fields) to...
PDFConverter * pdfConverter() const
Gets a new PDF converter for this document.
void getPdfVersion(int *major, int *minor) const
The version of the PDF specification that the document conforms to.
bool isLocked() const
Determine if the document is locked.
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-qt5.h:1167
@ TwoPageLeft
Display the pages two at a time, with odd-numbered pages on the left.
Definition poppler-qt5.h:1173
@ TwoColumnLeft
Display the pages in two columns, with odd-numbered pages on the left.
Definition poppler-qt5.h:1171
@ SinglePage
Display a single page.
Definition poppler-qt5.h:1169
@ NoLayout
Layout not specified.
Definition poppler-qt5.h:1168
@ TwoColumnRight
Display the pages in two columns, with odd-numbered pages on the right.
Definition poppler-qt5.h:1172
@ OneColumn
Display a single column of pages.
Definition poppler-qt5.h:1170
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,...
Page * page(const QString &label) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QDateTime creationDate() const
The date of the creation of the document.
bool setCreator(const QString &val)
Set the creator of the document to.
QDomDocument * toc() const
Gets the table of contents (TOC) of the Document.
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-qt5.h:1183
@ ArthurBackend
Definition poppler-qt5.h:1185
@ SplashBackend
Splash backend.
Definition poppler-qt5.h:1184
static Document * loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword=QByteArray(), const QByteArray &userPassword=QByteArray())
Load the document from memory.
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.
bool setDate(const QString &key, const QDateTime &val)
Set the Info dict date entry specified by.
PageMode
The page mode.
Definition poppler-qt5.h:1154
@ UseOutlines
Document outline visible.
Definition poppler-qt5.h:1156
@ UseNone
No mode - neither document outline nor thumbnail images are visible.
Definition poppler-qt5.h:1155
@ UseThumbs
Thumbnail images visible.
Definition poppler-qt5.h:1157
@ FullScreen
Fullscreen mode (no menubar, windows controls etc)
Definition poppler-qt5.h:1158
@ UseOC
Optional content group panel visible.
Definition poppler-qt5.h:1159
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.
RenderHint
The render hints available.
Definition poppler-qt5.h:1195
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.
QVector< FormFieldSignature * > signatures() const
Returns the signatures of this document.
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.
FontIterator * newFontIterator(int startPage=0) const
Creates a new FontIterator object for font scanning.
QString producer() const
The producer of the document.
PSConverter * psConverter() const
Gets a new PS converter for 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-qt5.h:1214
@ AcroForm
AcroForm.
Definition poppler-qt5.h:1216
@ NoForm
Document doesn't contain forms.
Definition poppler-qt5.h:1215
bool setCreationDate(const QDateTime &val)
Set the creation date of the document to.
static Document * load(QIODevice *device, const QByteArray &ownerPassword=QByteArray(), const QByteArray &userPassword=QByteArray())
Load the document from a device.
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.
LinkDestination * linkDestination(const QString &name)
Tries to resolve the named destination name.
bool okToPrint() const
Test if the permissions on the document allow it to be printed.
Page * page(int index) const
Get a specified Page.
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-qt5.h:345
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-qt5.h:180
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-qt5.h:188
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-qt5.h:306
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 destination.
Definition poppler-link.h:69
Container class for a movie object in a PDF document.
Definition poppler-qt5.h:2476
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-qt5.h:2484
@ PlayRepeat
Play continuously until stopped.
Definition poppler-qt5.h:2487
@ PlayOnce
Play the movie once, closing the movie controls at the end.
Definition poppler-qt5.h:2485
@ PlayOpen
Like PlayOnce, but leaving the controls open.
Definition poppler-qt5.h:2486
PlayMode playMode() const
How to play the movie.
Model for optional content.
Definition poppler-optcontent.h:49
Item in the outline of a PDF document.
Definition poppler-qt5.h:1023
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-qt5.h:2207
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-qt5.h:2167
bool convert() override
Does the conversion.
PDFOption
Options for the PDF export.
Definition poppler-qt5.h:2175
~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-qt5.h:2027
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-qt5.h:2037
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-qt5.h:435
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-qt5.h:551
QList< Link * > links() const
Gets the links of the page.
Orientation
Types of orientations that are possible.
Definition poppler-qt5.h:914
@ Seascape
Seascape orientation (portrait, with 270 degrees clockwise rotation)
Definition poppler-qt5.h:917
@ Landscape
Landscape orientation (portrait, with 90 degrees clockwise rotation )
Definition poppler-qt5.h:915
@ Portrait
Normal portrait orientation.
Definition poppler-qt5.h:916
SearchFlag
Flags to modify the search behaviour.
Definition poppler-qt5.h:768
void addAnnotation(const Annotation *ann)
Adds an annotation to the page.
QList< Annotation * > annotations(const QSet< Annotation::SubType > &subtypes) const
Returns the annotations of the page.
int index() const
Returns the index of the page.
SearchDirection
The starting point for a search.
Definition poppler-qt5.h:749
@ FromTop
Start sorting at the top of the document.
Definition poppler-qt5.h:750
@ NextResult
Find the next result, moving "down the page".
Definition poppler-qt5.h:751
PainterFlag
Additional flags for the renderToPainter method.
Definition poppler-qt5.h:479
QList< FormField * > formFields() const
Returns the form fields on the page The caller gets the ownership of the returned objects.
Rotation
The type of rotation to apply for an operation.
Definition poppler-qt5.h:448
~Page()
Destructor.
Orientation orientation() const
The orientation of the page.
SearchMode
The type of search to perform.
Definition poppler-qt5.h:759
@ CaseSensitive
Case differences cause no match in searching.
Definition poppler-qt5.h:760
TextLayout
How the text is going to be returned.
Definition poppler-qt5.h:469
@ PhysicalLayout
The text is layouted to resemble the real page layout.
Definition poppler-qt5.h:470
PageAction
The kinds of page actions.
Definition poppler-qt5.h:459
@ Opening
The action when a page is "opened".
Definition poppler-qt5.h:460
double duration() const
Returns the page duration.
void(*)(const QImage &, const QVariant &) RenderToImagePartialUpdateFunc
Partial Update renderToImage callback.
Definition poppler-qt5.h:541
QString label() const
Returns the label of the page, or a null string is the page has no label.
QList< Annotation * > annotations() const
Returns the annotations of the page.
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-qt5.h:612
Container class for a sound file in a PDF document.
Definition poppler-qt5.h:2400
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-qt5.h:2415
@ muLaw
mu-law-encoded samples
Definition poppler-qt5.h:2418
@ Signed
Twos-complement values.
Definition poppler-qt5.h:2417
@ Raw
Raw encoding, with unspecified or unsigned values in the range [ 0, 2^B - 1 ].
Definition poppler-qt5.h:2416
SoundType
The type of sound.
Definition poppler-qt5.h:2406
@ External
The real sound file is external.
Definition poppler-qt5.h:2407
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-qt5.h:123
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 Qt5 binding.
Definition poppler-annotation.h:50
QDateTime convertDate(char *dateString)
Conversion from PDF date string format to QDateTime.
void(*)(const QString &, const QVariant &) PopplerDebugFunc
Debug/error function.
Definition poppler-qt5.h:98
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-qt5.h:1663