Poppler Qt5  21.01.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 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 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  *
29  * This program is free software; you can redistribute it and/or modify
30  * it under the terms of the GNU General Public License as published by
31  * the Free Software Foundation; either version 2, or (at your option)
32  * any later version.
33  *
34  * This program is distributed in the hope that it will be useful,
35  * but WITHOUT ANY WARRANTY; without even the implied warranty of
36  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37  * GNU General Public License for more details.
38  *
39  * You should have received a copy of the GNU General Public License
40  * along with this program; if not, write to the Free Software
41  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
42  */
43 
44 #ifndef __POPPLER_QT_H__
45 #define __POPPLER_QT_H__
46 
47 #include "poppler-annotation.h"
48 #include "poppler-link.h"
49 #include "poppler-optcontent.h"
50 #include "poppler-page-transition.h"
51 
52 #include <QtCore/QByteArray>
53 #include <QtCore/QDateTime>
54 #include <QtCore/QSet>
55 #include <QtXml/QDomDocument>
56 #include "poppler-export.h"
57 
58 class EmbFile;
59 class Sound;
60 class AnnotMovie;
61 
65 namespace Poppler {
66 
67 class Document;
68 class DocumentData;
69 
70 class PageData;
71 
72 class FormField;
73 class FormFieldSignature;
74 
75 class TextBoxData;
76 
77 class PDFConverter;
78 class PSConverter;
79 
80 struct OutlineItemData;
81 
91 typedef void (*PopplerDebugFunc)(const QString & /*message*/, const QVariant & /*closure*/);
92 
104 POPPLER_QT5_EXPORT void setDebugErrorFunction(PopplerDebugFunc debugFunction, const QVariant &closure);
105 
115 class POPPLER_QT5_EXPORT TextBox
116 {
117  friend class Page;
118 
119 public:
125  TextBox(const QString &text, const QRectF &bBox);
130 
134  QString text() const;
135 
142  QRectF boundingBox() const;
143 
149  TextBox *nextWord() const;
150 
154  QRectF charBoundingBox(int i) const;
155 
159  bool hasSpaceAfter() const;
160 
161 private:
162  Q_DISABLE_COPY(TextBox)
163 
164  TextBoxData *m_data;
165 };
166 
167 class FontInfoData;
172 class POPPLER_QT5_EXPORT FontInfo
173 {
174  friend class Document;
175 
176 public:
180  enum Type
181  {
182  unknown,
183  Type1,
184  Type1C,
185  Type1COT,
186  Type3,
187  TrueType,
188  TrueTypeOT,
189  CIDType0,
190  CIDType0C,
191  CIDType0COT,
192  CIDTrueType,
193  CIDTrueTypeOT
194  };
195 
197 
200  FontInfo();
201 
205  FontInfo(const FontInfoData &fid);
207 
211  FontInfo(const FontInfo &fi);
212 
217 
221  QString name() const;
222 
227  QString substituteName() const;
228 
233  QString file() const;
234 
240  bool isEmbedded() const;
241 
248  bool isSubset() const;
249 
257  Type type() const;
258 
267  QString typeName() const;
268 
273 
274 private:
275  FontInfoData *m_data;
276 };
277 
278 class FontIteratorData;
298 class POPPLER_QT5_EXPORT FontIterator
299 {
300  friend class Document;
301  friend class DocumentData;
302 
303 public:
308 
313  QList<FontInfo> next();
314 
319  bool hasNext() const;
320 
324  int currentPage() const;
325 
326 private:
327  Q_DISABLE_COPY(FontIterator)
328  FontIterator(int, DocumentData *dd);
329 
330  FontIteratorData *d;
331 };
332 
333 class EmbeddedFileData;
337 class POPPLER_QT5_EXPORT EmbeddedFile
338 {
339  friend class DocumentData;
340  friend class AnnotationPrivate;
341 
342 public:
344  EmbeddedFile(EmbFile *embfile);
346 
351 
355  QString name() const;
356 
362  QString description() const;
363 
369  int size() const;
370 
374  QDateTime modDate() const;
375 
379  QDateTime createDate() const;
380 
386  QByteArray checksum() const;
387 
393  QString mimeType() const;
394 
398  QByteArray data();
399 
405  bool isValid() const;
406 
410  // QDataStream dataStream() const;
411 
412 private:
413  Q_DISABLE_COPY(EmbeddedFile)
414  EmbeddedFile(EmbeddedFileData &dd);
415 
416  EmbeddedFileData *m_embeddedFile;
417 };
418 
427 class POPPLER_QT5_EXPORT Page
428 {
429  friend class Document;
430 
431 public:
435  ~Page();
436 
440  enum Rotation
441  {
442  Rotate0 = 0,
443  Rotate90 = 1,
444  Rotate180 = 2,
445  Rotate270 = 3
446  };
447 
452  {
454  Closing
455  };
456 
462  {
464  RawOrderLayout
465  };
466 
472  {
473  NoPainterFlags = 0x00000000,
481  DontSaveAndRestore = 0x00000001
482  };
483  Q_DECLARE_FLAGS(PainterFlags, PainterFlag)
484 
485 
523  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;
524 
534  typedef void (*RenderToImagePartialUpdateFunc)(const QImage & /*image*/, const QVariant & /*closure*/);
535 
544  typedef bool (*ShouldRenderToImagePartialQueryFunc)(const QVariant & /*closure*/);
545 
595  QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
596  const QVariant &payload) const;
597 
605  typedef bool (*ShouldAbortQueryFunc)(const QVariant & /*closure*/);
606 
660  QImage renderToImage(double xres, double yres, int x, int y, int w, int h, Rotation rotate, RenderToImagePartialUpdateFunc partialUpdateCallback, ShouldRenderToImagePartialQueryFunc shouldDoPartialUpdateCallback,
661  ShouldAbortQueryFunc shouldAbortRenderCallback, const QVariant &payload) const;
662 
705  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;
706 
715  QImage thumbnail() const;
716 
726  QString text(const QRectF &rect, TextLayout textLayout) const;
727 
736  QString text(const QRectF &rect) const;
737 
742  {
745  PreviousResult
746  };
747 
752  {
754  CaseInsensitive
755  };
756 
761  {
762  NoSearchFlags = 0x00000000,
763  IgnoreCase = 0x00000001,
764  WholeWords = 0x00000002,
765  IgnoreDiacritics = 0x00000004
768  };
769  Q_DECLARE_FLAGS(SearchFlags, SearchFlag)
770 
771 
782  Q_DECL_DEPRECATED bool search(const QString &text, double &rectLeft, double &rectTop, double &rectRight, double &rectBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
783 
796  bool search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
797 
809  Q_DECL_DEPRECATED QList<QRectF> search(const QString &text, SearchMode caseSensitive, Rotation rotate = Rotate0) const;
810 
822  QList<QRectF> search(const QString &text, SearchFlags flags = NoSearchFlags, Rotation rotate = Rotate0) const;
823 
840  QList<TextBox *> textList(Rotation rotate = Rotate0) const;
841 
866  QList<TextBox *> textList(Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const;
867 
871  QSizeF pageSizeF() const;
872 
876  QSize pageSize() const;
877 
888  PageTransition *transition() const;
889 
895  Link *action(PageAction act) const;
896 
901  {
905  UpsideDown
906  };
907 
912 
916  void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown);
917 
921  QList<Link *> links() const;
922 
931  QList<Annotation *> annotations() const;
932 
945  QList<Annotation *> annotations(const QSet<Annotation::SubType> &subtypes) const;
946 
954  void addAnnotation(const Annotation *ann);
955 
962  void removeAnnotation(const Annotation *ann);
963 
970  QList<FormField *> formFields() const;
971 
979  double duration() const;
980 
986  QString label() const;
987 
993  int index() const;
994 
995 private:
996  Q_DISABLE_COPY(Page)
997 
998  Page(DocumentData *doc, int index);
999  PageData *m_page;
1000 };
1001 
1009 class POPPLER_QT5_EXPORT OutlineItem
1010 {
1011  friend class Document;
1012 
1013 public:
1018  ~OutlineItem();
1019 
1020  OutlineItem(const OutlineItem &other);
1021  OutlineItem &operator=(const OutlineItem &other);
1022 
1023  OutlineItem(OutlineItem &&other) noexcept;
1024  OutlineItem &operator=(OutlineItem &&other) noexcept;
1025 
1029  bool isNull() const;
1030 
1034  QString name() const;
1035 
1039  bool isOpen() const;
1040 
1046  QSharedPointer<const LinkDestination> destination() const;
1047 
1053  QString externalFileName() const;
1054 
1060  QString uri() const;
1061 
1067  bool hasChildren() const;
1068 
1074  QVector<OutlineItem> children() const;
1075 
1076 private:
1077  OutlineItem(OutlineItemData *data);
1078  OutlineItemData *m_data;
1079 };
1080 
1131 class POPPLER_QT5_EXPORT Document
1132 {
1133  friend class Page;
1134  friend class DocumentData;
1135 
1136 public:
1141  {
1147  UseAttach
1148  };
1149 
1154  {
1161  TwoPageRight
1162  };
1163 
1170  {
1173  QPainterBackend = ArthurBackend
1174  };
1175 
1182  {
1183  Antialiasing = 0x00000001,
1184  TextAntialiasing = 0x00000002,
1185  TextHinting = 0x00000004,
1186  TextSlightHinting = 0x00000008,
1187  OverprintPreview = 0x00000010,
1188  ThinLineSolid = 0x00000020,
1189  ThinLineShape = 0x00000040,
1190  IgnorePaperColor = 0x00000080,
1191  HideAnnotations = 0x00000100
1192  };
1193  Q_DECLARE_FLAGS(RenderHints, RenderHint)
1194 
1195 
1201  {
1204  XfaForm
1205  };
1206 
1219  void setColorDisplayProfile(void *outputProfileA);
1229  void setColorDisplayProfileName(const QString &name);
1240  void *colorRgbProfile() const;
1251  void *colorDisplayProfile() const;
1252 
1270  static Document *load(const QString &filePath, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1271 
1296  static Document *load(QIODevice *device, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1297 
1319  static Document *loadFromData(const QByteArray &fileContents, const QByteArray &ownerPassword = QByteArray(), const QByteArray &userPassword = QByteArray());
1320 
1333  Page *page(int index) const;
1334 
1347  Page *page(const QString &label) const;
1348 
1352  int numPages() const;
1353 
1360 
1367 
1374  Qt::LayoutDirection textDirection() const;
1375 
1384  bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword);
1385 
1389  bool isLocked() const;
1390 
1406  QDateTime date(const QString &type) const;
1407 
1413  bool setDate(const QString &key, const QDateTime &val);
1414 
1418  QDateTime creationDate() const;
1419 
1425  bool setCreationDate(const QDateTime &val);
1426 
1430  QDateTime modificationDate() const;
1431 
1437  bool setModificationDate(const QDateTime &val);
1438 
1455  QString info(const QString &type) const;
1456 
1462  bool setInfo(const QString &key, const QString &val);
1463 
1467  QString title() const;
1468 
1474  bool setTitle(const QString &val);
1475 
1479  QString author() const;
1480 
1486  bool setAuthor(const QString &val);
1487 
1491  QString subject() const;
1492 
1498  bool setSubject(const QString &val);
1499 
1503  QString keywords() const;
1504 
1510  bool setKeywords(const QString &val);
1511 
1515  QString creator() const;
1516 
1522  bool setCreator(const QString &val);
1523 
1527  QString producer() const;
1528 
1534  bool setProducer(const QString &val);
1535 
1541  bool removeInfo();
1542 
1546  QStringList infoKeys() const;
1547 
1551  bool isEncrypted() const;
1552 
1559  bool isLinearized() const;
1560 
1565  bool okToPrint() const;
1566 
1571  bool okToPrintHighRes() const;
1572 
1580  bool okToChange() const;
1581 
1586  bool okToCopy() const;
1587 
1593  bool okToAddNotes() const;
1594 
1602  bool okToFillForm() const;
1603 
1609  bool okToCreateFormFields() const;
1610 
1617 
1625  bool okToAssemble() const;
1626 
1638  void getPdfVersion(int *major, int *minor) const;
1639 
1651  QList<FontInfo> fonts() const;
1652 
1668  FontIterator *newFontIterator(int startPage = 0) const;
1669 
1675  QByteArray fontData(const FontInfo &fi) const;
1676 
1683  QList<EmbeddedFile *> embeddedFiles() const;
1684 
1688  bool hasEmbeddedFiles() const;
1689 
1713  Q_DECL_DEPRECATED QDomDocument *toc() const;
1714 
1722  QVector<OutlineItem> outline() const;
1723 
1732  LinkDestination *linkDestination(const QString &name);
1733 
1739  void setPaperColor(const QColor &color);
1745  QColor paperColor() const;
1746 
1763 
1769  static QSet<RenderBackend> availableRenderBackends();
1770 
1780  void setRenderHint(RenderHint hint, bool on = true);
1786  RenderHints renderHints() const;
1787 
1796 
1805 
1811  QString metadata() const;
1812 
1825  bool hasOptionalContent() const;
1826 
1835 
1844  QStringList scripts() const;
1845 
1858  bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const;
1859 
1866 
1872  QVector<int> formCalculateOrder() const;
1873 
1882  QVector<FormFieldSignature *> signatures() const;
1883 
1888 
1889 private:
1890  Q_DISABLE_COPY(Document)
1891 
1892  DocumentData *m_doc;
1893 
1894  Document(DocumentData *dataA);
1895 };
1896 
1897 class BaseConverterPrivate;
1898 class PSConverterPrivate;
1899 class PDFConverterPrivate;
1907 class POPPLER_QT5_EXPORT BaseConverter
1908 {
1909  friend class Document;
1910 
1911 public:
1915  virtual ~BaseConverter();
1916 
1918  void setOutputFileName(const QString &outputFileName);
1919 
1925  void setOutputDevice(QIODevice *device);
1926 
1932  virtual bool convert() = 0;
1933 
1934  enum Error
1935  {
1936  NoError,
1937  FileLockedError,
1938  OpenOutputError,
1939  NotSupportedInputFileError
1940  };
1941 
1946  Error lastError() const;
1947 
1948 protected:
1950  BaseConverter(BaseConverterPrivate &dd);
1951  Q_DECLARE_PRIVATE(BaseConverter)
1952  BaseConverterPrivate *d_ptr;
1954 
1955 private:
1956  Q_DISABLE_COPY(BaseConverter)
1957 };
1958 
1975 class POPPLER_QT5_EXPORT PSConverter : public BaseConverter
1976 {
1977  friend class Document;
1978 
1979 public:
1986  {
1987  Printing = 0x00000001,
1988  StrictMargins = 0x00000002,
1989  ForceRasterization = 0x00000004,
1990  PrintToEPS = 0x00000008,
1991  HideAnnotations = 0x00000010
1992  };
1993  Q_DECLARE_FLAGS(PSOptions, PSOption)
1994 
1995 
1998  ~PSConverter() override;
1999 
2001  void setPageList(const QList<int> &pageList);
2002 
2006  void setTitle(const QString &title);
2007 
2011  void setHDPI(double hDPI);
2012 
2016  void setVDPI(double vDPI);
2017 
2021  void setRotate(int rotate);
2022 
2026  void setPaperWidth(int paperWidth);
2027 
2031  void setPaperHeight(int paperHeight);
2032 
2036  void setRightMargin(int marginRight);
2037 
2041  void setBottomMargin(int marginBottom);
2042 
2046  void setLeftMargin(int marginLeft);
2047 
2051  void setTopMargin(int marginTop);
2052 
2060  void setStrictMargins(bool strictMargins);
2061 
2063  void setForceRasterize(bool forceRasterize);
2064 
2070  void setPSOptions(PSOptions options);
2071 
2079  PSOptions psOptions() const;
2080 
2088  void setPageConvertedCallback(void (*callback)(int page, void *payload), void *payload);
2089 
2090  bool convert() override;
2091 
2092 private:
2093  Q_DECLARE_PRIVATE(PSConverter)
2094  Q_DISABLE_COPY(PSConverter)
2095 
2096  PSConverter(DocumentData *document);
2097 };
2098 
2104 class POPPLER_QT5_EXPORT PDFConverter : public BaseConverter
2105 {
2106  friend class Document;
2107 
2108 public:
2113  {
2114  WithChanges = 0x00000001
2115  };
2116  Q_DECLARE_FLAGS(PDFOptions, PDFOption)
2117 
2118 
2121  ~PDFConverter() override;
2122 
2126  void setPDFOptions(PDFOptions options);
2130  PDFOptions pdfOptions() const;
2131 
2143  class POPPLER_QT5_EXPORT NewSignatureData
2144  {
2145  public:
2146  NewSignatureData();
2147  ~NewSignatureData();
2148  NewSignatureData(const NewSignatureData &) = delete;
2149  NewSignatureData &operator=(const NewSignatureData &) = delete;
2150 
2151  QString certNickname() const;
2152  void setCertNickname(const QString &certNickname);
2153 
2154  QString password() const;
2155  void setPassword(const QString &password);
2156 
2157  int page() const;
2158  void setPage(int page);
2159 
2160  QRectF boundingRectangle() const;
2161  void setBoundingRectangle(const QRectF &rect);
2162 
2163  QString signatureText() const;
2164  void setSignatureText(const QString &text);
2165 
2169  double fontSize() const;
2170  void setFontSize(double fontSize);
2171 
2175  QColor fontColor() const;
2176  void setFontColor(const QColor &color);
2177 
2181  QColor borderColor() const;
2182  void setBorderColor(const QColor &color);
2183 
2187  QColor backgroundColor() const;
2188  void setBackgroundColor(const QColor &color);
2189 
2193  QString fieldPartialName() const;
2194  void setFieldPartialName(const QString &name);
2195 
2196  private:
2197  struct NewSignatureDataPrivate;
2198  NewSignatureDataPrivate *const d;
2199  };
2200 
2210  bool sign(const NewSignatureData &data);
2211 
2212  bool convert() override;
2213 
2214 private:
2215  Q_DECLARE_PRIVATE(PDFConverter)
2216  Q_DISABLE_COPY(PDFConverter)
2217 
2218  PDFConverter(DocumentData *document);
2219 };
2220 
2224 POPPLER_QT5_EXPORT Q_DECL_DEPRECATED QDateTime convertDate(char *dateString);
2225 
2231 POPPLER_QT5_EXPORT QDateTime convertDate(const char *dateString);
2232 
2238 POPPLER_QT5_EXPORT bool isCmsAvailable();
2239 
2245 POPPLER_QT5_EXPORT bool isOverprintPreviewAvailable();
2246 
2247 class SoundData;
2257 class POPPLER_QT5_EXPORT SoundObject
2258 {
2259 public:
2264  {
2266  Embedded
2267  };
2268 
2273  {
2277  ALaw
2278  };
2279 
2281  SoundObject(Sound *popplersound);
2283 
2284  ~SoundObject();
2285 
2290 
2294  QString url() const;
2295 
2299  QByteArray data() const;
2300 
2304  double samplingRate() const;
2305 
2309  int channels() const;
2310 
2314  int bitsPerSample() const;
2315 
2320 
2321 private:
2322  Q_DISABLE_COPY(SoundObject)
2323 
2324  SoundData *m_soundData;
2325 };
2326 
2327 class MovieData;
2333 class POPPLER_QT5_EXPORT MovieObject
2334 {
2335  friend class AnnotationPrivate;
2336 
2337 public:
2342  {
2346  PlayPalindrome
2347  };
2348 
2349  ~MovieObject();
2350 
2354  QString url() const;
2355 
2359  QSize size() const;
2360 
2364  int rotation() const;
2365 
2369  bool showControls() const;
2370 
2375 
2380  bool showPosterImage() const;
2381 
2388  QImage posterImage() const;
2389 
2390 private:
2392  MovieObject(AnnotMovie *ann);
2394 
2395  Q_DISABLE_COPY(MovieObject)
2396 
2397  MovieData *m_movieData;
2398 };
2399 
2400 }
2401 
2402 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::PainterFlags)
2403 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Page::SearchFlags)
2404 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints)
2405 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PDFConverter::PDFOptions)
2406 Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PSConverter::PSOptions)
2407 
2408 #endif
Annotation class holding properties shared by all annotations.
Definition: poppler-annotation.h:174
Base converter.
Definition: poppler-qt5.h:1908
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:1132
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:1154
@ TwoPageLeft
Display the pages two at a time, with odd-numbered pages on the left.
Definition: poppler-qt5.h:1160
@ TwoColumnLeft
Display the pages in two columns, with odd-numbered pages on the left.
Definition: poppler-qt5.h:1158
@ SinglePage
Display a single page.
Definition: poppler-qt5.h:1156
@ NoLayout
Layout not specified.
Definition: poppler-qt5.h:1155
@ TwoColumnRight
Display the pages in two columns, with odd-numbered pages on the right.
Definition: poppler-qt5.h:1159
@ OneColumn
Display a single column of pages.
Definition: poppler-qt5.h:1157
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:1170
@ ArthurBackend
Definition: poppler-qt5.h:1172
@ SplashBackend
Splash backend.
Definition: poppler-qt5.h:1171
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:1141
@ UseOutlines
Document outline visible.
Definition: poppler-qt5.h:1143
@ UseNone
No mode - neither document outline nor thumbnail images are visible.
Definition: poppler-qt5.h:1142
@ UseThumbs
Thumbnail images visible.
Definition: poppler-qt5.h:1144
@ FullScreen
Fullscreen mode (no menubar, windows controls etc)
Definition: poppler-qt5.h:1145
@ UseOC
Optional content group panel visible.
Definition: poppler-qt5.h:1146
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:1182
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.
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:1201
@ AcroForm
AcroForm.
Definition: poppler-qt5.h:1203
@ NoForm
Document doesn't contain forms.
Definition: poppler-qt5.h:1202
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.
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:338
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:173
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:181
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:299
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:2334
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:2342
@ PlayRepeat
Play continuously until stopped.
Definition: poppler-qt5.h:2345
@ PlayOnce
Play the movie once, closing the movie controls at the end.
Definition: poppler-qt5.h:2343
@ PlayOpen
Like PlayOnce, but leaving the controls open.
Definition: poppler-qt5.h:2344
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:1010
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:2144
QColor backgroundColor() const
Default: QColor(240, 240, 240)
QColor fontColor() const
Default: red.
QColor borderColor() const
Default: red.
double fontSize() const
Default: 10.
QString fieldPartialName() const
Default: QUuid::createUuid().toString()
Converts a PDF to PDF (thus saves a copy of the document).
Definition: poppler-qt5.h:2105
bool convert() override
Does the conversion.
PDFOption
Options for the PDF export.
Definition: poppler-qt5.h:2113
~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:1976
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:1986
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:428
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:901
@ Seascape
Seascape orientation (portrait, with 270 degrees clockwise rotation)
Definition: poppler-qt5.h:904
@ Landscape
Landscape orientation (portrait, with 90 degrees clockwise rotation )
Definition: poppler-qt5.h:902
@ Portrait
Normal portrait orientation.
Definition: poppler-qt5.h:903
SearchFlag
Flags to modify the search behaviour.
Definition: poppler-qt5.h:761
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:742
@ FromTop
Start sorting at the top of the document.
Definition: poppler-qt5.h:743
@ NextResult
Find the next result, moving "down the page".
Definition: poppler-qt5.h:744
PainterFlag
Additional flags for the renderToPainter method.
Definition: poppler-qt5.h:472
QList< Annotation * > annotations() const
Returns the annotations of the page.
Rotation
The type of rotation to apply for an operation.
Definition: poppler-qt5.h:441
~Page()
Destructor.
Orientation orientation() const
The orientation of the page.
SearchMode
The type of search to perform.
Definition: poppler-qt5.h:752
@ CaseSensitive
Case differences cause no match in searching.
Definition: poppler-qt5.h:753
TextLayout
How the text is going to be returned.
Definition: poppler-qt5.h:462
@ PhysicalLayout
The text is layouted to resemble the real page layout.
Definition: poppler-qt5.h:463
PageAction
The kinds of page actions.
Definition: poppler-qt5.h:452
@ Opening
The action when a page is "opened".
Definition: poppler-qt5.h:453
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:2258
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:2273
@ muLaw
mu-law-encoded samples
Definition: poppler-qt5.h:2276
@ Signed
Twos-complement values.
Definition: poppler-qt5.h:2275
@ Raw
Raw encoding, with unspecified or unsigned values in the range [ 0, 2^B - 1 ].
Definition: poppler-qt5.h:2274
SoundType
The type of sound.
Definition: poppler-qt5.h:2264
@ External
The real sound file is external.
Definition: poppler-qt5.h:2265
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:116
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:91
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.