Poppler Qt5  21.08.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  *
31  * This program is free software; you can redistribute it and/or modify
32  * it under the terms of the GNU General Public License as published by
33  * the Free Software Foundation; either version 2, or (at your option)
34  * any later version.
35  *
36  * This program is distributed in the hope that it will be useful,
37  * but WITHOUT ANY WARRANTY; without even the implied warranty of
38  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39  * GNU General Public License for more details.
40  *
41  * You should have received a copy of the GNU General Public License
42  * along with this program; if not, write to the Free Software
43  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
44  */
45 
46 #ifndef __POPPLER_QT_H__
47 #define __POPPLER_QT_H__
48 
49 #include <functional>
50 
51 #include "poppler-annotation.h"
52 #include "poppler-link.h"
53 #include "poppler-optcontent.h"
54 #include "poppler-page-transition.h"
55 
56 #include <QtCore/QByteArray>
57 #include <QtCore/QDateTime>
58 #include <QtCore/QSet>
59 #include <QtXml/QDomDocument>
60 #include "poppler-export.h"
61 
62 class EmbFile;
63 class Sound;
64 class AnnotMovie;
65 
69 namespace Poppler {
70 
71 class Document;
72 class DocumentData;
73 
74 class PageData;
75 
76 class FormField;
77 class FormFieldSignature;
78 
79 class TextBoxData;
80 
81 class PDFConverter;
82 class PSConverter;
83 
84 struct OutlineItemData;
85 
95 typedef void (*PopplerDebugFunc)(const QString & /*message*/, const QVariant & /*closure*/);
96 
108 POPPLER_QT5_EXPORT void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure);
109 
119 class POPPLER_QT5_EXPORT TextBox
120 {
121  friend class Page;
122 
123 public:
129  TextBox(const QString &text, const QRectF &bBox);
134 
138  QString text() const;
139 
146  QRectF boundingBox() const;
147 
153  TextBox *nextWord() const;
154 
158  QRectF charBoundingBox(int i) const;
159 
163  bool hasSpaceAfter() const;
164 
165 private:
166  Q_DISABLE_COPY(TextBox)
167 
168  TextBoxData *m_data;
169 };
170 
171 class FontInfoData;
176 class POPPLER_QT5_EXPORT FontInfo
177 {
178  friend class Document;
179 
180 public:
184  enum Type
185  {
186  unknown,
187  Type1,
188  Type1C,
189  Type1COT,
190  Type3,
191  TrueType,
192  TrueTypeOT,
193  CIDType0,
194  CIDType0C,
195  CIDType0COT,
196  CIDTrueType,
197  CIDTrueTypeOT
198  };
199 
201 
204  FontInfo();
205 
209  FontInfo(const FontInfoData &fid);
211 
215  FontInfo(const FontInfo &fi);
216 
221 
225  QString name() const;
226 
231  QString substituteName() const;
232 
237  QString file() const;
238 
244  bool isEmbedded() const;
245 
252  bool isSubset() const;
253 
261  Type type() const;
262 
271  QString typeName() const;
272 
277 
278 private:
279  FontInfoData *m_data;
280 };
281 
282 class FontIteratorData;
302 class POPPLER_QT5_EXPORT FontIterator
303 {
304  friend class Document;
305  friend class DocumentData;
306 
307 public:
312 
317  QList<FontInfo> next();
318 
323  bool hasNext() const;
324 
328  int currentPage() const;
329 
330 private:
331  Q_DISABLE_COPY(FontIterator)
332  FontIterator(int, DocumentData *dd);
333 
334  FontIteratorData *d;
335 };
336 
337 class EmbeddedFileData;
341 class POPPLER_QT5_EXPORT EmbeddedFile
342 {
343  friend class DocumentData;
344  friend class AnnotationPrivate;
345 
346 public:
348  EmbeddedFile(EmbFile *embfile);
350 
355 
359  QString name() const;
360 
366  QString description() const;
367 
373  int size() const;
374 
378  QDateTime modDate() const;
379 
383  QDateTime createDate() const;
384 
390  QByteArray checksum() const;
391 
397  QString mimeType() const;
398 
402  QByteArray data();
403 
409  bool isValid() const;
410 
414  // QDataStream dataStream() const;
415 
416 private:
417  Q_DISABLE_COPY(EmbeddedFile)
418  EmbeddedFile(EmbeddedFileData &dd);
419 
420  EmbeddedFileData *m_embeddedFile;
421 };
422 
431 class POPPLER_QT5_EXPORT Page
432 {
433  friend class Document;
434 
435 public:
439  ~Page();
440 
444  enum Rotation
445  {
446  Rotate0 = 0,
447  Rotate90 = 1,
448  Rotate180 = 2,
449  Rotate270 = 3
450  };
451 
456  {
458  Closing
459  };
460 
466  {
468  RawOrderLayout
469  };
470 
476  {
477  NoPainterFlags = 0x00000000,
485  DontSaveAndRestore = 0x00000001
486  };
487  Q_DECLARE_FLAGS(PainterFlags, PainterFlag)
488 
489 
527  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;
528 
538  typedef void (*RenderToImagePartialUpdateFunc)(const QImage & /*image*/, const QVariant & /*closure*/);
539 
548  typedef bool (*ShouldRenderToImagePartialQueryFunc)(const QVariant & /*closure*/);
549 
599  QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
600  const QVariant &payload) const;
601 
609  typedef bool (*ShouldAbortQueryFunc)(const QVariant & /*closure*/);
610 
664  QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
665  ShouldAbortQueryFunc shouldAbortRenderCallback, const QVariant &payload) const;
666 
709  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;
710 
719  QImage thumbnail() const;
720 
730  QString text(const QRectF &rect, TextLayout textLayout) const;
731 
740  QString text(const QRectF &rect) const;
741 
746  {
749  PreviousResult
750  };
751 
756  {
758  CaseInsensitive
759  };
760 
765  {
766  NoSearchFlags = 0x00000000,
767  IgnoreCase = 0x00000001,
768  WholeWords = 0x00000002,
769  IgnoreDiacritics = 0x00000004,
772  AcrossLines = 0x00000008
775  };
776  Q_DECLARE_FLAGS(SearchFlags, SearchFlag)
777 
778 
789  Q_DECL_DEPRECATED bool search(const QString &text, double &rectLeft, double &rectTop, double &rectRight, double &rectBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
790 
803  bool search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
804 
816  Q_DECL_DEPRECATED QList<QRectF> search(const QString &text, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
817 
832  QList<QRectF> search(const QString &text, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
833 
850  QList<TextBox *> textList(Rotation rotate = Rotate0) const;
851 
876  QList<TextBox *> textList(Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const;
877 
881  QSizeF pageSizeF() const;
882 
886  QSize pageSize() const;
887 
898  PageTransition *transition() const;
899 
905  Link *action(PageAction act) const;
906 
911  {
915  UpsideDown
916  };
917 
922 
926  void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown);
927 
931  QList<Link *> links() const;
932 
941  QList<Annotation *> annotations() const;
942 
955  QList<Annotation *> annotations(const QSet<Annotation::SubType> &subtypes) const;
956 
964  void addAnnotation(const Annotation *ann);
965 
972  void removeAnnotation(const Annotation *ann);
973 
980  QList<FormField *> formFields() const;
981 
989  double duration() const;
990 
996  QString label() const;
997 
1003  int index() const;
1004 
1005 private:
1006  Q_DISABLE_COPY(Page)
1007 
1008  Page(DocumentData *doc, int index);
1009  PageData *m_page;
1010 };
1011 
1019 class POPPLER_QT5_EXPORT OutlineItem
1020 {
1021  friend class Document;
1022 
1023 public:
1028  ~OutlineItem();
1029 
1030  OutlineItem(const OutlineItem &other);
1031  OutlineItem &operator=(const OutlineItem &other);
1032 
1033  OutlineItem(OutlineItem &&other) noexcept;
1034  OutlineItem &operator=(OutlineItem &&other) noexcept;
1035 
1039  bool isNull() const;
1040 
1044  QString name() const;
1045 
1049  bool isOpen() const;
1050 
1056  QSharedPointer<const LinkDestination> destination() const;
1057 
1063  QString externalFileName() const;
1064 
1070  QString uri() const;
1071 
1077  bool hasChildren() const;
1078 
1084  QVector<OutlineItem> children() const;
1085 
1086 private:
1087  OutlineItem(OutlineItemData *data);
1088  OutlineItemData *m_data;
1089 };
1090 
1141 class POPPLER_QT5_EXPORT Document
1142 {
1143  friend class Page;
1144  friend class DocumentData;
1145 
1146 public:
1151  {
1157  UseAttach
1158  };
1159 
1164  {
1171  TwoPageRight
1172  };
1173 
1180  {
1183  QPainterBackend = ArthurBackend
1184  };
1185 
1192  {
1193  Antialiasing = 0x00000001,
1194  TextAntialiasing = 0x00000002,
1195  TextHinting = 0x00000004,
1196  TextSlightHinting = 0x00000008,
1197  OverprintPreview = 0x00000010,
1198  ThinLineSolid = 0x00000020,
1199  ThinLineShape = 0x00000040,
1200  IgnorePaperColor = 0x00000080,
1201  HideAnnotations = 0x00000100
1202  };
1203  Q_DECLARE_FLAGS(RenderHints, RenderHint)
1204 
1205 
1211  {
1214  XfaForm
1215  };
1216 
1229  void setColorDisplayProfile(void *outputProfileA);
1239  void setColorDisplayProfileName(const QString &name);
1250  void *colorRgbProfile() const;
1261  void *colorDisplayProfile() const;
1262 
1280  static Document *load(const QString &filePath, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1281 
1306  static Document *load(QIODevice *device, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1307 
1329  static Document *loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1330 
1348  Page *page(int index) const;
1349 
1362  Page *page(const QString &label) const;
1363 
1367  int numPages() const;
1368 
1375 
1382 
1389  Qt::LayoutDirection textDirection() const;
1390 
1399  bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword);
1400 
1404  bool isLocked() const;
1405 
1421  QDateTime date(const QString &type) const;
1422 
1428  bool setDate(const QString &key, const QDateTime &val);
1429 
1433  QDateTime creationDate() const;
1434 
1440  bool setCreationDate(const QDateTime &val);
1441 
1445  QDateTime modificationDate() const;
1446 
1452  bool setModificationDate(const QDateTime &val);
1453 
1470  QString info(const QString &type) const;
1471 
1477  bool setInfo(const QString &key, const QString &val);
1478 
1482  QString title() const;
1483 
1489  bool setTitle(const QString &val);
1490 
1494  QString author() const;
1495 
1501  bool setAuthor(const QString &val);
1502 
1506  QString subject() const;
1507 
1513  bool setSubject(const QString &val);
1514 
1518  QString keywords() const;
1519 
1525  bool setKeywords(const QString &val);
1526 
1530  QString creator() const;
1531 
1537  bool setCreator(const QString &val);
1538 
1542  QString producer() const;
1543 
1549  bool setProducer(const QString &val);
1550 
1556  bool removeInfo();
1557 
1561  QStringList infoKeys() const;
1562 
1566  bool isEncrypted() const;
1567 
1574  bool isLinearized() const;
1575 
1580  bool okToPrint() const;
1581 
1586  bool okToPrintHighRes() const;
1587 
1595  bool okToChange() const;
1596 
1601  bool okToCopy() const;
1602 
1608  bool okToAddNotes() const;
1609 
1617  bool okToFillForm() const;
1618 
1624  bool okToCreateFormFields() const;
1625 
1632 
1640  bool okToAssemble() const;
1641 
1656  Q_DECL_DEPRECATED void getPdfVersion(int *major, int *minor) const;
1657 
1659  struct PdfVersion
1660  {
1661  int major;
1662  int minor;
1663  };
1664 
1672 
1684  QList<FontInfo> fonts() const;
1685 
1701  FontIterator *newFontIterator(int startPage = 0) const;
1702 
1708  QByteArray fontData(const FontInfo &fi) const;
1709 
1716  QList<EmbeddedFile *> embeddedFiles() const;
1717 
1721  bool hasEmbeddedFiles() const;
1722 
1746  Q_DECL_DEPRECATED QDomDocument *toc() const;
1747 
1755  QVector<OutlineItem> outline() const;
1756 
1765  LinkDestination *linkDestination(const QString &name);
1766 
1772  void setPaperColor(const QColor &color);
1778  QColor paperColor() const;
1779 
1796 
1802  static QSet<RenderBackend> availableRenderBackends();
1803 
1813  void setRenderHint(RenderHint hint, bool on = true);
1819  RenderHints renderHints() const;
1820 
1829 
1838 
1844  QString metadata() const;
1845 
1858  bool hasOptionalContent() const;
1859 
1868 
1877  QStringList scripts() const;
1878 
1891  bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const;
1892 
1899 
1905  QVector<int> formCalculateOrder() const;
1906 
1915  QVector<FormFieldSignature *> signatures() const;
1916 
1922  bool xrefWasReconstructed() const;
1923 
1930  void setXRefReconstructedCallback(const std::function<void()> &callback);
1931 
1936 
1937 private:
1938  Q_DISABLE_COPY(Document)
1939 
1940  DocumentData *m_doc;
1941 
1942  Document(DocumentData *dataA);
1943 };
1944 
1945 class BaseConverterPrivate;
1946 class PSConverterPrivate;
1947 class PDFConverterPrivate;
1955 class POPPLER_QT5_EXPORT BaseConverter
1956 {
1957  friend class Document;
1958 
1959 public:
1963  virtual ~BaseConverter();
1964 
1966  void setOutputFileName(const QString &outputFileName);
1967 
1973  void setOutputDevice(QIODevice *device);
1974 
1980  virtual bool convert() = 0;
1981 
1982  enum Error
1983  {
1984  NoError,
1985  FileLockedError,
1986  OpenOutputError,
1987  NotSupportedInputFileError
1988  };
1989 
1994  Error lastError() const;
1995 
1996 protected:
1998  BaseConverter(BaseConverterPrivate &dd);
1999  Q_DECLARE_PRIVATE(BaseConverter)
2000  BaseConverterPrivate *d_ptr;
2002 
2003 private:
2004  Q_DISABLE_COPY(BaseConverter)
2005 };
2006 
2023 class POPPLER_QT5_EXPORT PSConverter : public BaseConverter
2024 {
2025  friend class Document;
2026 
2027 public:
2034  {
2035  Printing = 0x00000001,
2036  StrictMargins = 0x00000002,
2037  ForceRasterization = 0x00000004,
2038  PrintToEPS = 0x00000008,
2039  HideAnnotations = 0x00000010
2040  };
2041  Q_DECLARE_FLAGS(PSOptions, PSOption)
2042 
2043 
2046  ~PSConverter() override;
2047 
2049  void setPageList(const QList<int> &pageList);
2050 
2054  void setTitle(const QString &title);
2055 
2059  void setHDPI(double hDPI);
2060 
2064  void setVDPI(double vDPI);
2065 
2069  void setRotate(int rotate);
2070 
2074  void setPaperWidth(int paperWidth);
2075 
2079  void setPaperHeight(int paperHeight);
2080 
2084  void setRightMargin(int marginRight);
2085 
2089  void setBottomMargin(int marginBottom);
2090 
2094  void setLeftMargin(int marginLeft);
2095 
2099  void setTopMargin(int marginTop);
2100 
2108  void setStrictMargins(bool strictMargins);
2109 
2111  void setForceRasterize(bool forceRasterize);
2112 
2118  void setPSOptions(PSOptions options);
2119 
2127  PSOptions psOptions() const;
2128 
2136  void setPageConvertedCallback(void (*callback)(int page, void *payload), void *payload);
2137 
2138  bool convert() override;
2139 
2140 private:
2141  Q_DECLARE_PRIVATE(PSConverter)
2142  Q_DISABLE_COPY(PSConverter)
2143 
2144  PSConverter(DocumentData *document);
2145 };
2146 
2152 class POPPLER_QT5_EXPORT PDFConverter : public BaseConverter
2153 {
2154  friend class Document;
2155 
2156 public:
2161  {
2162  WithChanges = 0x00000001
2163  };
2164  Q_DECLARE_FLAGS(PDFOptions, PDFOption)
2165 
2166 
2169  ~PDFConverter() override;
2170 
2174  void setPDFOptions(PDFOptions options);
2178  PDFOptions pdfOptions() const;
2179 
2192  class POPPLER_QT5_EXPORT NewSignatureData
2193  {
2194  public:
2195  NewSignatureData();
2196  ~NewSignatureData();
2197  NewSignatureData(const NewSignatureData &) = delete;
2198  NewSignatureData &operator=(const NewSignatureData &) = delete;
2199 
2200  QString certNickname() const;
2201  void setCertNickname(const QString &certNickname);
2202 
2203  QString password() const;
2204  void setPassword(const QString &password);
2205 
2206  int page() const;
2207  void setPage(int page);
2208 
2209  QRectF boundingRectangle() const;
2210  void setBoundingRectangle(const QRectF &rect);
2211 
2212  QString signatureText() const;
2213  void setSignatureText(const QString &text);
2214 
2222  QString signatureLeftText() const;
2223  void setSignatureLeftText(const QString &text);
2224 
2228  double fontSize() const;
2229  void setFontSize(double fontSize);
2230 
2236  double leftFontSize() const;
2237  void setLeftFontSize(double fontSize);
2238 
2242  QColor fontColor() const;
2243  void setFontColor(const QColor &color);
2244 
2248  QColor borderColor() const;
2249  void setBorderColor(const QColor &color);
2250 
2258  double borderWidth() const;
2259  void setBorderWidth(double width);
2260 
2264  QColor backgroundColor() const;
2265  void setBackgroundColor(const QColor &color);
2266 
2270  QString fieldPartialName() const;
2271  void setFieldPartialName(const QString &name);
2272 
2273  private:
2274  struct NewSignatureDataPrivate;
2275  NewSignatureDataPrivate *const d;
2276  };
2277 
2287  bool sign(const NewSignatureData &data);
2288 
2289  bool convert() override;
2290 
2291 private:
2292  Q_DECLARE_PRIVATE(PDFConverter)
2293  Q_DISABLE_COPY(PDFConverter)
2294 
2295  PDFConverter(DocumentData *document);
2296 };
2297 
2301 POPPLER_QT5_EXPORT Q_DECL_DEPRECATED QDateTime convertDate(char *dateString);
2302 
2308 POPPLER_QT5_EXPORT QDateTime convertDate(const char *dateString);
2309 
2315 POPPLER_QT5_EXPORT bool isCmsAvailable();
2316 
2322 POPPLER_QT5_EXPORT bool isOverprintPreviewAvailable();
2323 
2324 class SoundData;
2334 class POPPLER_QT5_EXPORT SoundObject
2335 {
2336 public:
2341  {
2343  Embedded
2344  };
2345 
2350  {
2354  ALaw
2355  };
2356 
2358  SoundObject(Sound *popplersound);
2360 
2361  ~SoundObject();
2362 
2367 
2371  QString url() const;
2372 
2376  QByteArray data() const;
2377 
2381  double samplingRate() const;
2382 
2386  int channels() const;
2387 
2391  int bitsPerSample() const;
2392 
2397 
2398 private:
2399  Q_DISABLE_COPY(SoundObject)
2400 
2401  SoundData *m_soundData;
2402 };
2403 
2404 class MovieData;
2410 class POPPLER_QT5_EXPORT MovieObject
2411 {
2412  friend class AnnotationPrivate;
2413 
2414 public:
2419  {
2423  PlayPalindrome
2424  };
2425 
2426  ~MovieObject();
2427 
2431  QString url() const;
2432 
2436  QSize size() const;
2437 
2441  int rotation() const;
2442 
2446  bool showControls() const;
2447 
2452 
2457  bool showPosterImage() const;
2458 
2465  QImage posterImage() const;
2466 
2467 private:
2469  MovieObject(AnnotMovie *ann);
2471 
2472  Q_DISABLE_COPY(MovieObject)
2473 
2474  MovieData *m_movieData;
2475 };
2476 
2477 }
2478 
2479 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::PainterFlags)
2480 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::SearchFlags)
2481 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints)
2482 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PDFConverter::PDFOptions)
2483 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PSConverter::PSOptions)
2484 
2485 #endif
Annotation class holding properties shared by all annotations.
Definition: poppler-annotation.h:174
Base converter.
Definition: poppler-qt5.h:1956
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:1142
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:1164
@ TwoPageLeft
Display the pages two at a time, with odd-numbered pages on the left.
Definition: poppler-qt5.h:1170
@ TwoColumnLeft
Display the pages in two columns, with odd-numbered pages on the left.
Definition: poppler-qt5.h:1168
@ SinglePage
Display a single page.
Definition: poppler-qt5.h:1166
@ NoLayout
Layout not specified.
Definition: poppler-qt5.h:1165
@ TwoColumnRight
Display the pages in two columns, with odd-numbered pages on the right.
Definition: poppler-qt5.h:1169
@ OneColumn
Display a single column of pages.
Definition: poppler-qt5.h:1167
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:1180
@ ArthurBackend
Definition: poppler-qt5.h:1182
@ SplashBackend
Splash backend.
Definition: poppler-qt5.h:1181
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:1151
@ UseOutlines
Document outline visible.
Definition: poppler-qt5.h:1153
@ UseNone
No mode - neither document outline nor thumbnail images are visible.
Definition: poppler-qt5.h:1152
@ UseThumbs
Thumbnail images visible.
Definition: poppler-qt5.h:1154
@ FullScreen
Fullscreen mode (no menubar, windows controls etc)
Definition: poppler-qt5.h:1155
@ UseOC
Optional content group panel visible.
Definition: poppler-qt5.h:1156
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:1192
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:1211
@ AcroForm
AcroForm.
Definition: poppler-qt5.h:1213
@ NoForm
Document doesn't contain forms.
Definition: poppler-qt5.h:1212
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:342
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:177
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:185
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:303
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:2411
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:2419
@ PlayRepeat
Play continuously until stopped.
Definition: poppler-qt5.h:2422
@ PlayOnce
Play the movie once, closing the movie controls at the end.
Definition: poppler-qt5.h:2420
@ PlayOpen
Like PlayOnce, but leaving the controls open.
Definition: poppler-qt5.h:2421
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:1020
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:2193
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 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.
Converts a PDF to PDF (thus saves a copy of the document).
Definition: poppler-qt5.h:2153
bool convert() override
Does the conversion.
PDFOption
Options for the PDF export.
Definition: poppler-qt5.h:2161
~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:2024
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:2034
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:432
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:911
@ Seascape
Seascape orientation (portrait, with 270 degrees clockwise rotation)
Definition: poppler-qt5.h:914
@ Landscape
Landscape orientation (portrait, with 90 degrees clockwise rotation )
Definition: poppler-qt5.h:912
@ Portrait
Normal portrait orientation.
Definition: poppler-qt5.h:913
SearchFlag
Flags to modify the search behaviour.
Definition: poppler-qt5.h:765
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:746
@ FromTop
Start sorting at the top of the document.
Definition: poppler-qt5.h:747
@ NextResult
Find the next result, moving "down the page".
Definition: poppler-qt5.h:748
PainterFlag
Additional flags for the renderToPainter method.
Definition: poppler-qt5.h:476
QList< Annotation * > annotations() const
Returns the annotations of the page.
Rotation
The type of rotation to apply for an operation.
Definition: poppler-qt5.h:445
~Page()
Destructor.
Orientation orientation() const
The orientation of the page.
SearchMode
The type of search to perform.
Definition: poppler-qt5.h:756
@ CaseSensitive
Case differences cause no match in searching.
Definition: poppler-qt5.h:757
TextLayout
How the text is going to be returned.
Definition: poppler-qt5.h:466
@ PhysicalLayout
The text is layouted to resemble the real page layout.
Definition: poppler-qt5.h:467
PageAction
The kinds of page actions.
Definition: poppler-qt5.h:456
@ Opening
The action when a page is "opened".
Definition: poppler-qt5.h:457
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:2335
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:2350
@ muLaw
mu-law-encoded samples
Definition: poppler-qt5.h:2353
@ Signed
Twos-complement values.
Definition: poppler-qt5.h:2352
@ Raw
Raw encoding, with unspecified or unsigned values in the range [ 0, 2^B - 1 ].
Definition: poppler-qt5.h:2351
SoundType
The type of sound.
Definition: poppler-qt5.h:2341
@ External
The real sound file is external.
Definition: poppler-qt5.h:2342
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:120
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:47
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:95
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:1660