Poppler Qt5  21.10.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-2021, 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  *
32  * This program is free software; you can redistribute it and/or modify
33  * it under the terms of the GNU General Public License as published by
34  * the Free Software Foundation; either version 2, or (at your option)
35  * any later version.
36  *
37  * This program is distributed in the hope that it will be useful,
38  * but WITHOUT ANY WARRANTY; without even the implied warranty of
39  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40  * GNU General Public License for more details.
41  *
42  * You should have received a copy of the GNU General Public License
43  * along with this program; if not, write to the Free Software
44  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
45  */
46 
47 #ifndef __POPPLER_QT_H__
48 #define __POPPLER_QT_H__
49 
50 #include <functional>
51 
52 #include "poppler-annotation.h"
53 #include "poppler-link.h"
54 #include "poppler-optcontent.h"
55 #include "poppler-page-transition.h"
56 
57 #include <QtCore/QByteArray>
58 #include <QtCore/QDateTime>
59 #include <QtCore/QSet>
60 #include <QtXml/QDomDocument>
61 #include "poppler-export.h"
62 
63 class EmbFile;
64 class Sound;
65 class AnnotMovie;
66 
70 namespace Poppler {
71 
72 class Document;
73 class DocumentData;
74 
75 class PageData;
76 
77 class FormField;
78 class FormFieldSignature;
79 
80 class TextBoxData;
81 
82 class PDFConverter;
83 class PSConverter;
84 
85 struct OutlineItemData;
86 
96 typedef void (*PopplerDebugFunc)(const QString & /*message*/, const QVariant & /*closure*/);
97 
109 POPPLER_QT5_EXPORT void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure);
110 
120 class POPPLER_QT5_EXPORT TextBox
121 {
122  friend class Page;
123 
124 public:
130  TextBox(const QString &text, const QRectF &bBox);
135 
139  QString text() const;
140 
147  QRectF boundingBox() const;
148 
154  TextBox *nextWord() const;
155 
159  QRectF charBoundingBox(int i) const;
160 
164  bool hasSpaceAfter() const;
165 
166 private:
167  Q_DISABLE_COPY(TextBox)
168 
169  TextBoxData *m_data;
170 };
171 
172 class FontInfoData;
177 class POPPLER_QT5_EXPORT FontInfo
178 {
179  friend class Document;
180 
181 public:
185  enum Type
186  {
187  unknown,
188  Type1,
189  Type1C,
190  Type1COT,
191  Type3,
192  TrueType,
193  TrueTypeOT,
194  CIDType0,
195  CIDType0C,
196  CIDType0COT,
197  CIDTrueType,
198  CIDTrueTypeOT
199  };
200 
202 
205  FontInfo();
206 
210  explicit FontInfo(const FontInfoData &fid);
212 
216  FontInfo(const FontInfo &fi);
217 
222 
226  QString name() const;
227 
232  QString substituteName() const;
233 
238  QString file() const;
239 
245  bool isEmbedded() const;
246 
253  bool isSubset() const;
254 
262  Type type() const;
263 
272  QString typeName() const;
273 
278 
279 private:
280  FontInfoData *m_data;
281 };
282 
283 class FontIteratorData;
303 class POPPLER_QT5_EXPORT FontIterator
304 {
305  friend class Document;
306  friend class DocumentData;
307 
308 public:
313 
318  QList<FontInfo> next();
319 
324  bool hasNext() const;
325 
329  int currentPage() const;
330 
331 private:
332  Q_DISABLE_COPY(FontIterator)
333  FontIterator(int, DocumentData *dd);
334 
335  FontIteratorData *d;
336 };
337 
338 class EmbeddedFileData;
342 class POPPLER_QT5_EXPORT EmbeddedFile
343 {
344  friend class DocumentData;
345  friend class AnnotationPrivate;
346 
347 public:
349  explicit EmbeddedFile(EmbFile *embfile);
351 
356 
360  QString name() const;
361 
367  QString description() const;
368 
374  int size() const;
375 
379  QDateTime modDate() const;
380 
384  QDateTime createDate() const;
385 
391  QByteArray checksum() const;
392 
398  QString mimeType() const;
399 
403  QByteArray data();
404 
410  bool isValid() const;
411 
415  // QDataStream dataStream() const;
416 
417 private:
418  Q_DISABLE_COPY(EmbeddedFile)
419  explicit EmbeddedFile(EmbeddedFileData &dd);
420 
421  EmbeddedFileData *m_embeddedFile;
422 };
423 
432 class POPPLER_QT5_EXPORT Page
433 {
434  friend class Document;
435 
436 public:
440  ~Page();
441 
445  enum Rotation
446  {
447  Rotate0 = 0,
448  Rotate90 = 1,
449  Rotate180 = 2,
450  Rotate270 = 3
451  };
452 
457  {
459  Closing
460  };
461 
467  {
469  RawOrderLayout
470  };
471 
477  {
478  NoPainterFlags = 0x00000000,
486  DontSaveAndRestore = 0x00000001
487  };
488  Q_DECLARE_FLAGS(PainterFlags, PainterFlag)
489 
490 
528  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;
529 
539  typedef void (*RenderToImagePartialUpdateFunc)(const QImage & /*image*/, const QVariant & /*closure*/);
540 
549  typedef bool (*ShouldRenderToImagePartialQueryFunc)(const QVariant & /*closure*/);
550 
600  QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
601  const QVariant &payload) const;
602 
610  typedef bool (*ShouldAbortQueryFunc)(const QVariant & /*closure*/);
611 
665  QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
666  ShouldAbortQueryFunc shouldAbortRenderCallback, const QVariant &payload) const;
667 
710  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;
711 
720  QImage thumbnail() const;
721 
731  QString text(const QRectF &rect, TextLayout textLayout) const;
732 
741  QString text(const QRectF &rect) const;
742 
747  {
750  PreviousResult
751  };
752 
757  {
759  CaseInsensitive
760  };
761 
766  {
767  NoSearchFlags = 0x00000000,
768  IgnoreCase = 0x00000001,
769  WholeWords = 0x00000002,
770  IgnoreDiacritics = 0x00000004,
773  AcrossLines = 0x00000008
776  };
777  Q_DECLARE_FLAGS(SearchFlags, SearchFlag)
778 
779 
790  Q_DECL_DEPRECATED bool search(const QString &text, double &rectLeft, double &rectTop, double &rectRight, double &rectBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
791 
804  bool search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
805 
817  Q_DECL_DEPRECATED QList<QRectF> search(const QString &text, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
818 
833  QList<QRectF> search(const QString &text, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
834 
851  QList<TextBox *> textList(Rotation rotate = Rotate0) const;
852 
877  QList<TextBox *> textList(Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const;
878 
882  QSizeF pageSizeF() const;
883 
887  QSize pageSize() const;
888 
899  PageTransition *transition() const;
900 
906  Link *action(PageAction act) const;
907 
912  {
916  UpsideDown
917  };
918 
923 
927  void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown);
928 
932  QList<Link *> links() const;
933 
942  QList<Annotation *> annotations() const;
943 
956  QList<Annotation *> annotations(const QSet<Annotation::SubType> &subtypes) const;
957 
965  void addAnnotation(const Annotation *ann);
966 
973  void removeAnnotation(const Annotation *ann);
974 
981  QList<FormField *> formFields() const;
982 
990  double duration() const;
991 
997  QString label() const;
998 
1004  int index() const;
1005 
1006 private:
1007  Q_DISABLE_COPY(Page)
1008 
1009  Page(DocumentData *doc, int index);
1010  PageData *m_page;
1011 };
1012 
1020 class POPPLER_QT5_EXPORT OutlineItem
1021 {
1022  friend class Document;
1023 
1024 public:
1029  ~OutlineItem();
1030 
1031  OutlineItem(const OutlineItem &other);
1032  OutlineItem &operator=(const OutlineItem &other);
1033 
1034  OutlineItem(OutlineItem &&other) noexcept;
1035  OutlineItem &operator=(OutlineItem &&other) noexcept;
1036 
1040  bool isNull() const;
1041 
1045  QString name() const;
1046 
1050  bool isOpen() const;
1051 
1057  QSharedPointer<const LinkDestination> destination() const;
1058 
1064  QString externalFileName() const;
1065 
1071  QString uri() const;
1072 
1078  bool hasChildren() const;
1079 
1085  QVector<OutlineItem> children() const;
1086 
1087 private:
1088  explicit OutlineItem(OutlineItemData *data);
1089  OutlineItemData *m_data;
1090 };
1091 
1142 class POPPLER_QT5_EXPORT Document
1143 {
1144  friend class Page;
1145  friend class DocumentData;
1146 
1147 public:
1152  {
1158  UseAttach
1159  };
1160 
1165  {
1172  TwoPageRight
1173  };
1174 
1181  {
1184  QPainterBackend = ArthurBackend
1185  };
1186 
1193  {
1194  Antialiasing = 0x00000001,
1195  TextAntialiasing = 0x00000002,
1196  TextHinting = 0x00000004,
1197  TextSlightHinting = 0x00000008,
1198  OverprintPreview = 0x00000010,
1199  ThinLineSolid = 0x00000020,
1200  ThinLineShape = 0x00000040,
1201  IgnorePaperColor = 0x00000080,
1202  HideAnnotations = 0x00000100
1203  };
1204  Q_DECLARE_FLAGS(RenderHints, RenderHint)
1205 
1206 
1212  {
1215  XfaForm
1216  };
1217 
1230  void setColorDisplayProfile(void *outputProfileA);
1240  void setColorDisplayProfileName(const QString &name);
1251  void *colorRgbProfile() const;
1262  void *colorDisplayProfile() const;
1263 
1281  static Document *load(const QString &filePath, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1282 
1307  static Document *load(QIODevice *device, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1308 
1330  static Document *loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1331 
1349  Page *page(int index) const;
1350 
1363  Page *page(const QString &label) const;
1364 
1368  int numPages() const;
1369 
1376 
1383 
1390  Qt::LayoutDirection textDirection() const;
1391 
1400  bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword);
1401 
1405  bool isLocked() const;
1406 
1422  QDateTime date(const QString &type) const;
1423 
1429  bool setDate(const QString &key, const QDateTime &val);
1430 
1434  QDateTime creationDate() const;
1435 
1441  bool setCreationDate(const QDateTime &val);
1442 
1446  QDateTime modificationDate() const;
1447 
1453  bool setModificationDate(const QDateTime &val);
1454 
1471  QString info(const QString &type) const;
1472 
1478  bool setInfo(const QString &key, const QString &val);
1479 
1483  QString title() const;
1484 
1490  bool setTitle(const QString &val);
1491 
1495  QString author() const;
1496 
1502  bool setAuthor(const QString &val);
1503 
1507  QString subject() const;
1508 
1514  bool setSubject(const QString &val);
1515 
1519  QString keywords() const;
1520 
1526  bool setKeywords(const QString &val);
1527 
1531  QString creator() const;
1532 
1538  bool setCreator(const QString &val);
1539 
1543  QString producer() const;
1544 
1550  bool setProducer(const QString &val);
1551 
1557  bool removeInfo();
1558 
1562  QStringList infoKeys() const;
1563 
1567  bool isEncrypted() const;
1568 
1575  bool isLinearized() const;
1576 
1581  bool okToPrint() const;
1582 
1587  bool okToPrintHighRes() const;
1588 
1596  bool okToChange() const;
1597 
1602  bool okToCopy() const;
1603 
1609  bool okToAddNotes() const;
1610 
1618  bool okToFillForm() const;
1619 
1625  bool okToCreateFormFields() const;
1626 
1633 
1641  bool okToAssemble() const;
1642 
1657  Q_DECL_DEPRECATED void getPdfVersion(int *major, int *minor) const;
1658 
1660  struct PdfVersion
1661  {
1662  int major;
1663  int minor;
1664  };
1665 
1673 
1685  QList<FontInfo> fonts() const;
1686 
1702  FontIterator *newFontIterator(int startPage = 0) const;
1703 
1709  QByteArray fontData(const FontInfo &fi) const;
1710 
1717  QList<EmbeddedFile *> embeddedFiles() const;
1718 
1722  bool hasEmbeddedFiles() const;
1723 
1747  Q_DECL_DEPRECATED QDomDocument *toc() const;
1748 
1756  QVector<OutlineItem> outline() const;
1757 
1766  LinkDestination *linkDestination(const QString &name);
1767 
1773  void setPaperColor(const QColor &color);
1779  QColor paperColor() const;
1780 
1797 
1803  static QSet<RenderBackend> availableRenderBackends();
1804 
1814  void setRenderHint(RenderHint hint, bool on = true);
1820  RenderHints renderHints() const;
1821 
1830 
1839 
1845  QString metadata() const;
1846 
1859  bool hasOptionalContent() const;
1860 
1869 
1878  QStringList scripts() const;
1879 
1892  bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const;
1893 
1900 
1906  QVector<int> formCalculateOrder() const;
1907 
1916  QVector<FormFieldSignature *> signatures() const;
1917 
1923  bool xrefWasReconstructed() const;
1924 
1931  void setXRefReconstructedCallback(const std::function<void()> &callback);
1932 
1937 
1938 private:
1939  Q_DISABLE_COPY(Document)
1940 
1941  DocumentData *m_doc;
1942 
1943  explicit Document(DocumentData *dataA);
1944 };
1945 
1946 class BaseConverterPrivate;
1947 class PSConverterPrivate;
1948 class PDFConverterPrivate;
1956 class POPPLER_QT5_EXPORT BaseConverter
1957 {
1958  friend class Document;
1959 
1960 public:
1964  virtual ~BaseConverter();
1965 
1967  void setOutputFileName(const QString &outputFileName);
1968 
1974  void setOutputDevice(QIODevice *device);
1975 
1981  virtual bool convert() = 0;
1982 
1983  enum Error
1984  {
1985  NoError,
1986  FileLockedError,
1987  OpenOutputError,
1988  NotSupportedInputFileError
1989  };
1990 
1995  Error lastError() const;
1996 
1997 protected:
1999  explicit BaseConverter(BaseConverterPrivate &dd);
2000  Q_DECLARE_PRIVATE(BaseConverter)
2001  BaseConverterPrivate *d_ptr;
2003 
2004 private:
2005  Q_DISABLE_COPY(BaseConverter)
2006 };
2007 
2024 class POPPLER_QT5_EXPORT PSConverter : public BaseConverter
2025 {
2026  friend class Document;
2027 
2028 public:
2035  {
2036  Printing = 0x00000001,
2037  StrictMargins = 0x00000002,
2038  ForceRasterization = 0x00000004,
2039  PrintToEPS = 0x00000008,
2040  HideAnnotations = 0x00000010
2041  };
2042  Q_DECLARE_FLAGS(PSOptions, PSOption)
2043 
2044 
2047  ~PSConverter() override;
2048 
2050  void setPageList(const QList<int> &pageList);
2051 
2055  void setTitle(const QString &title);
2056 
2060  void setHDPI(double hDPI);
2061 
2065  void setVDPI(double vDPI);
2066 
2070  void setRotate(int rotate);
2071 
2075  void setPaperWidth(int paperWidth);
2076 
2080  void setPaperHeight(int paperHeight);
2081 
2085  void setRightMargin(int marginRight);
2086 
2090  void setBottomMargin(int marginBottom);
2091 
2095  void setLeftMargin(int marginLeft);
2096 
2100  void setTopMargin(int marginTop);
2101 
2109  void setStrictMargins(bool strictMargins);
2110 
2112  void setForceRasterize(bool forceRasterize);
2113 
2119  void setPSOptions(PSOptions options);
2120 
2128  PSOptions psOptions() const;
2129 
2137  void setPageConvertedCallback(void (*callback)(int page, void *payload), void *payload);
2138 
2139  bool convert() override;
2140 
2141 private:
2142  Q_DECLARE_PRIVATE(PSConverter)
2143  Q_DISABLE_COPY(PSConverter)
2144 
2145  explicit PSConverter(DocumentData *document);
2146 };
2147 
2153 class POPPLER_QT5_EXPORT PDFConverter : public BaseConverter
2154 {
2155  friend class Document;
2156 
2157 public:
2162  {
2163  WithChanges = 0x00000001
2164  };
2165  Q_DECLARE_FLAGS(PDFOptions, PDFOption)
2166 
2167 
2170  ~PDFConverter() override;
2171 
2175  void setPDFOptions(PDFOptions options);
2179  PDFOptions pdfOptions() const;
2180 
2193  class POPPLER_QT5_EXPORT NewSignatureData
2194  {
2195  public:
2196  NewSignatureData();
2197  ~NewSignatureData();
2198  NewSignatureData(const NewSignatureData &) = delete;
2199  NewSignatureData &operator=(const NewSignatureData &) = delete;
2200 
2201  QString certNickname() const;
2202  void setCertNickname(const QString &certNickname);
2203 
2204  QString password() const;
2205  void setPassword(const QString &password);
2206 
2207  int page() const;
2208  void setPage(int page);
2209 
2210  QRectF boundingRectangle() const;
2211  void setBoundingRectangle(const QRectF &rect);
2212 
2213  QString signatureText() const;
2214  void setSignatureText(const QString &text);
2215 
2223  QString signatureLeftText() const;
2224  void setSignatureLeftText(const QString &text);
2225 
2233  QString reason() const;
2234  void setReason(const QString &reason);
2235 
2243  QString location() const;
2244  void setLocation(const QString &location);
2245 
2249  double fontSize() const;
2250  void setFontSize(double fontSize);
2251 
2257  double leftFontSize() const;
2258  void setLeftFontSize(double fontSize);
2259 
2263  QColor fontColor() const;
2264  void setFontColor(const QColor &color);
2265 
2269  QColor borderColor() const;
2270  void setBorderColor(const QColor &color);
2271 
2279  double borderWidth() const;
2280  void setBorderWidth(double width);
2281 
2285  QColor backgroundColor() const;
2286  void setBackgroundColor(const QColor &color);
2287 
2291  QString fieldPartialName() const;
2292  void setFieldPartialName(const QString &name);
2293 
2294  private:
2295  struct NewSignatureDataPrivate;
2296  NewSignatureDataPrivate *const d;
2297  };
2298 
2308  bool sign(const NewSignatureData &data);
2309 
2310  bool convert() override;
2311 
2312 private:
2313  Q_DECLARE_PRIVATE(PDFConverter)
2314  Q_DISABLE_COPY(PDFConverter)
2315 
2316  explicit PDFConverter(DocumentData *document);
2317 };
2318 
2322 POPPLER_QT5_EXPORT Q_DECL_DEPRECATED QDateTime convertDate(char *dateString);
2323 
2329 POPPLER_QT5_EXPORT QDateTime convertDate(const char *dateString);
2330 
2336 POPPLER_QT5_EXPORT bool isCmsAvailable();
2337 
2343 POPPLER_QT5_EXPORT bool isOverprintPreviewAvailable();
2344 
2345 class SoundData;
2355 class POPPLER_QT5_EXPORT SoundObject
2356 {
2357 public:
2362  {
2364  Embedded
2365  };
2366 
2371  {
2375  ALaw
2376  };
2377 
2379  explicit SoundObject(Sound *popplersound);
2381 
2382  ~SoundObject();
2383 
2388 
2392  QString url() const;
2393 
2397  QByteArray data() const;
2398 
2402  double samplingRate() const;
2403 
2407  int channels() const;
2408 
2412  int bitsPerSample() const;
2413 
2418 
2419 private:
2420  Q_DISABLE_COPY(SoundObject)
2421 
2422  SoundData *m_soundData;
2423 };
2424 
2425 class MovieData;
2431 class POPPLER_QT5_EXPORT MovieObject
2432 {
2433  friend class AnnotationPrivate;
2434 
2435 public:
2440  {
2444  PlayPalindrome
2445  };
2446 
2447  ~MovieObject();
2448 
2452  QString url() const;
2453 
2457  QSize size() const;
2458 
2462  int rotation() const;
2463 
2467  bool showControls() const;
2468 
2473 
2478  bool showPosterImage() const;
2479 
2486  QImage posterImage() const;
2487 
2488 private:
2490  explicit MovieObject(AnnotMovie *ann);
2492 
2493  Q_DISABLE_COPY(MovieObject)
2494 
2495  MovieData *m_movieData;
2496 };
2497 
2498 }
2499 
2500 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::PainterFlags)
2501 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::SearchFlags)
2502 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints)
2503 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PDFConverter::PDFOptions)
2504 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PSConverter::PSOptions)
2505 
2506 #endif
Annotation class holding properties shared by all annotations.
Definition: poppler-annotation.h:203
Base converter.
Definition: poppler-qt5.h:1957
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:1143
OptContentModel * optionalContentModel()
Itemviews model for optional content.
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.
bool okToChange() const
Test if the permissions on the document allow it to be changed.
QString title() const
The title of the document.
QDomDocument * toc() const
Gets the table of contents (TOC) of the Document.
bool okToCreateFormFields() const
Test if the permissions on the document allow interactive form fields (including signature fields) to...
void getPdfVersion(int *major, int *minor) const
The version of the PDF specification that the document conforms to.
Page * page(const QString &label) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
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.
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:1165
@ TwoPageLeft
Display the pages two at a time, with odd-numbered pages on the left.
Definition: poppler-qt5.h:1171
@ TwoColumnLeft
Display the pages in two columns, with odd-numbered pages on the left.
Definition: poppler-qt5.h:1169
@ SinglePage
Display a single page.
Definition: poppler-qt5.h:1167
@ NoLayout
Layout not specified.
Definition: poppler-qt5.h:1166
@ TwoColumnRight
Display the pages in two columns, with odd-numbered pages on the right.
Definition: poppler-qt5.h:1170
@ OneColumn
Display a single column of pages.
Definition: poppler-qt5.h:1168
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.
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.
Page * page(int index) const
Get a specified Page.
QStringList infoKeys() const
Obtain a list of the available string information keys.
void setPaperColor(const QColor &color)
Sets the paper color.
RenderBackend
The render backends available.
Definition: poppler-qt5.h:1181
@ ArthurBackend
Definition: poppler-qt5.h:1183
@ SplashBackend
Splash backend.
Definition: poppler-qt5.h:1182
static Document * loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword=QByteArray(), const QByteArray &userPassword=QByteArray())
Load the document from memory.
void * colorDisplayProfile() const
Return the current display profile.
QVector< FormFieldSignature * > signatures() const
Returns the signatures of this document.
static Document * load(QIODevice *device, const QByteArray &ownerPassword=QByteArray(), const QByteArray &userPassword=QByteArray())
Load the document from a device.
bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword)
Provide the passwords required to unlock the document.
void * colorRgbProfile() const
Return the current RGB profile.
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:1152
@ UseOutlines
Document outline visible.
Definition: poppler-qt5.h:1154
@ UseNone
No mode - neither document outline nor thumbnail images are visible.
Definition: poppler-qt5.h:1153
@ UseThumbs
Thumbnail images visible.
Definition: poppler-qt5.h:1155
@ FullScreen
Fullscreen mode (no menubar, windows controls etc)
Definition: poppler-qt5.h:1156
@ UseOC
Optional content group panel visible.
Definition: poppler-qt5.h:1157
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:1193
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.
QVector< int > formCalculateOrder() const
Returns the calculate order for forms (using their id)
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.
QList< FontInfo > fonts() const
The fonts within the PDF document.
PSConverter * psConverter() const
Gets a new PS converter for this document.
FontIterator * newFontIterator(int startPage=0) const
Creates a new FontIterator object for font scanning.
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.
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.
bool okToAssemble() const
Test if the permissions on the document allow it to be "assembled" - insertion, rotation and deletion...
~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.
PDFConverter * pdfConverter() const
Gets a new PDF 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:1212
@ AcroForm
AcroForm.
Definition: poppler-qt5.h:1214
@ NoForm
Document doesn't contain forms.
Definition: poppler-qt5.h:1213
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.
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.
static QSet< RenderBackend > availableRenderBackends()
The available rendering backends.
bool okToPrint() const
Test if the permissions on the document allow it to be printed.
QList< EmbeddedFile * > embeddedFiles() const
The documents embedded within the PDF document.
RenderBackend renderBackend() const
The currently set render backend.
static Document * load(const QString &filePath, const QByteArray &ownerPassword=QByteArray(), const QByteArray &userPassword=QByteArray())
Load the document from a file on disk.
bool setKeywords(const QString &val)
Set the keywords of the document to.
QStringList scripts() const
Document-level JavaScript scripts.
LinkDestination * linkDestination(const QString &name)
Tries to resolve the named destination name.
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.
QVector< OutlineItem > outline() const
Gets the outline of the document.
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:343
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:178
Type type() const
The type of font encoding.
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:186
FontInfo & operator=(const FontInfo &fi)
Standard assignment operator.
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:304
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:2432
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:2440
@ PlayRepeat
Play continuously until stopped.
Definition: poppler-qt5.h:2443
@ PlayOnce
Play the movie once, closing the movie controls at the end.
Definition: poppler-qt5.h:2441
@ PlayOpen
Like PlayOnce, but leaving the controls open.
Definition: poppler-qt5.h:2442
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:1021
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.
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.
QSharedPointer< const LinkDestination > destination() const
The destination referred to by this item.
QVector< OutlineItem > children() const
Gets the child items of this item.
bool hasChildren() const
Determines if this item has any child items.
Holds data for a new signature.
Definition: poppler-qt5.h:2194
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.
QString reason() const
Signature's property Reason.
Converts a PDF to PDF (thus saves a copy of the document).
Definition: poppler-qt5.h:2154
bool convert() override
Does the conversion.
PDFOption
Options for the PDF export.
Definition: poppler-qt5.h:2162
~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:2025
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:2035
void setPageConvertedCallback(void(*callback)(int page, void *payload), void *payload)
Sets a function that will be called each time a page is converted.
void setRightMargin(int marginRight)
Sets the output right margin.
void setBottomMargin(int marginBottom)
Sets the output bottom margin.
bool convert() override
Does the conversion.
void setTopMargin(int marginTop)
Sets the output top margin.
~PSConverter() override
Destructor.
void setVDPI(double vDPI)
Sets the vertical DPI.
void setLeftMargin(int marginLeft)
Sets the output left margin.
void setPaperHeight(int paperHeight)
Sets the output paper height.
void setTitle(const QString &title)
Sets the title of the PS Document.
void setPageList(const QList< int > &pageList)
Sets the list of pages to print.
void setForceRasterize(bool forceRasterize)
Defines if the page will be rasterized to an image before printing.
void setHDPI(double hDPI)
Sets the horizontal DPI.
void setPaperWidth(int paperWidth)
Sets the output paper width.
void setRotate(int rotate)
Sets the rotate.
PSOptions psOptions() const
The currently set options for the PS export.
Describes how a PDF file viewer shall perform the transition from one page to another.
Definition: poppler-page-transition.h:48
A page in a document.
Definition: poppler-qt5.h:433
void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown)
The default CTM.
Orientation
Types of orientations that are possible.
Definition: poppler-qt5.h:912
@ Seascape
Seascape orientation (portrait, with 270 degrees clockwise rotation)
Definition: poppler-qt5.h:915
@ Landscape
Landscape orientation (portrait, with 90 degrees clockwise rotation )
Definition: poppler-qt5.h:913
@ Portrait
Normal portrait orientation.
Definition: poppler-qt5.h:914
SearchFlag
Flags to modify the search behaviour.
Definition: poppler-qt5.h:766
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.
QList< FormField * > formFields() const
Returns the form fields on the page The caller gets the ownership of the returned objects.
int index() const
Returns the index of the page.
SearchDirection
The starting point for a search.
Definition: poppler-qt5.h:747
@ FromTop
Start sorting at the top of the document.
Definition: poppler-qt5.h:748
@ NextResult
Find the next result, moving "down the page".
Definition: poppler-qt5.h:749
PainterFlag
Additional flags for the renderToPainter method.
Definition: poppler-qt5.h:477
QList< Annotation * > annotations() const
Returns the annotations of the page.
Rotation
The type of rotation to apply for an operation.
Definition: poppler-qt5.h:446
~Page()
Destructor.
Orientation orientation() const
The orientation of the page.
SearchMode
The type of search to perform.
Definition: poppler-qt5.h:757
@ CaseSensitive
Case differences cause no match in searching.
Definition: poppler-qt5.h:758
TextLayout
How the text is going to be returned.
Definition: poppler-qt5.h:467
@ PhysicalLayout
The text is layouted to resemble the real page layout.
Definition: poppler-qt5.h:468
PageAction
The kinds of page actions.
Definition: poppler-qt5.h:457
@ Opening
The action when a page is "opened".
Definition: poppler-qt5.h:458
double duration() const
Returns the page duration.
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.
QList< Link * > links() const
Gets the links of the page.
Container class for a sound file in a PDF document.
Definition: poppler-qt5.h:2356
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:2371
@ muLaw
mu-law-encoded samples
Definition: poppler-qt5.h:2374
@ Signed
Twos-complement values.
Definition: poppler-qt5.h:2373
@ Raw
Raw encoding, with unspecified or unsigned values in the range [ 0, 2^B - 1 ].
Definition: poppler-qt5.h:2372
SoundType
The type of sound.
Definition: poppler-qt5.h:2362
@ External
The real sound file is external.
Definition: poppler-qt5.h:2363
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:121
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.
TextBox * nextWord() const
Returns the pointer to the next text box, if there is one.
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.
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(* PopplerDebugFunc)(const QString &, const QVariant &)
Debug/error function.
Definition: poppler-qt5.h:96
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:1661