Poppler Qt5 24.12.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 * 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
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/QSet>
63#include <QtXml/QDomDocument>
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
99using PopplerDebugFunc = void (*)(const QString & /*message*/, const QVariant & /*closure*/);
100
112POPPLER_QT5_EXPORT void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure);
113
123class POPPLER_QT5_EXPORT TextBox
124{
125 friend class Page;
126
127public:
133 TextBox(const QString &text, const QRectF &bBox);
138
142 QString text() const;
143
150 QRectF boundingBox() const;
151
158
162 QRectF charBoundingBox(int i) const;
163
167 bool hasSpaceAfter() const;
168
169private:
170 Q_DISABLE_COPY(TextBox)
171
172 TextBoxData *m_data;
173};
174
175class FontInfoData;
180class POPPLER_QT5_EXPORT FontInfo
181{
182 friend class Document;
183
184public:
188 enum Type
189 {
190 unknown,
191 Type1,
192 Type1C,
193 Type1COT,
194 Type3,
195 TrueType,
196 TrueTypeOT,
197 CIDType0,
198 CIDType0C,
199 CIDType0COT,
200 CIDTrueType,
201 CIDTrueTypeOT
202 };
203
205
208 FontInfo();
209
213 explicit FontInfo(const FontInfoData &fid);
215
219 FontInfo(const FontInfo &fi);
220
225
229 QString name() const;
230
235 QString substituteName() const;
236
241 QString file() const;
242
248 bool isEmbedded() const;
249
256 bool isSubset() const;
257
265 Type type() const;
266
275 QString typeName() const;
276
281
282private:
283 FontInfoData *m_data;
284};
285
286class FontIteratorData;
306class POPPLER_QT5_EXPORT FontIterator
307{
308 friend class Document;
309 friend class DocumentData;
310
311public:
316
321 QList<FontInfo> next();
322
327 bool hasNext() const;
328
332 int currentPage() const;
333
334private:
335 Q_DISABLE_COPY(FontIterator)
336 FontIterator(int, DocumentData *dd);
337
338 FontIteratorData *d;
339};
340
341class EmbeddedFileData;
345class POPPLER_QT5_EXPORT EmbeddedFile
346{
347 friend class DocumentData;
348 friend class AnnotationPrivate;
349
350public:
352 explicit EmbeddedFile(EmbFile *embfile);
354
359
363 QString name() const;
364
370 QString description() const;
371
377 int size() const;
378
382 QDateTime modDate() const;
383
387 QDateTime createDate() const;
388
394 QByteArray checksum() const;
395
401 QString mimeType() const;
402
406 QByteArray data();
407
413 bool isValid() const;
414
418 // QDataStream dataStream() const;
419
420private:
421 Q_DISABLE_COPY(EmbeddedFile)
422 explicit EmbeddedFile(EmbeddedFileData &dd);
423
424 EmbeddedFileData *m_embeddedFile;
425};
426
435class POPPLER_QT5_EXPORT Page
436{
437 friend class Document;
438
439public:
444
449 {
450 Rotate0 = 0,
451 Rotate90 = 1,
452 Rotate180 = 2,
453 Rotate270 = 3
454 };
455
460 {
462 Closing
463 };
464
470 {
472 RawOrderLayout
473 };
474
480 {
481 NoPainterFlags = 0x00000000,
489 DontSaveAndRestore = 0x00000001
490 };
491 Q_DECLARE_FLAGS(PainterFlags, PainterFlag)
492
493
531 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;
532
542 using RenderToImagePartialUpdateFunc = void (*)(const QImage & /*image*/, const QVariant & /*closure*/);
543
552 using ShouldRenderToImagePartialQueryFunc = bool (*)(const QVariant & /*closure*/);
553
603 QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
604 const QVariant &payload) const;
605
613 using ShouldAbortQueryFunc = bool (*)(const QVariant & /*closure*/);
614
668 QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
669 ShouldAbortQueryFunc shouldAbortRenderCallback, const QVariant &payload) const;
670
713 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;
714
723 QImage thumbnail() const;
724
734 QString text(const QRectF &rect, TextLayout textLayout) const;
735
744 QString text(const QRectF &rect) const;
745
750 {
753 PreviousResult
754 };
755
760 {
762 CaseInsensitive
763 };
764
769 {
770 NoSearchFlags = 0x00000000,
771 IgnoreCase = 0x00000001,
772 WholeWords = 0x00000002,
773 IgnoreDiacritics = 0x00000004,
776 AcrossLines = 0x00000008
779 };
780 Q_DECLARE_FLAGS(SearchFlags, SearchFlag)
781
782
793 Q_DECL_DEPRECATED bool search(const QString &text, double &rectLeft, double &rectTop, double &rectRight, double &rectBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
794
807 bool search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
808
820 Q_DECL_DEPRECATED QList<QRectF> search(const QString &text, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
821
836 QList<QRectF> search(const QString &text, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
837
854 QList<TextBox *> textList(Rotation rotate = Rotate0) const;
855
880 QList<TextBox *> textList(Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const;
881
885 QSizeF pageSizeF() const;
886
890 QSize pageSize() const;
891
902 PageTransition *transition() const;
903
909 Link *action(PageAction act) const;
910
921
926
930 void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown);
931
935 QList<Link *> links() const;
936
945 QList<Annotation *> annotations() const;
946
959 QList<Annotation *> annotations(const QSet<Annotation::SubType> &subtypes) const;
960
968 void addAnnotation(const Annotation *ann);
969
976 void removeAnnotation(const Annotation *ann);
977
984 QList<FormField *> formFields() const;
985
993 double duration() const;
994
1000 QString label() const;
1001
1007 int index() const;
1008
1009private:
1010 Q_DISABLE_COPY(Page)
1011
1012 Page(DocumentData *doc, int index);
1013 PageData *m_page;
1014};
1015
1023class POPPLER_QT5_EXPORT OutlineItem
1024{
1025 friend class Document;
1026
1027public:
1032 ~OutlineItem();
1033
1034 OutlineItem(const OutlineItem &other);
1035 OutlineItem &operator=(const OutlineItem &other);
1036
1037 OutlineItem(OutlineItem &&other) noexcept;
1038 OutlineItem &operator=(OutlineItem &&other) noexcept;
1039
1043 bool isNull() const;
1044
1048 QString name() const;
1049
1053 bool isOpen() const;
1054
1060 QSharedPointer<const LinkDestination> destination() const;
1061
1067 QString externalFileName() const;
1068
1074 QString uri() const;
1075
1081 bool hasChildren() const;
1082
1088 QVector<OutlineItem> children() const;
1089
1090private:
1091 explicit OutlineItem(OutlineItemData *data);
1092 OutlineItemData *m_data;
1093};
1094
1145class POPPLER_QT5_EXPORT Document
1146{
1147 friend class Page;
1148 friend class DocumentData;
1149
1150public:
1163
1177
1184 {
1187 QPainterBackend = ArthurBackend
1189
1196 {
1197 Antialiasing = 0x00000001,
1198 TextAntialiasing = 0x00000002,
1199 TextHinting = 0x00000004,
1200 TextSlightHinting = 0x00000008,
1201 OverprintPreview = 0x00000010,
1202 ThinLineSolid = 0x00000020,
1203 ThinLineShape = 0x00000040,
1204 IgnorePaperColor = 0x00000080,
1205 HideAnnotations = 0x00000100
1207 Q_DECLARE_FLAGS(RenderHints, RenderHint)
1208
1209
1215 {
1218 XfaForm
1220
1233 void setColorDisplayProfile(void *outputProfileA);
1243 void setColorDisplayProfileName(const QString &name);
1254 void *colorRgbProfile() const;
1265 void *colorDisplayProfile() const;
1266
1284 static Document *load(const QString &filePath, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1285
1310 static Document *load(QIODevice *device, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1311
1333 static Document *loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1334
1352 Page *page(int index) const;
1353
1366 Page *page(const QString &label) const;
1367
1371 int numPages() const;
1372
1379
1386
1393 Qt::LayoutDirection textDirection() const;
1394
1403 bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword);
1404
1408 bool isLocked() const;
1409
1425 QDateTime date(const QString &type) const;
1426
1432 bool setDate(const QString &key, const QDateTime &val);
1433
1437 QDateTime creationDate() const;
1438
1444 bool setCreationDate(const QDateTime &val);
1445
1449 QDateTime modificationDate() const;
1450
1456 bool setModificationDate(const QDateTime &val);
1457
1474 QString info(const QString &type) const;
1475
1481 bool setInfo(const QString &key, const QString &val);
1482
1486 QString title() const;
1487
1493 bool setTitle(const QString &val);
1494
1498 QString author() const;
1499
1505 bool setAuthor(const QString &val);
1506
1510 QString subject() const;
1511
1517 bool setSubject(const QString &val);
1518
1522 QString keywords() const;
1523
1529 bool setKeywords(const QString &val);
1530
1534 QString creator() const;
1535
1541 bool setCreator(const QString &val);
1542
1546 QString producer() const;
1547
1553 bool setProducer(const QString &val);
1554
1561
1565 QStringList infoKeys() const;
1566
1570 bool isEncrypted() const;
1571
1578 bool isLinearized() const;
1579
1584 bool okToPrint() const;
1585
1590 bool okToPrintHighRes() const;
1591
1599 bool okToChange() const;
1600
1605 bool okToCopy() const;
1606
1612 bool okToAddNotes() const;
1613
1621 bool okToFillForm() const;
1622
1629
1636
1644 bool okToAssemble() const;
1645
1660 Q_DECL_DEPRECATED void getPdfVersion(int *major, int *minor) const;
1661
1664 {
1665 int major;
1666 int minor;
1667 };
1668
1676
1688 QList<FontInfo> fonts() const;
1689
1705 FontIterator *newFontIterator(int startPage = 0) const;
1706
1712 QByteArray fontData(const FontInfo &fi) const;
1713
1720 QList<EmbeddedFile *> embeddedFiles() const;
1721
1725 bool hasEmbeddedFiles() const;
1726
1750 Q_DECL_DEPRECATED QDomDocument *toc() const;
1751
1759 QVector<OutlineItem> outline() const;
1760
1769 LinkDestination *linkDestination(const QString &name);
1770
1776 void setPaperColor(const QColor &color);
1782 QColor paperColor() const;
1783
1800
1806 static QSet<RenderBackend> availableRenderBackends();
1807
1817 void setRenderHint(RenderHint hint, bool on = true);
1823 RenderHints renderHints() const;
1824
1833
1842
1848 QString metadata() const;
1849
1863
1872
1879
1888 QStringList scripts() const;
1889
1906
1914
1927 bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const;
1928
1935
1941 QVector<int> formCalculateOrder() const;
1942
1951 QVector<FormFieldSignature *> signatures() const;
1952
1959
1966 void setXRefReconstructedCallback(const std::function<void()> &callback);
1967
1972
1973private:
1974 Q_DISABLE_COPY(Document)
1975
1976 DocumentData *m_doc;
1977
1978 explicit Document(DocumentData *dataA);
1979};
1980
1981class BaseConverterPrivate;
1982class PSConverterPrivate;
1983class PDFConverterPrivate;
1991class POPPLER_QT5_EXPORT BaseConverter
1992{
1993 friend class Document;
1994
1995public:
2000
2002 void setOutputFileName(const QString &outputFileName);
2003
2009 void setOutputDevice(QIODevice *device);
2010
2016 virtual bool convert() = 0;
2017
2018 enum Error
2019 {
2020 NoError,
2021 FileLockedError,
2022 OpenOutputError,
2023 NotSupportedInputFileError
2024 };
2025
2030 Error lastError() const;
2031
2032protected:
2034 explicit BaseConverter(BaseConverterPrivate &dd);
2035 Q_DECLARE_PRIVATE(BaseConverter)
2036 BaseConverterPrivate *d_ptr;
2038
2039private:
2040 Q_DISABLE_COPY(BaseConverter)
2041};
2042
2059class POPPLER_QT5_EXPORT PSConverter : public BaseConverter
2060{
2061 friend class Document;
2062
2063public:
2070 {
2071 Printing = 0x00000001,
2072 StrictMargins = 0x00000002,
2073 ForceRasterization = 0x00000004,
2074 PrintToEPS = 0x00000008,
2075 HideAnnotations = 0x00000010,
2076 ForceOverprintPreview = 0x00000020
2078 Q_DECLARE_FLAGS(PSOptions, PSOption)
2079
2080
2083 ~PSConverter() override;
2084
2086 void setPageList(const QList<int> &pageList);
2087
2091 void setTitle(const QString &title);
2092
2096 void setHDPI(double hDPI);
2097
2101 void setVDPI(double vDPI);
2102
2106 void setRotate(int rotate);
2107
2111 void setPaperWidth(int paperWidth);
2112
2116 void setPaperHeight(int paperHeight);
2117
2121 void setRightMargin(int marginRight);
2122
2126 void setBottomMargin(int marginBottom);
2127
2131 void setLeftMargin(int marginLeft);
2132
2136 void setTopMargin(int marginTop);
2137
2145 void setStrictMargins(bool strictMargins);
2146
2155 void setForceOverprintPreview(bool forceOverprintPreview);
2156
2158 void setForceRasterize(bool forceRasterize);
2159
2165 void setPSOptions(PSOptions options);
2166
2174 PSOptions psOptions() const;
2175
2183 void setPageConvertedCallback(void (*callback)(int page, void *payload), void *payload);
2184
2185 bool convert() override;
2186
2187private:
2188 Q_DECLARE_PRIVATE(PSConverter)
2189 Q_DISABLE_COPY(PSConverter)
2190
2191 explicit PSConverter(DocumentData *document);
2192};
2193
2199class POPPLER_QT5_EXPORT PDFConverter : public BaseConverter
2200{
2201 friend class Document;
2202
2203public:
2208 {
2209 WithChanges = 0x00000001
2211 Q_DECLARE_FLAGS(PDFOptions, PDFOption)
2212
2213
2216 ~PDFConverter() override;
2217
2221 void setPDFOptions(PDFOptions options);
2225 PDFOptions pdfOptions() const;
2226
2239 class POPPLER_QT5_EXPORT NewSignatureData
2240 {
2241 public:
2244 NewSignatureData(const NewSignatureData &) = delete;
2245 NewSignatureData &operator=(const NewSignatureData &) = delete;
2246
2247 QString certNickname() const;
2248 void setCertNickname(const QString &certNickname);
2249
2250 QString password() const;
2251 void setPassword(const QString &password);
2252
2253 int page() const;
2254 void setPage(int page);
2255
2256 QRectF boundingRectangle() const;
2257 void setBoundingRectangle(const QRectF &rect);
2258
2259 QString signatureText() const;
2260 void setSignatureText(const QString &text);
2261
2269 QString signatureLeftText() const;
2270 void setSignatureLeftText(const QString &text);
2271
2279 QString reason() const;
2280 void setReason(const QString &reason);
2281
2289 QString location() const;
2290 void setLocation(const QString &location);
2291
2295 double fontSize() const;
2296 void setFontSize(double fontSize);
2297
2303 double leftFontSize() const;
2304 void setLeftFontSize(double fontSize);
2305
2309 QColor fontColor() const;
2310 void setFontColor(const QColor &color);
2311
2315 QColor borderColor() const;
2316 void setBorderColor(const QColor &color);
2317
2325 double borderWidth() const;
2326 void setBorderWidth(double width);
2327
2331 QColor backgroundColor() const;
2332 void setBackgroundColor(const QColor &color);
2333
2337 QString fieldPartialName() const;
2338 void setFieldPartialName(const QString &name);
2339
2347 QByteArray documentOwnerPassword() const;
2348 void setDocumentOwnerPassword(const QByteArray &password);
2349
2357 QByteArray documentUserPassword() const;
2358 void setDocumentUserPassword(const QByteArray &password);
2359
2368 QString imagePath() const;
2369 void setImagePath(const QString &path);
2370
2371 private:
2372 struct NewSignatureDataPrivate;
2373 NewSignatureDataPrivate *const d;
2374 };
2375
2385 bool sign(const NewSignatureData &data);
2386
2387 bool convert() override;
2388
2389private:
2390 Q_DECLARE_PRIVATE(PDFConverter)
2391 Q_DISABLE_COPY(PDFConverter)
2392
2393 explicit PDFConverter(DocumentData *document);
2394};
2395
2399POPPLER_QT5_EXPORT Q_DECL_DEPRECATED QDateTime convertDate(char *dateString);
2400
2406POPPLER_QT5_EXPORT QDateTime convertDate(const char *dateString);
2407
2413POPPLER_QT5_EXPORT bool isCmsAvailable();
2414
2420POPPLER_QT5_EXPORT bool isOverprintPreviewAvailable();
2421
2422class SoundData;
2432class POPPLER_QT5_EXPORT SoundObject
2433{
2434public:
2439 {
2441 Embedded
2443
2454
2456 explicit SoundObject(Sound *popplersound);
2458
2459 ~SoundObject();
2460
2465
2469 QString url() const;
2470
2474 QByteArray data() const;
2475
2479 double samplingRate() const;
2480
2484 int channels() const;
2485
2489 int bitsPerSample() const;
2490
2495
2496private:
2497 Q_DISABLE_COPY(SoundObject)
2498
2499 SoundData *m_soundData;
2500};
2501
2502class MovieData;
2508class POPPLER_QT5_EXPORT MovieObject
2509{
2510 friend class AnnotationPrivate;
2511
2512public:
2517 {
2521 PlayPalindrome
2523
2524 ~MovieObject();
2525
2529 QString url() const;
2530
2534 QSize size() const;
2535
2539 int rotation() const;
2540
2544 bool showControls() const;
2545
2550
2555 bool showPosterImage() const;
2556
2563 QImage posterImage() const;
2564
2565private:
2567 explicit MovieObject(AnnotMovie *ann);
2569
2570 Q_DISABLE_COPY(MovieObject)
2571
2572 MovieData *m_movieData;
2573};
2574
2575}
2576
2577Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::PainterFlags)
2578Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::SearchFlags)
2579Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints)
2580Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PDFConverter::PDFOptions)
2581Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PSConverter::PSOptions)
2582
2583#endif
Annotation class holding properties shared by all annotations.
Definition poppler-annotation.h:203
Base converter.
Definition poppler-qt5.h:1992
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:1146
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:1168
@ TwoPageLeft
Display the pages two at a time, with odd-numbered pages on the left.
Definition poppler-qt5.h:1174
@ TwoColumnLeft
Display the pages in two columns, with odd-numbered pages on the left.
Definition poppler-qt5.h:1172
@ SinglePage
Display a single page.
Definition poppler-qt5.h:1170
@ NoLayout
Layout not specified.
Definition poppler-qt5.h:1169
@ TwoColumnRight
Display the pages in two columns, with odd-numbered pages on the right.
Definition poppler-qt5.h:1173
@ OneColumn
Display a single column of pages.
Definition poppler-qt5.h:1171
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:1184
@ ArthurBackend
Definition poppler-qt5.h:1186
@ SplashBackend
Splash backend.
Definition poppler-qt5.h:1185
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:1155
@ UseOutlines
Document outline visible.
Definition poppler-qt5.h:1157
@ UseNone
No mode - neither document outline nor thumbnail images are visible.
Definition poppler-qt5.h:1156
@ UseThumbs
Thumbnail images visible.
Definition poppler-qt5.h:1158
@ FullScreen
Fullscreen mode (no menubar, windows controls etc)
Definition poppler-qt5.h:1159
@ UseOC
Optional content group panel visible.
Definition poppler-qt5.h:1160
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:1196
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-qt5.h:1899
@ CloseDocument
Performed before closing the document.
Definition poppler-qt5.h:1900
@ PrintDocumentStart
Performed before printing the document.
Definition poppler-qt5.h:1903
@ PrintDocumentFinish
Performed after printing the document.
Definition poppler-qt5.h:1904
@ SaveDocumentFinish
Performed after saving the document.
Definition poppler-qt5.h:1902
@ SaveDocumentStart
Performed before saving the document.
Definition poppler-qt5.h:1901
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.
Link * additionalAction(DocumentAdditionalActionsType type) const
Returns the additional action of the given type for the document or 0 if no action has been defined.
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.
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:1215
@ AcroForm
AcroForm.
Definition poppler-qt5.h:1217
@ NoForm
Document doesn't contain forms.
Definition poppler-qt5.h:1216
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:346
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:181
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:189
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:307
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:74
ResetForm: an action to reset form fields.
Definition poppler-link.h:708
Container class for a movie object in a PDF document.
Definition poppler-qt5.h:2509
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:2517
@ PlayRepeat
Play continuously until stopped.
Definition poppler-qt5.h:2520
@ PlayOnce
Play the movie once, closing the movie controls at the end.
Definition poppler-qt5.h:2518
@ PlayOpen
Like PlayOnce, but leaving the controls open.
Definition poppler-qt5.h:2519
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:1024
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:2240
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:2200
bool convert() override
Does the conversion.
PDFOption
Options for the PDF export.
Definition poppler-qt5.h:2208
~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:2060
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:2070
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:436
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:552
QList< Link * > links() const
Gets the links of the page.
Orientation
Types of orientations that are possible.
Definition poppler-qt5.h:915
@ Seascape
Seascape orientation (portrait, with 270 degrees clockwise rotation)
Definition poppler-qt5.h:918
@ Landscape
Landscape orientation (portrait, with 90 degrees clockwise rotation )
Definition poppler-qt5.h:916
@ Portrait
Normal portrait orientation.
Definition poppler-qt5.h:917
SearchFlag
Flags to modify the search behaviour.
Definition poppler-qt5.h:769
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:750
@ FromTop
Start sorting at the top of the document.
Definition poppler-qt5.h:751
@ NextResult
Find the next result, moving "down the page".
Definition poppler-qt5.h:752
PainterFlag
Additional flags for the renderToPainter method.
Definition poppler-qt5.h:480
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:449
~Page()
Destructor.
Orientation orientation() const
The orientation of the page.
SearchMode
The type of search to perform.
Definition poppler-qt5.h:760
@ CaseSensitive
Case differences cause no match in searching.
Definition poppler-qt5.h:761
TextLayout
How the text is going to be returned.
Definition poppler-qt5.h:470
@ PhysicalLayout
The text is layouted to resemble the real page layout.
Definition poppler-qt5.h:471
PageAction
The kinds of page actions.
Definition poppler-qt5.h:460
@ Opening
The action when a page is "opened".
Definition poppler-qt5.h:461
double duration() const
Returns the page duration.
void(*)(const QImage &, const QVariant &) RenderToImagePartialUpdateFunc
Partial Update renderToImage callback.
Definition poppler-qt5.h:542
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:613
Container class for a sound file in a PDF document.
Definition poppler-qt5.h:2433
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:2448
@ muLaw
mu-law-encoded samples
Definition poppler-qt5.h:2451
@ Signed
Twos-complement values.
Definition poppler-qt5.h:2450
@ Raw
Raw encoding, with unspecified or unsigned values in the range [ 0, 2^B - 1 ].
Definition poppler-qt5.h:2449
SoundType
The type of sound.
Definition poppler-qt5.h:2439
@ External
The real sound file is external.
Definition poppler-qt5.h:2440
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:124
bool hasSpaceAfter() const
Returns whether there is a space character after this text box.
TextBox(const QString &text, const QRectF &bBox)
The default constructor sets the text and the rectangle that contains the text.
QString text() const
Returns the text of this text box.
~TextBox()
Destructor.
QRectF charBoundingBox(int i) const
Returns the bounding box of the i -th characted of the word.
TextBox * nextWord() const
Returns the pointer to the next text box, if there is one.
QRectF boundingBox() const
Returns the position of the text, in point, i.e., 1/72 of an inch.
The Poppler 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: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-qt5.h:1664