XpdfWidget/Qt
XpdfWidget.h
Go to the documentation of this file.
1 //========================================================================
2 //
3 // XpdfWidget.h
4 //
5 // Copyright 2009-2021 Glyph & Cog, LLC
6 //
7 //========================================================================
8 
16 
18 
19 #ifndef XPDFWIDGET_H
20 #define XPDFWIDGET_H
21 
22 #include <aconf.h>
23 
24 #ifdef USE_GCC_PRAGMAS
25 #pragma interface
26 #endif
27 
28 #include <QAbstractScrollArea>
29 
30 class QMutex;
31 class QTimer;
32 #if XPDFWIDGET_PRINTING
33 class QPrinter;
34 class QPrintDialog;
35 #endif
36 
37 class GString;
38 class PDFDoc;
39 class QtPDFCore;
40 
41 //------------------------------------------------------------------------
42 
43 #ifdef HIGHLIGHTED_REGIONS
44 
45 typedef void *XpdfRegionHandle;
46 #endif
47 
49 typedef void *XpdfOutlineHandle;
50 
52 typedef void *XpdfLayerHandle;
53 
55 typedef void *XpdfLayerOrderHandle;
56 
58 typedef void *XpdfAnnotHandle;
59 
61 typedef void *XpdfFormFieldHandle;
62 
64 typedef void *XpdfDocHandle;
65 
66 //------------------------------------------------------------------------
67 
70 
72  XpdfFindResult(int pageA, double xMinA, double yMinA,
73  double xMaxA, double yMaxA)
74  : page(pageA), xMin(xMinA), yMin(yMinA), xMax(xMaxA), yMax(yMaxA) {}
75  XpdfFindResult(): page(0), xMin(0), yMin(0), xMax(0), yMax(0) {}
77 
79  int page;
80 
82  double xMin, yMin, xMax, yMax;
85 };
86 
87 //------------------------------------------------------------------------
88 
90 class XpdfWidget: public QAbstractScrollArea {
91  Q_OBJECT
92 
93 public:
94 
96  enum ErrorCode {
97  pdfOk = 0,
101  pdfErrEncrypted = 4,
103  pdfErrHighlightFile = 5,
110  pdfErrNoHandle = 1001,
112  pdfErrBusy = 1003,
113  pdfErrBadArg = 1004
114  };
115 
117  enum DisplayMode {
123  };
124 
127 
128  static const int zoomToPage = -1;
129  static const int zoomToWidth = -2;
130  static const int zoomToHeight = -3;
131 
132 
135 
136  static const int findBackward = 0x00000001;
139  static const int findCaseSensitive = 0x00000002;
141  static const int findNext = 0x00000004;
143  static const int findOnePageOnly = 0x00000008;
145  static const int findWholeWord = 0x00000010;
147 
158  static void init(const QString &configFileName = QString());
159 
162  static void setConfig(const QString &command);
163 
171  XpdfWidget(const QColor &paperColor = QColor(0xff, 0xff, 0xff),
172  const QColor &matteColor = QColor(0x80, 0x80, 0x80),
173  bool reverseVideo = false, QWidget *parentA = 0);
174 
184  XpdfWidget(QWidget *parentA,
185  const QColor &paperColor = QColor(0xff, 0xff, 0xff),
186  const QColor &matteColor = QColor(0x80, 0x80, 0x80),
187  bool reverseVideo = false);
188 
190  virtual ~XpdfWidget();
191 
196  void enableHyperlinks(bool on);
197 
204  void enableExternalHyperlinks(bool on);
205 
211  void enableSelect(bool on);
212 
217  void enablePan(bool on);
218 
222  void enableTouchPan(bool on);
223 
227  void enableTouchZoom(bool on);
228 
233  void setKeyPassthrough(bool on) { keyPassthrough = on; }
234 
240  void setMousePassthrough(bool on) { mousePassthrough = on; }
241 
247  void showPasswordDialog(bool showDlg);
248 
251  void setMatteColor(const QColor &matteColor);
252 
254  void setReverseVideo(bool reverse);
255 
258  void setCursor(const QCursor &cursor);
259 
261  void unsetCursor();
262 
268  ErrorCode loadFile(const QString &fileName,
269  const QString &password = "");
270 
277  ErrorCode loadMem(const char *buffer, unsigned int bufferLength,
278  const QString &password = "");
279 
281 
298  const QString &fileName,
299  const QString &password = "");
300 
307 
315  void freeDoc(XpdfDocHandle doc);
316 
323  ErrorCode reload();
324 
329  void closeFile();
330 
334  ErrorCode saveAs(const QString &fileName);
335 
337  QString getFileName() const;
338 
340  bool hasOpenDocument() const;
341 
344  int getNumPages() const;
345 
348  int getCurrentPage() const;
349 
352  int getMidPage() const;
353 
355  void gotoPage(int pageNum);
356 
361  void gotoFirstPage();
362 
367  void gotoLastPage();
368 
370  void gotoNextPage(bool scrollToTop = true);
371 
373  void gotoPreviousPage(bool scrollToTop = true);
374 
376  bool gotoNamedDestination(const QString &dest);
377 
379  void goForward();
380 
382  void goBackward();
383 
385  void scrollPageUp();
386 
388  void scrollPageDown();
389 
392  void scrollTo(int xx, int yy);
393 
398  void scrollBy(int dx, int dy);
399 
401  int getScrollX() const;
402 
404  int getScrollY() const;
405 
409  void setZoom(double zoom);
410 
414  double getZoom() const;
415 
420  double getZoomPercent(int page = 1) const;
421 
427  void zoomToRect(int page, double xMin, double yMin,
428  double xMax, double yMax);
429 
432  void zoomCentered(double zoom);
433 
436  void zoomToCurrentWidth();
437 
440  void setRotate(int rotate);
441 
444  int getRotate() const;
445 
451  void setContinuousMode(bool continuous);
452 
455  bool getContinuousMode() const;
456 
458  void setDisplayMode(DisplayMode mode);
459 
462 
464  bool mouseOverLink();
465 
469  bool onLink(int page, double xx, double yy);
470 
476  QString getLinkInfo(int page, double xx, double yy);
477 
482  QString getMouseLinkInfo();
483 
487  bool gotoLinkAt(int page, double xx, double yy);
488 
492  XpdfAnnotHandle onAnnot(int page, double xx, double yy);
493 
495  QString getAnnotType(XpdfAnnotHandle annot);
496 
499  QString getAnnotContent(XpdfAnnotHandle annot);
500 
504  XpdfFormFieldHandle onFormField(int page, double xx, double yy);
505 
507  QString getFormFieldType(XpdfFormFieldHandle field);
508 
510  QString getFormFieldName(XpdfFormFieldHandle field);
511 
514  QString getFormFieldValue(XpdfFormFieldHandle field);
515 
517  void getFormFieldBBox(XpdfFormFieldHandle field, int *pageNum,
518  double *xMin, double *yMin,
519  double *xMax, double *yMax);
520 
523  bool convertWindowToPDFCoords(int winX, int winY,
524  int *page, double *pdfX, double *pdfY);
525 
527  void convertPDFToWindowCoords(int page, double pdfX, double pdfY,
528  int *winX, int *winY);
529 
533  void enableRedraw(bool enable);
534 
545  void getPageBox(int page, const QString &box,
546  double *xMin, double *yMin, double *xMax, double *yMax) const;
547 
551  double getPageWidth(int page) const;
552 
556  double getPageHeight(int page) const;
557 
561  int getPageRotation(int page) const;
562 
565  bool hasSelection();
566 
572  bool getCurrentSelection(int *page, double *x0, double *y0,
573  double *x1, double *y1) const;
574 
578  void setCurrentSelection(int page, double x0, double y0,
579  double x1, double y1);
580 
582  void clearSelection();
583 
586  bool isBlockSelectMode();
587 
590  bool isLinearSelectMode();
591 
595  void setBlockSelectMode();
596 
600  void setLinearSelectMode();
601 
603  void setSelectionColor(const QColor &selectionColor);
604 
605 #ifdef HIGHLIGHTED_REGIONS
606  XpdfRegionHandle addRegion(int page,
614  double x0, double y0,
615  double x1, double y1,
616  const QColor &color, const QColor &selectColor,
617  bool selectable, const QString &label);
618 
620  void setRegionLabel(XpdfRegionHandle region, const QString &label);
621 
623  void setRegionResizable(XpdfRegionHandle region, bool resizable);
624 
627  void deleteRegion(XpdfRegionHandle region);
628 
631  void deleteAllRegions();
632 
634  int getNumRegions() const;
635 
639  XpdfRegionHandle getRegion(int idx) const;
640 
644  XpdfRegionHandle getSelectedRegion() const;
645 
647  void setSelectedRegion(XpdfRegionHandle region);
648 
652  void makeRegionVisible(XpdfRegionHandle region);
653 
658  void getRegionInfo(XpdfRegionHandle region,
659  int *page, double *x0, double *y0,
660  double *x1, double *y1,
661  QColor *color, QColor *selectColor,
662  QString *label) const;
663 #endif
664 
666  void forceRedraw();
667 
668 #if XPDFWIDGET_PRINTING
669  bool okToPrint() const;
678 
684  ErrorCode print(bool showDialog);
685 
688  ErrorCode print(QPrinter *prt);
689 
692  void cancelPrint() { printCanceled = true; }
693 
694  void updatePrintStatus(int nextPage, int firstPage, int lastPage);
695  bool isPrintCanceled() { return printCanceled; }
696 
701  void setPrintDPI(int hDPI, int vDPI);
702 #endif // XPDFWIDGET_PRINTING
703 
707  QImage convertPageToImage(int page, double dpi);
708 
713  QImage convertRegionToImage(int page, double x0, double y0,
714  double x1, double y1, double dpi);
715 
722  QImage getThumbnail(int page);
723 
732  bool okToExtractText() const;
733 
742  void setTextEncoding(const QString &encodingName);
743 
751  QString extractText(int page, double x0, double y0,
752  double x1, double y1);
753 
757  QString getSelectedText();
758 
760  void copySelection();
761 
775  bool find(const QString &text, int flags = 0);
776 
785  QVector<XpdfFindResult> findAll(const QString &text, int firstPage,
786  int lastPage, int flags = 0);
787 
790  bool hasPageLabels();
791 
796  QString getPageLabelFromPageNum(int pageNum);
797 
802  int getPageNumFromPageLabel(QString pageLabel);
803 
808 
813 
818 
821  QString getOutlineTitle(XpdfOutlineHandle outline);
822 
825 
828 
830  void gotoOutlineTarget(XpdfOutlineHandle outline);
831 
834  int getNumLayers() const;
835 
838  XpdfLayerHandle getLayer(int idx) const;
839 
842  QString getLayerName(XpdfLayerHandle layer) const;
843 
846  bool getLayerVisibility(XpdfLayerHandle layer) const;
847 
852  void setLayerVisibility(XpdfLayerHandle layer, bool visibility);
853 
859  int getLayerViewState(XpdfLayerHandle layer) const;
860 
866  int getLayerPrintState(XpdfLayerHandle layer) const;
867 
870 
874  bool getLayerOrderIsName(XpdfLayerOrderHandle order) const;
875 
878  QString getLayerOrderName(XpdfLayerOrderHandle order) const;
879 
882 
886 
889 
894 
896  int getNumEmbeddedFiles();
897 
899  QString getEmbeddedFileName(int idx);
900 
903  bool saveEmbeddedFile(int idx, QString fileName);
904 
905  //--- for internal use
906 
908 
909  virtual QSize sizeHint() const;
910  QtPDFCore *getCore() { return core; }
911 
913 
914 signals:
915 
920  void pageChange(int pageNum);
921 
927  void midPageChange(int pageNum);
928 
930  void preLoad();
931 
933  void postLoad();
934 
936  void keyPress(QKeyEvent *e);
937 
939  void mousePress(QMouseEvent *e);
940 
942  void mouseRelease(QMouseEvent *e);
943 
949  void mouseClick(QMouseEvent *e);
950 
957  void mouseDoubleClick(QMouseEvent *e);
958 
966  void mouseTripleClick(QMouseEvent *e);
967 
969  void mouseMove(QMouseEvent *e);
970 
972  void mouseWheel(QWheelEvent *e);
973 
990  void linkClick(const QString &linkType, const QString &dest, int page);
991 
994  void selectDone();
995 
1000  void paintDone(bool finished);
1001 
1003  void resized();
1004 
1005 #ifdef HIGHLIGHTED_REGIONS
1006  void regionSelected(XpdfRegionHandle region);
1008 
1010  void regionChanged(XpdfRegionHandle region);
1011 #endif
1012 
1013 #if XPDFWIDGET_PRINTING
1014  void printStatus(int nextPage, int firstPage, int lastPage);
1020 #endif
1021 
1023 
1024  void tileDone();
1025 
1027 
1028 protected:
1029 
1031 
1032  virtual void paintEvent(QPaintEvent *eventA);
1033  virtual void resizeEvent(QResizeEvent *eventA);
1034  virtual void scrollContentsBy(int dx, int dy);
1035  virtual void keyPressEvent(QKeyEvent *e);
1036  virtual void mousePressEvent(QMouseEvent *e);
1037  virtual void mouseReleaseEvent(QMouseEvent *e);
1038  virtual void mouseMoveEvent(QMouseEvent *e);
1039  virtual void wheelEvent(QWheelEvent *e);
1040  virtual bool eventFilter(QObject *obj, QEvent *event);
1041 
1043 
1044 private slots:
1045 
1046  void tick();
1047 
1048 private:
1049 
1050  void setup(const QColor &paperColor, const QColor &matteColor,
1051  bool reverseVideo);
1052  static void updateCbk(void *data, GString *fileName,
1053  int pageNum, int numPages,
1054  const char *linkLabel);
1055  static void midPageChangedCbk(void *data, int pageNum);
1056  static void preLoadCbk(void *data);
1057  static void postLoadCbk(void *data);
1058  static void linkCbk(void *data, const char *type,
1059  const char *dest, int page);
1060  static void selectDoneCbk(void *data);
1061  static void paintDoneCbk(void *data, bool finished);
1062  static void tileDoneCbk(void *data);
1063 #ifdef HIGHLIGHTED_REGIONS
1064  static void regionSelectedCbk(void *data);
1065  static void regionChangedCbk(void *data);
1066 #endif
1067 
1068  friend class XpdfViewer;
1069  bool getLinkTarget(int page, double xx, double yy,
1070  QString &targetFileName, int &targetPage,
1071  QString &targetDest);
1072 
1073 #if XPDFWIDGET_PRINTING
1074  QPrinter *printerForDialog;
1075  QPrintDialog *printDialog;
1076  int printHDPI, printVDPI;
1077  bool printCanceled;
1078 #endif
1079 
1080  static QMutex initMutex;
1081 
1082  QtPDFCore *core;
1083  double scaleFactor;
1084 
1085  bool keyPassthrough;
1086  bool mousePassthrough;
1087  int lastMousePressX[3], lastMousePressY[3];
1088  ulong lastMousePressTime[3];
1089  bool lastMouseEventWasPress;
1090 
1091  bool touchPanEnabled;
1092  bool touchZoomEnabled;
1093  double pinchZoomStart;
1094 
1095  QTimer *tickTimer;
1096 };
1097 
1098 #endif
bool hasPageLabels()
Check if the PDF file has page labels.
void setMatteColor(const QColor &matteColor)
Set the matte color, i.e., the color used for background outside the actual page area.
void setLinearSelectMode()
Set linear selection mode.
ErrorCode loadMem(const char *buffer, unsigned int bufferLength, const QString &password="")
Load a PDF file from a memory buffer and display its first page.
static void setConfig(const QString &command)
Process a configuration command, i.e., one line of an xpdfrc file.
ErrorCode loadDoc(XpdfDocHandle doc)
Load a PDF document and display its first page.
QImage convertPageToImage(int page, double dpi)
Convert a page to a color image.
ErrorCode loadFile(const QString &fileName, const QString &password="")
Load a PDF file and display its first page.
static const int findWholeWord
limit the search to whole words
Definition: XpdfWidget.h:145
bool okToExtractText() const
Checks to see if text extraction is allowed.
facing pages, stacked vertically
Definition: XpdfWidget.h:121
void mouseMove(QMouseEvent *e)
This signal is emitted whenever the mouse pointer is moved.
file I/O error
Definition: XpdfWidget.h:109
void * XpdfDocHandle
Definition: XpdfWidget.h:64
void selectDone()
This signal is emitted when the user selects an area.
int getNumLayers() const
Return the number of layers in the PDF file.
static const int findNext
start searching from the previous search result
Definition: XpdfWidget.h:141
virtual ~XpdfWidget()
Destroys the XpdfWidget.
static void init(const QString &configFileName=QString())
Initialize the XpdfWidget class, reading a configuration file.
file was encrypted and password was incorrect or not supplied
Definition: XpdfWidget.h:102
nonexistent or invalid highlight file
Definition: XpdfWidget.h:104
QString getFormFieldName(XpdfFormFieldHandle field)
Get the form field's name.
static const int findBackward
search backward from the starting point
Definition: XpdfWidget.h:137
ErrorCode readDoc(XpdfDocHandle *docPtr, const QString &fileName, const QString &password="")
Load a PDF file and return a handle.
QString getOutlineTitle(XpdfOutlineHandle outline)
Get the title of an outline tree node.
static const int zoomToPage
zoom to fit whole page
Definition: XpdfWidget.h:128
bool getOutlineStartsOpen(XpdfOutlineHandle outline)
Return true if the specified outline entry starts open.
static const int zoomToWidth
zoom to fit page width
Definition: XpdfWidget.h:129
void zoomCentered(double zoom)
Set the zoom factor, while maintaining the current center.
PDF component is busy.
Definition: XpdfWidget.h:112
QString getAnnotContent(XpdfAnnotHandle annot)
Get the annotation's content.
void clearSelection()
Clear the selection.
bool mouseOverLink()
Returns true if the mouse is currently over a hyperlink.
int getScrollY() const
Return the current scroll position y coordinate.
ErrorCode saveAs(const QString &fileName)
Save the PDF file with another name.
void postLoad()
This signal is emitted just after a PDF file is loaded.
couldn't open the PDF file
Definition: XpdfWidget.h:98
bool saveEmbeddedFile(int idx, QString fileName)
Save the idx 'th embedded file with the specified file name.
void * XpdfOutlineHandle
Definition: XpdfWidget.h:39
void getPageBox(int page, const QString &box, double *xMin, double *yMin, double *xMax, double *yMax) const
Return the coordinates of the specified page box.
void enableTouchZoom(bool on)
Control touchscreen zooming.
void gotoLastPage()
Display the last page.
void enablePan(bool on)
Control mouse panning.
QString getFormFieldValue(XpdfFormFieldHandle field)
Get the form field's content.
invalid page number
Definition: XpdfWidget.h:108
void enableRedraw(bool enable)
Enable or disable window redraws.
bool find(const QString &text, int flags=0)
Find a text string.
bool hasSelection()
Check to see if there is a selection.
int getOutlineTargetPage(XpdfOutlineHandle outline)
Return the target page number for the specified outline entry.
void mouseDoubleClick(QMouseEvent *e)
This signal is emitted whenever a mouse button is double-clicked.
bool isLinearSelectMode()
Check for linear selection mode.
void convertPDFToWindowCoords(int page, double pdfX, double pdfY, int *winX, int *winY)
Convert PDF coordinates to window coordinates.
pages stacked vertically
Definition: XpdfWidget.h:119
double getPageWidth(int page) const
Return the width of the specified page.
void mouseClick(QMouseEvent *e)
This signal is emitted whenever a mouse button is clicked.
void zoomToCurrentWidth()
Zoom so that the current page(s) fill the window width.
void keyPress(QKeyEvent *e)
This signal is emitted whenever a key is pressed.
void mousePress(QMouseEvent *e)
This signal is emitted whenever a mouse button is pressed.
void setLayerVisibility(XpdfLayerHandle layer, bool visibility)
Set the visibility state of a layer.
int getNumEmbeddedFiles()
Return the number of embedded files in the current PDF file.
void * XpdfAnnotHandle
Definition: XpdfWidget.h:58
QString getFormFieldType(XpdfFormFieldHandle field)
Get the form field's type.
void setBlockSelectMode()
Set block selection mode.
void paintDone(bool finished)
This signal is emitted whenever the widget is repainted.
void setMousePassthrough(bool on)
Control mouse event passthrough.
Definition: XpdfWidget.h:240
ErrorCode
Error codes returned by certain XpdfViewer functions.
Definition: XpdfWidget.h:96
XpdfOutlineHandle getOutlineParent(XpdfOutlineHandle outline)
Return the parent of an outline tree node.
QString getEmbeddedFileName(int idx)
Return the name of the idx 'th embedded file.
void freeDoc(XpdfDocHandle doc)
Free a PDF document.
double getPageHeight(int page) const
Return the height of the specified page.
void enableHyperlinks(bool on)
Control handling of hyperlinks.
XpdfLayerHandle getLayerOrderLayer(XpdfLayerOrderHandle order)
Get the layer associated with a layer display order tree node.
QString getSelectedText()
Get the currently selected text.
A PDF viewer widget class for Qt.
Definition: XpdfWidget.h:90
XpdfLayerHandle getLayer(int idx) const
Get a layer handle.
XpdfLayerOrderHandle getLayerOrderChild(XpdfLayerOrderHandle order, int idx)
Returns the idx 'th child of a layer display order tree node.
QImage getThumbnail(int page)
Retrieve an embedded thumbnail image.
bool getContinuousMode() const
Return true if the viewer is in continuous view mode, or false if it is in any other mode...
void setReverseVideo(bool reverse)
Turn reverse video mode on/off. The default is off.
void setCursor(const QCursor &cursor)
Set the cursor.
int getNumPages() const
Return the number of pages in the currently open PDF file.
XpdfLayerOrderHandle getLayerOrderRoot() const
Get the root of the layer display order tree.
void linkClick(const QString &linkType, const QString &dest, int page)
This signal is emitted whenever the user clicks on a hyperlink.
QString getFileName() const
Get the file name of the currently open PDF file.
XpdfOutlineHandle getOutlineChild(XpdfOutlineHandle outline, int idx)
Return a child of an outline tree node.
void setCurrentSelection(int page, double x0, double y0, double x1, double y1)
Set the selection.
void copySelection()
Copy the current selection to the clipboard.
void setKeyPassthrough(bool on)
Control keypress passthrough.
Definition: XpdfWidget.h:233
int getLayerOrderNumChildren(XpdfLayerOrderHandle order)
Returns the number of children attached to a layer display order tree node.
void showPasswordDialog(bool showDlg)
Control the password dialog.
void setSelectionColor(const QColor &selectionColor)
Set the selection color.
bool convertWindowToPDFCoords(int winX, int winY, int *page, double *pdfX, double *pdfY)
Convert window coordinates to PDF coordinates.
bool hasOpenDocument() const
Returns true if there is currently a PDF file open.
void enableSelect(bool on)
Control handling of text selection.
bool getCurrentSelection(int *page, double *x0, double *y0, double *x1, double *y1) const
Returns the current selection.
XpdfFormFieldHandle onFormField(int page, double xx, double yy)
Check for a form field containing the specified point.
void goForward()
Go forward along the history list.
two facing pages
Definition: XpdfWidget.h:120
single page
Definition: XpdfWidget.h:118
QString getLayerOrderName(XpdfLayerOrderHandle order) const
Get the name of a layer display order tree node.
bool gotoNamedDestination(const QString &dest)
Go to a named destination.
NULL object handle.
Definition: XpdfWidget.h:110
pages stacked horizontally
Definition: XpdfWidget.h:122
invalid argument
Definition: XpdfWidget.h:113
XpdfAnnotHandle onAnnot(int page, double xx, double yy)
Check for an annotation containing the specified point.
QString getLayerName(XpdfLayerHandle layer) const
Get the name of a layer.
void forceRedraw()
Force a complete redraw.
bool onLink(int page, double xx, double yy)
Returns true if the specified coordinates are inside a hyperlink.
int getPageRotation(int page) const
Get the default rotation for the specified page.
PDF file was damaged and couldn't be repaired.
Definition: XpdfWidget.h:100
void midPageChange(int pageNum)
This signal is emitted whenever the page shown at the middle of the window changes.
void setZoom(double zoom)
Change the zoom factor.
DisplayMode getDisplayMode()
Return the current display mode.
bool isBlockSelectMode()
Check for block selection mode.
int getRotate() const
Return the current page rotation.
static const int findOnePageOnly
limit the search to the current page
Definition: XpdfWidget.h:143
double getZoom() const
Return the current zoom factor.
void gotoNextPage(bool scrollToTop=true)
Display the next page.
void setTextEncoding(const QString &encodingName)
Set the encoding to use for text extraction.
XpdfWidget(const QColor &paperColor=QColor(0xff, 0xff, 0xff), const QColor &matteColor=QColor(0x80, 0x80, 0x80), bool reverseVideo=false, QWidget *parentA=0)
The XpdfWidget constructor.
void setRotate(int rotate)
Change the page rotation.
void gotoPreviousPage(bool scrollToTop=true)
Display the previous page.
void mouseTripleClick(QMouseEvent *e)
This signal is emitted whenever a mouse button is triple-clicked.
int getOutlineNumChildren(XpdfOutlineHandle outline)
Return the number of children of an outline tree node.
void mouseWheel(QWheelEvent *e)
This signal is emitted whenever a mouse wheel is clicked.
Definition: XpdfWidget.h:69
void closeFile()
Close the currently open PDF file (if any).
void enableExternalHyperlinks(bool on)
Control handling of external hyperlinks.
static const int findCaseSensitive
perform a case-sensitive search (default is case-insensitive)
Definition: XpdfWidget.h:139
DisplayMode
Display modes, to be passed to XpdfWidget::setDisplayMode().
Definition: XpdfWidget.h:117
int getMidPage() const
Return the page number corresponding to the middle of the window.
void scrollPageDown()
Scroll one screen down.
QString getLinkInfo(int page, double xx, double yy)
Get destination information for the hyperlink at the specified page and coordinates.
int getCurrentPage() const
Return the currently displayed page number.
void mouseRelease(QMouseEvent *e)
This signal is emitted whenever a mouse button is released.
void resized()
This signal is emitted when the widget is resized.
void unsetCursor()
Reset to the default cursor.
int getScrollX() const
Return the current scroll position x coordinate.
void gotoFirstPage()
Display the first page.
couldn't read the page catalog
Definition: XpdfWidget.h:99
void getFormFieldBBox(XpdfFormFieldHandle field, int *pageNum, double *xMin, double *yMin, double *xMax, double *yMax)
Get the form field's bounding box.
no error
Definition: XpdfWidget.h:97
XpdfLayerOrderHandle getLayerOrderParent(XpdfLayerOrderHandle order)
Return the parent of a layer display order tree node.
void scrollTo(int xx, int yy)
Scroll the page so that the top-left corner of the window is (xx,yy) pixels from the top-left corner ...
int getPageNumFromPageLabel(QString pageLabel)
Convert a page label to a page number.
void scrollBy(int dx, int dy)
Scroll the page by (dx,dy) pixels.
PDF file doesn't allow that operation.
Definition: XpdfWidget.h:107
bool getLayerVisibility(XpdfLayerHandle layer) const
Get the visibility state of a layer.
void zoomToRect(int page, double xMin, double yMin, double xMax, double yMax)
Zoom in to the specified rectangle.
void goBackward()
Go backward along the history list.
void enableTouchPan(bool on)
Control touchscreen panning.
bool getLayerOrderIsName(XpdfLayerOrderHandle order) const
Check the type of a layer display order tree node.
QImage convertRegionToImage(int page, double x0, double y0, double x1, double y1, double dpi)
Convert a rectangular region of a page to a color image.
QString getMouseLinkInfo()
Get destination information for the hyperlink under the mouse.
void * XpdfFormFieldHandle
Definition: XpdfWidget.h:61
static const int zoomToHeight
zoom to fit page height
Definition: XpdfWidget.h:130
bool gotoLinkAt(int page, double xx, double yy)
Activate the link (if any) at the specified page and coordinates.
QString getAnnotType(XpdfAnnotHandle annot)
Get the annotation type.
void pageChange(int pageNum)
This signal is emitted whenever the viewer displays a new page.
QVector< XpdfFindResult > findAll(const QString &text, int firstPage, int lastPage, int flags=0)
Find all occurrences of a text string.
ErrorCode reload()
Reload the current PDF file.
QString extractText(int page, double x0, double y0, double x1, double y1)
Extract text from a region of a page.
error during printing
Definition: XpdfWidget.h:106
void setDisplayMode(DisplayMode mode)
Set the display mode.
out of memory
Definition: XpdfWidget.h:111
int getLayerPrintState(XpdfLayerHandle layer) const
Get the suggested state for this layer in printing mode.
QString getPageLabelFromPageNum(int pageNum)
Convert a page number to a page label.
void preLoad()
This signal is emitted just before a PDF file is loaded.
double getZoomPercent(int page=1) const
Return the current zoom factor as a percentage.
invalid printer
Definition: XpdfWidget.h:105
void scrollPageUp()
Scroll one screen up.
int page
Definition: XpdfWidget.h:79
void * XpdfLayerOrderHandle
Definition: XpdfWidget.h:55
void setContinuousMode(bool continuous)
Set continuous or single-page view mode.
void gotoPage(int pageNum)
Display the specified page.
int getLayerViewState(XpdfLayerHandle layer) const
Get the suggested state for this layer in viewing mode.
void gotoOutlineTarget(XpdfOutlineHandle outline)
Jump to the target of the specified outline entry.
void * XpdfLayerHandle
Definition: XpdfWidget.h:52