Poppler Qt5  22.06.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  *
33  * This program is free software; you can redistribute it and/or modify
34  * it under the terms of the GNU General Public License as published by
35  * the Free Software Foundation; either version 2, or (at your option)
36  * any later version.
37  *
38  * This program is distributed in the hope that it will be useful,
39  * but WITHOUT ANY WARRANTY; without even the implied warranty of
40  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41  * GNU General Public License for more details.
42  *
43  * You should have received a copy of the GNU General Public License
44  * along with this program; if not, write to the Free Software
45  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
46  */
47 
48 #ifndef __POPPLER_QT_H__
49 #define __POPPLER_QT_H__
50 
51 #include <functional>
52 
53 #include "poppler-annotation.h"
54 #include "poppler-link.h"
55 #include "poppler-optcontent.h"
56 #include "poppler-page-transition.h"
57 
58 #include <QtCore/QByteArray>
59 #include <QtCore/QDateTime>
60 #include <QtCore/QSet>
61 #include <QtXml/QDomDocument>
62 #include "poppler-export.h"
63 
64 class EmbFile;
65 class Sound;
66 class AnnotMovie;
67 
71 namespace Poppler {
72 
73 class Document;
74 class DocumentData;
75 
76 class PageData;
77 
78 class FormField;
79 class FormFieldSignature;
80 
81 class TextBoxData;
82 
83 class PDFConverter;
84 class PSConverter;
85 
86 struct OutlineItemData;
87 
97 using PopplerDebugFunc = void (*)(const QString & /*message*/, const QVariant & /*closure*/);
98 
110 POPPLER_QT5_EXPORT void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure);
111 
121 class POPPLER_QT5_EXPORT TextBox
122 {
123  friend class Page;
124 
125 public:
131  TextBox(const QString &text, const QRectF &bBox);
136 
140  QString text() const;
141 
148  QRectF boundingBox() const;
149 
155  TextBox *nextWord() const;
156 
160  QRectF charBoundingBox(int i) const;
161 
165  bool hasSpaceAfter() const;
166 
167 private:
168  Q_DISABLE_COPY(TextBox)
169 
170  TextBoxData *m_data;
171 };
172 
173 class FontInfoData;
178 class POPPLER_QT5_EXPORT FontInfo
179 {
180  friend class Document;
181 
182 public:
186  enum Type
187  {
188  unknown,
189  Type1,
190  Type1C,
191  Type1COT,
192  Type3,
193  TrueType,
194  TrueTypeOT,
195  CIDType0,
196  CIDType0C,
197  CIDType0COT,
198  CIDTrueType,
199  CIDTrueTypeOT
200  };
201 
203 
206  FontInfo();
207 
211  explicit FontInfo(const FontInfoData &fid);
213 
217  FontInfo(const FontInfo &fi);
218 
223 
227  QString name() const;
228 
233  QString substituteName() const;
234 
239  QString file() const;
240 
246  bool isEmbedded() const;
247 
254  bool isSubset() const;
255 
263  Type type() const;
264 
273  QString typeName() const;
274 
279 
280 private:
281  FontInfoData *m_data;
282 };
283 
284 class FontIteratorData;
304 class POPPLER_QT5_EXPORT FontIterator
305 {
306  friend class Document;
307  friend class DocumentData;
308 
309 public:
314 
319  QList<FontInfo> next();
320 
325  bool hasNext() const;
326 
330  int currentPage() const;
331 
332 private:
333  Q_DISABLE_COPY(FontIterator)
334  FontIterator(int, DocumentData *dd);
335 
336  FontIteratorData *d;
337 };
338 
339 class EmbeddedFileData;
343 class POPPLER_QT5_EXPORT EmbeddedFile
344 {
345  friend class DocumentData;
346  friend class AnnotationPrivate;
347 
348 public:
350  explicit EmbeddedFile(EmbFile *embfile);
352 
357 
361  QString name() const;
362 
368  QString description() const;
369 
375  int size() const;
376 
380  QDateTime modDate() const;
381 
385  QDateTime createDate() const;
386 
392  QByteArray checksum() const;
393 
399  QString mimeType() const;
400 
404  QByteArray data();
405 
411  bool isValid() const;
412 
416  // QDataStream dataStream() const;
417 
418 private:
419  Q_DISABLE_COPY(EmbeddedFile)
420  explicit EmbeddedFile(EmbeddedFileData &dd);
421 
422  EmbeddedFileData *m_embeddedFile;
423 };
424 
433 class POPPLER_QT5_EXPORT Page
434 {
435  friend class Document;
436 
437 public:
441  ~Page();
442 
446  enum Rotation
447  {
448  Rotate0 = 0,
449  Rotate90 = 1,
450  Rotate180 = 2,
451  Rotate270 = 3
452  };
453 
458  {
460  Closing
461  };
462 
468  {
470  RawOrderLayout
471  };
472 
478  {
479  NoPainterFlags = 0x00000000,
487  DontSaveAndRestore = 0x00000001
488  };
489  Q_DECLARE_FLAGS(PainterFlags, PainterFlag)
490 
491 
529  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;
530 
540  using RenderToImagePartialUpdateFunc = void (*)(const QImage & /*image*/, const QVariant & /*closure*/);
541 
550  using ShouldRenderToImagePartialQueryFunc = bool (*)(const QVariant & /*closure*/);
551 
601  QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
602  const QVariant &payload) const;
603 
611  using ShouldAbortQueryFunc = bool (*)(const QVariant & /*closure*/);
612 
666  QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
667  ShouldAbortQueryFunc shouldAbortRenderCallback, const QVariant &payload) const;
668 
711  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;
712 
721  QImage thumbnail() const;
722 
732  QString text(const QRectF &rect, TextLayout textLayout) const;
733 
742  QString text(const QRectF &rect) const;
743 
748  {
751  PreviousResult
752  };
753 
758  {
760  CaseInsensitive
761  };
762 
767  {
768  NoSearchFlags = 0x00000000,
769  IgnoreCase = 0x00000001,
770  WholeWords = 0x00000002,
771  IgnoreDiacritics = 0x00000004,
774  AcrossLines = 0x00000008
777  };
778  Q_DECLARE_FLAGS(SearchFlags, SearchFlag)
779 
780 
791  Q_DECL_DEPRECATED bool search(const QString &text, double &rectLeft, double &rectTop, double &rectRight, double &rectBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
792 
805  bool search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
806 
818  Q_DECL_DEPRECATED QList<QRectF> search(const QString &text, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
819 
834  QList<QRectF> search(const QString &text, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
835 
852  QList<TextBox *> textList(Rotation rotate = Rotate0) const;
853 
878  QList<TextBox *> textList(Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const;
879 
883  QSizeF pageSizeF() const;
884 
888  QSize pageSize() const;
889 
900  PageTransition *transition() const;
901 
907  Link *action(PageAction act) const;
908 
913  {
917  UpsideDown
918  };
919 
924 
928  void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown);
929 
933  QList<Link *> links() const;
934 
943  QList<Annotation *> annotations() const;
944 
957  QList<Annotation *> annotations(const QSet<Annotation::SubType> &subtypes) const;
958 
966  void addAnnotation(const Annotation *ann);
967 
974  void removeAnnotation(const Annotation *ann);
975 
982  QList<FormField *> formFields() const;
983 
991  double duration() const;
992 
998  QString label() const;
999 
1005  int index() const;
1006 
1007 private:
1008  Q_DISABLE_COPY(Page)
1009 
1010  Page(DocumentData *doc, int index);
1011  PageData *m_page;
1012 };
1013 
1021 class POPPLER_QT5_EXPORT OutlineItem
1022 {
1023  friend class Document;
1024 
1025 public:
1030  ~OutlineItem();
1031 
1032  OutlineItem(const OutlineItem &other);
1033  OutlineItem &operator=(const OutlineItem &other);
1034 
1035  OutlineItem(OutlineItem &&other) noexcept;
1036  OutlineItem &operator=(OutlineItem &&other) noexcept;
1037 
1041  bool isNull() const;
1042 
1046  QString name() const;
1047 
1051  bool isOpen() const;
1052 
1058  QSharedPointer<const LinkDestination> destination() const;
1059 
1065  QString externalFileName() const;
1066 
1072  QString uri() const;
1073 
1079  bool hasChildren() const;
1080 
1086  QVector<OutlineItem> children() const;
1087 
1088 private:
1089  explicit OutlineItem(OutlineItemData *data);
1090  OutlineItemData *m_data;
1091 };
1092 
1143 class POPPLER_QT5_EXPORT Document
1144 {
1145  friend class Page;
1146  friend class DocumentData;
1147 
1148 public:
1153  {
1159  UseAttach
1160  };
1161 
1166  {
1173  TwoPageRight
1174  };
1175 
1182  {
1185  QPainterBackend = ArthurBackend
1186  };
1187 
1194  {
1195  Antialiasing = 0x00000001,
1196  TextAntialiasing = 0x00000002,
1197  TextHinting = 0x00000004,
1198  TextSlightHinting = 0x00000008,
1199  OverprintPreview = 0x00000010,
1200  ThinLineSolid = 0x00000020,
1201  ThinLineShape = 0x00000040,
1202  IgnorePaperColor = 0x00000080,
1203  HideAnnotations = 0x00000100
1204  };
1205  Q_DECLARE_FLAGS(RenderHints, RenderHint)
1206 
1207 
1213  {
1216  XfaForm
1217  };
1218 
1231  void setColorDisplayProfile(void *outputProfileA);
1241  void setColorDisplayProfileName(const QString &name);
1252  void *colorRgbProfile() const;
1263  void *colorDisplayProfile() const;
1264 
1282  static Document *load(const QString &filePath, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1283 
1308  static Document *load(QIODevice *device, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1309 
1331  static Document *loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1332 
1350  Page *page(int index) const;
1351 
1364  Page *page(const QString &label) const;
1365 
1369  int numPages() const;
1370 
1377 
1384 
1391  Qt::LayoutDirection textDirection() const;
1392 
1401  bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword);
1402 
1406  bool isLocked() const;
1407 
1423  QDateTime date(const QString &type) const;
1424 
1430  bool setDate(const QString &key, const QDateTime &val);
1431 
1435  QDateTime creationDate() const;
1436 
1442  bool setCreationDate(const QDateTime &val);
1443 
1447  QDateTime modificationDate() const;
1448 
1454  bool setModificationDate(const QDateTime &val);
1455 
1472  QString info(const QString &type) const;
1473 
1479  bool setInfo(const QString &key, const QString &val);
1480 
1484  QString title() const;
1485 
1491  bool setTitle(const QString &val);
1492 
1496  QString author() const;
1497 
1503  bool setAuthor(const QString &val);
1504 
1508  QString subject() const;
1509 
1515  bool setSubject(const QString &val);
1516 
1520  QString keywords() const;
1521 
1527  bool setKeywords(const QString &val);
1528 
1532  QString creator() const;
1533 
1539  bool setCreator(const QString &val);
1540 
1544  QString producer() const;
1545 
1551  bool setProducer(const QString &val);
1552 
1558  bool removeInfo();
1559 
1563  QStringList infoKeys() const;
1564 
1568  bool isEncrypted() const;
1569 
1576  bool isLinearized() const;
1577 
1582  bool okToPrint() const;
1583 
1588  bool okToPrintHighRes() const;
1589 
1597  bool okToChange() const;
1598 
1603  bool okToCopy() const;
1604 
1610  bool okToAddNotes() const;
1611 
1619  bool okToFillForm() const;
1620 
1626  bool okToCreateFormFields() const;
1627 
1634 
1642  bool okToAssemble() const;
1643 
1658  Q_DECL_DEPRECATED void getPdfVersion(int *major, int *minor) const;
1659 
1661  struct PdfVersion
1662  {
1663  int major;
1664  int minor;
1665  };
1666 
1674 
1686  QList<FontInfo> fonts() const;
1687 
1703  FontIterator *newFontIterator(int startPage = 0) const;
1704 
1710  QByteArray fontData(const FontInfo &fi) const;
1711 
1718  QList<EmbeddedFile *> embeddedFiles() const;
1719 
1723  bool hasEmbeddedFiles() const;
1724 
1748  Q_DECL_DEPRECATED QDomDocument *toc() const;
1749 
1757  QVector<OutlineItem> outline() const;
1758 
1767  LinkDestination *linkDestination(const QString &name);
1768 
1774  void setPaperColor(const QColor &color);
1780  QColor paperColor() const;
1781 
1798 
1804  static QSet<RenderBackend> availableRenderBackends();
1805 
1815  void setRenderHint(RenderHint hint, bool on = true);
1821  RenderHints renderHints() const;
1822 
1831 
1840 
1846  QString metadata() const;
1847 
1860  bool hasOptionalContent() const;
1861 
1870 
1879  QStringList scripts() const;
1880 
1893  bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const;
1894 
1901 
1907  QVector<int> formCalculateOrder() const;
1908 
1917  QVector<FormFieldSignature *> signatures() const;
1918 
1924  bool xrefWasReconstructed() const;
1925 
1932  void setXRefReconstructedCallback(const std::function<void()> &callback);
1933 
1938 
1939 private:
1940  Q_DISABLE_COPY(Document)
1941 
1942  DocumentData *m_doc;
1943 
1944  explicit Document(DocumentData *dataA);
1945 };
1946 
1947 class BaseConverterPrivate;
1948 class PSConverterPrivate;
1949 class PDFConverterPrivate;
1957 class POPPLER_QT5_EXPORT BaseConverter
1958 {
1959  friend class Document;
1960 
1961 public:
1965  virtual ~BaseConverter();
1966 
1968  void setOutputFileName(const QString &outputFileName);
1969 
1975  void setOutputDevice(QIODevice *device);
1976 
1982  virtual bool convert() = 0;
1983 
1984  enum Error
1985  {
1986  NoError,
1987  FileLockedError,
1988  OpenOutputError,
1989  NotSupportedInputFileError
1990  };
1991 
1996  Error lastError() const;
1997 
1998 protected:
2000  explicit BaseConverter(BaseConverterPrivate &dd);
2001  Q_DECLARE_PRIVATE(BaseConverter)
2002  BaseConverterPrivate *d_ptr;
2004 
2005 private:
2006  Q_DISABLE_COPY(BaseConverter)
2007 };
2008 
2025 class POPPLER_QT5_EXPORT PSConverter : public BaseConverter
2026 {
2027  friend class Document;
2028 
2029 public:
2036  {
2037  Printing = 0x00000001,
2038  StrictMargins = 0x00000002,
2039  ForceRasterization = 0x00000004,
2040  PrintToEPS = 0x00000008,
2041  HideAnnotations = 0x00000010
2042  };
2043  Q_DECLARE_FLAGS(PSOptions, PSOption)
2044 
2045 
2048  ~PSConverter() override;
2049 
2051  void setPageList(const QList<int> &pageList);
2052 
2056  void setTitle(const QString &title);
2057 
2061  void setHDPI(double hDPI);
2062 
2066  void setVDPI(double vDPI);
2067 
2071  void setRotate(int rotate);
2072 
2076  void setPaperWidth(int paperWidth);
2077 
2081  void setPaperHeight(int paperHeight);
2082 
2086  void setRightMargin(int marginRight);
2087 
2091  void setBottomMargin(int marginBottom);
2092 
2096  void setLeftMargin(int marginLeft);
2097 
2101  void setTopMargin(int marginTop);
2102 
2110  void setStrictMargins(bool strictMargins);
2111 
2113  void setForceRasterize(bool forceRasterize);
2114 
2120  void setPSOptions(PSOptions options);
2121 
2129  PSOptions psOptions() const;
2130 
2138  void setPageConvertedCallback(void (*callback)(int page, void *payload), void *payload);
2139 
2140  bool convert() override;
2141 
2142 private:
2143  Q_DECLARE_PRIVATE(PSConverter)
2144  Q_DISABLE_COPY(PSConverter)
2145 
2146  explicit PSConverter(DocumentData *document);
2147 };
2148 
2154 class POPPLER_QT5_EXPORT PDFConverter : public BaseConverter
2155 {
2156  friend class Document;
2157 
2158 public:
2163  {
2164  WithChanges = 0x00000001
2165  };
2166  Q_DECLARE_FLAGS(PDFOptions, PDFOption)
2167 
2168 
2171  ~PDFConverter() override;
2172 
2176  void setPDFOptions(PDFOptions options);
2180  PDFOptions pdfOptions() const;
2181 
2194  class POPPLER_QT5_EXPORT NewSignatureData
2195  {
2196  public:
2197  NewSignatureData();
2198  ~NewSignatureData();
2199  NewSignatureData(const NewSignatureData &) = delete;
2200  NewSignatureData &operator=(const NewSignatureData &) = delete;
2201 
2202  QString certNickname() const;
2203  void setCertNickname(const QString &certNickname);
2204 
2205  QString password() const;
2206  void setPassword(const QString &password);
2207 
2208  int page() const;
2209  void setPage(int page);
2210 
2211  QRectF boundingRectangle() const;
2212  void setBoundingRectangle(const QRectF &rect);
2213 
2214  QString signatureText() const;
2215  void setSignatureText(const QString &text);
2216 
2224  QString signatureLeftText() const;
2225  void setSignatureLeftText(const QString &text);
2226 
2234  QString reason() const;
2235  void setReason(const QString &reason);
2236 
2244  QString location() const;
2245  void setLocation(const QString &location);
2246 
2250  double fontSize() const;
2251  void setFontSize(double fontSize);
2252 
2258  double leftFontSize() const;
2259  void setLeftFontSize(double fontSize);
2260 
2264  QColor fontColor() const;
2265  void setFontColor(const QColor &color);
2266 
2270  QColor borderColor() const;
2271  void setBorderColor(const QColor &color);
2272 
2280  double borderWidth() const;
2281  void setBorderWidth(double width);
2282 
2286  QColor backgroundColor() const;
2287  void setBackgroundColor(const QColor &color);
2288 
2292  QString fieldPartialName() const;
2293  void setFieldPartialName(const QString &name);
2294 
2302  QByteArray documentOwnerPassword() const;
2303  void setDocumentOwnerPassword(const QByteArray &password);
2304 
2312  QByteArray documentUserPassword() const;
2313  void setDocumentUserPassword(const QByteArray &password);
2314 
2323  QString imagePath() const;
2324  void setImagePath(const QString &path);
2325 
2326  private:
2327  struct NewSignatureDataPrivate;
2328  NewSignatureDataPrivate *const d;
2329  };
2330 
2340  bool sign(const NewSignatureData &data);
2341 
2342  bool convert() override;
2343 
2344 private:
2345  Q_DECLARE_PRIVATE(PDFConverter)
2346  Q_DISABLE_COPY(PDFConverter)
2347 
2348  explicit PDFConverter(DocumentData *document);
2349 };
2350 
2354 POPPLER_QT5_EXPORT Q_DECL_DEPRECATED QDateTime convertDate(char *dateString);
2355 
2361 POPPLER_QT5_EXPORT QDateTime convertDate(const char *dateString);
2362 
2368 POPPLER_QT5_EXPORT bool isCmsAvailable();
2369 
2375 POPPLER_QT5_EXPORT bool isOverprintPreviewAvailable();
2376 
2377 class SoundData;
2387 class POPPLER_QT5_EXPORT SoundObject
2388 {
2389 public:
2394  {
2396  Embedded
2397  };
2398 
2403  {
2407  ALaw
2408  };
2409 
2411  explicit SoundObject(Sound *popplersound);
2413 
2414  ~SoundObject();
2415 
2420 
2424  QString url() const;
2425 
2429  QByteArray data() const;
2430 
2434  double samplingRate() const;
2435 
2439  int channels() const;
2440 
2444  int bitsPerSample() const;
2445 
2450 
2451 private:
2452  Q_DISABLE_COPY(SoundObject)
2453 
2454  SoundData *m_soundData;
2455 };
2456 
2457 class MovieData;
2463 class POPPLER_QT5_EXPORT MovieObject
2464 {
2465  friend class AnnotationPrivate;
2466 
2467 public:
2472  {
2476  PlayPalindrome
2477  };
2478 
2479  ~MovieObject();
2480 
2484  QString url() const;
2485 
2489  QSize size() const;
2490 
2494  int rotation() const;
2495 
2499  bool showControls() const;
2500 
2505 
2510  bool showPosterImage() const;
2511 
2518  QImage posterImage() const;
2519 
2520 private:
2522  explicit MovieObject(AnnotMovie *ann);
2524 
2525  Q_DISABLE_COPY(MovieObject)
2526 
2527  MovieData *m_movieData;
2528 };
2529 
2530 }
2531 
2532 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::PainterFlags)
2533 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::SearchFlags)
2534 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints)
2535 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PDFConverter::PDFOptions)
2536 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PSConverter::PSOptions)
2537 
2538 #endif
Annotation class holding properties shared by all annotations.
Definition: poppler-annotation.h:203
Base converter.
Definition: poppler-qt5.h:1958
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:1144
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:1166
@ TwoPageLeft
Display the pages two at a time, with odd-numbered pages on the left.
Definition: poppler-qt5.h:1172
@ TwoColumnLeft
Display the pages in two columns, with odd-numbered pages on the left.
Definition: poppler-qt5.h:1170
@ SinglePage
Display a single page.
Definition: poppler-qt5.h:1168
@ NoLayout
Layout not specified.
Definition: poppler-qt5.h:1167
@ TwoColumnRight
Display the pages in two columns, with odd-numbered pages on the right.
Definition: poppler-qt5.h:1171
@ OneColumn
Display a single column of pages.
Definition: poppler-qt5.h:1169
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:1182
@ ArthurBackend
Definition: poppler-qt5.h:1184
@ SplashBackend
Splash backend.
Definition: poppler-qt5.h:1183
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:1153
@ UseOutlines
Document outline visible.
Definition: poppler-qt5.h:1155
@ UseNone
No mode - neither document outline nor thumbnail images are visible.
Definition: poppler-qt5.h:1154
@ UseThumbs
Thumbnail images visible.
Definition: poppler-qt5.h:1156
@ FullScreen
Fullscreen mode (no menubar, windows controls etc)
Definition: poppler-qt5.h:1157
@ UseOC
Optional content group panel visible.
Definition: poppler-qt5.h:1158
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:1194
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:1213
@ AcroForm
AcroForm.
Definition: poppler-qt5.h:1215
@ NoForm
Document doesn't contain forms.
Definition: poppler-qt5.h:1214
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:344
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:179
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:187
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:305
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:2464
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:2472
@ PlayRepeat
Play continuously until stopped.
Definition: poppler-qt5.h:2475
@ PlayOnce
Play the movie once, closing the movie controls at the end.
Definition: poppler-qt5.h:2473
@ PlayOpen
Like PlayOnce, but leaving the controls open.
Definition: poppler-qt5.h:2474
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:1022
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:2195
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:2155
bool convert() override
Does the conversion.
PDFOption
Options for the PDF export.
Definition: poppler-qt5.h:2163
~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:2026
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:2036
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:434
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:550
Orientation
Types of orientations that are possible.
Definition: poppler-qt5.h:913
@ Seascape
Seascape orientation (portrait, with 270 degrees clockwise rotation)
Definition: poppler-qt5.h:916
@ Landscape
Landscape orientation (portrait, with 90 degrees clockwise rotation )
Definition: poppler-qt5.h:914
@ Portrait
Normal portrait orientation.
Definition: poppler-qt5.h:915
SearchFlag
Flags to modify the search behaviour.
Definition: poppler-qt5.h:767
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:748
@ FromTop
Start sorting at the top of the document.
Definition: poppler-qt5.h:749
@ NextResult
Find the next result, moving "down the page".
Definition: poppler-qt5.h:750
PainterFlag
Additional flags for the renderToPainter method.
Definition: poppler-qt5.h:478
QList< Annotation * > annotations() const
Returns the annotations of the page.
Rotation
The type of rotation to apply for an operation.
Definition: poppler-qt5.h:447
~Page()
Destructor.
Orientation orientation() const
The orientation of the page.
SearchMode
The type of search to perform.
Definition: poppler-qt5.h:758
@ CaseSensitive
Case differences cause no match in searching.
Definition: poppler-qt5.h:759
TextLayout
How the text is going to be returned.
Definition: poppler-qt5.h:468
@ PhysicalLayout
The text is layouted to resemble the real page layout.
Definition: poppler-qt5.h:469
PageAction
The kinds of page actions.
Definition: poppler-qt5.h:458
@ Opening
The action when a page is "opened".
Definition: poppler-qt5.h:459
double duration() const
Returns the page duration.
void(*)(const QImage &, const QVariant &) RenderToImagePartialUpdateFunc
Partial Update renderToImage callback.
Definition: poppler-qt5.h:540
QString label() const
Returns the label of the page, or a null string is the page has no label.
void removeAnnotation(const Annotation *ann)
Removes an annotation from the page and destroys the annotation object.
bool(*)(const QVariant &) ShouldAbortQueryFunc
Abort query function callback.
Definition: poppler-qt5.h:611
QList< Link * > links() const
Gets the links of the page.
Container class for a sound file in a PDF document.
Definition: poppler-qt5.h:2388
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:2403
@ muLaw
mu-law-encoded samples
Definition: poppler-qt5.h:2406
@ Signed
Twos-complement values.
Definition: poppler-qt5.h:2405
@ Raw
Raw encoding, with unspecified or unsigned values in the range [ 0, 2^B - 1 ].
Definition: poppler-qt5.h:2404
SoundType
The type of sound.
Definition: poppler-qt5.h:2394
@ External
The real sound file is external.
Definition: poppler-qt5.h:2395
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:122
bool hasSpaceAfter() const
Returns whether there is a space character after this text box.
TextBox(const QString &text, const QRectF &bBox)
The default constructor sets the text and the rectangle that contains the text.
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(*)(const QString &, const QVariant &) PopplerDebugFunc
Debug/error function.
Definition: poppler-qt5.h:97
bool isOverprintPreviewAvailable()
Whether the overprint preview functionality is available.
bool isCmsAvailable()
Whether the color management functions are available.
void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure)
Set a new debug/error output function.
The version specification of a pdf file.
Definition: poppler-qt5.h:1662