XpdfWidget/Qt
XpdfWidget.h
Go to the documentation of this file.
1//========================================================================
2//
3// XpdfWidget.h
4//
5// Copyright 2009-2024 Glyph & Cog, LLC
6//
7//========================================================================
8
16
18
19#ifndef XPDFWIDGET_H
20#define XPDFWIDGET_H
21
22#include <aconf.h>
23
24#include <QAbstractScrollArea>
25
26class QMutex;
27class QTimer;
28#if XPDFWIDGET_PRINTING
29class QPrinter;
30class QPrintDialog;
31#endif
32
33class GString;
34class PDFDoc;
35class QtPDFCore;
36
37//------------------------------------------------------------------------
38
39#ifdef HIGHLIGHTED_REGIONS
41typedef void *XpdfRegionHandle;
42#endif
43
45typedef void *XpdfOutlineHandle;
46
48typedef void *XpdfLayerHandle;
49
52
54typedef void *XpdfAnnotHandle;
55
57typedef void *XpdfFormFieldHandle;
58
60typedef void *XpdfDocHandle;
61
62//------------------------------------------------------------------------
63
66
68 XpdfFindResult(int pageA, double xMinA, double yMinA,
69 double xMaxA, double yMaxA)
70 : page(pageA), xMin(xMinA), yMin(yMinA), xMax(xMaxA), yMax(yMaxA) {}
71 XpdfFindResult(): page(0), xMin(0), yMin(0), xMax(0), yMax(0) {}
73
75 int page;
76
77 double xMin,
81};
82
83//------------------------------------------------------------------------
84
86class XpdfWidget: public QAbstractScrollArea {
87 Q_OBJECT
88
89public:
90
92 enum ErrorCode {
93 pdfOk = 0,
96 pdfErrDamaged = 3,
98 pdfErrEncrypted = 4,
108 pdfErrBusy = 1003,
109 pdfErrBadArg = 1004
110 };
111
119 };
120
123
124 static const int zoomToPage = -1;
125 static const int zoomToWidth = -2;
126 static const int zoomToHeight = -3;
128
131
132
133 static const int findBackward = 0x00000001;
135 static const int findCaseSensitive = 0x00000002;
137 static const int findNext = 0x00000004;
139 static const int findOnePageOnly = 0x00000008;
141 static const int findWholeWord = 0x00000010;
143
148 pdfImageColorRGB,
149 pdfImageColorGray,
150 pdfImageColorMono
151 };
152
163 static void init(const QString &configFileName = QString());
164
167 static void setConfig(const QString &command);
168
176 XpdfWidget(const QColor &paperColor = QColor(0xff, 0xff, 0xff),
177 const QColor &matteColor = QColor(0x80, 0x80, 0x80),
178 bool reverseVideo = false, QWidget *parentA = 0);
179
189 XpdfWidget(QWidget *parentA,
190 const QColor &paperColor = QColor(0xff, 0xff, 0xff),
191 const QColor &matteColor = QColor(0x80, 0x80, 0x80),
192 bool reverseVideo = false);
193
195 virtual ~XpdfWidget();
196
201 void enableHyperlinks(bool on);
202
210
216 void enableSelect(bool on);
217
222 void enablePan(bool on);
223
227 void enableTouchPan(bool on);
228
232 void enableTouchZoom(bool on);
233
238 void setKeyPassthrough(bool on) { keyPassthrough = on; }
239
245 void setMousePassthrough(bool on) { mousePassthrough = on; }
246
252 void showPasswordDialog(bool showDlg);
253
256 void setMatteColor(const QColor &matteColor);
257
259 void setReverseVideo(bool reverse);
260
263 void setCursor(const QCursor &cursor);
264
267
273 ErrorCode loadFile(const QString &fileName,
274 const QString &password = "");
275
282 ErrorCode loadMem(const char *buffer, unsigned int bufferLength,
283 const QString &password = "");
284
286
303 const QString &fileName,
304 const QString &password = "");
305
312
321
329
334 void closeFile();
335
339 ErrorCode saveAs(const QString &fileName);
340
342 QString getFileName() const;
343
345 bool hasOpenDocument() const;
346
349 int getNumPages() const;
350
353 int getCurrentPage() const;
354
357 int getMidPage() const;
358
360 void gotoPage(int pageNum);
361
367
373
375 void gotoNextPage(bool scrollToTop = true);
376
378 void gotoPreviousPage(bool scrollToTop = true);
379
381 bool gotoNamedDestination(const QString &dest);
382
384 void goForward();
385
388
391
394
397 void scrollTo(int xx, int yy);
398
403 void scrollBy(int dx, int dy);
404
406 int getScrollX() const;
407
409 int getScrollY() const;
410
414 void setZoom(double zoom);
415
419 double getZoom() const;
420
425 double getZoomPercent(int page = 1) const;
426
432 void zoomToRect(int page, double xMin, double yMin,
433 double xMax, double yMax);
434
437 void zoomCentered(double zoom);
438
442
445 void setRotate(int rotate);
446
449 int getRotate() const;
450
456 void setContinuousMode(bool continuous);
457
460 bool getContinuousMode() const;
461
464
467
470
474 bool onLink(int page, double xx, double yy);
475
481 QString getLinkInfo(int page, double xx, double yy);
482
488
492 bool gotoLinkAt(int page, double xx, double yy);
493
497 XpdfAnnotHandle onAnnot(int page, double xx, double yy);
498
501
505
509 XpdfFormFieldHandle onFormField(int page, double xx, double yy);
510
513
516
520
522 void getFormFieldBBox(XpdfFormFieldHandle field, int *pageNum,
523 double *xMin, double *yMin,
524 double *xMax, double *yMax);
525
528 bool convertWindowToPDFCoords(int winX, int winY,
529 int *page, double *pdfX, double *pdfY);
530
532 void convertPDFToWindowCoords(int page, double pdfX, double pdfY,
533 int *winX, int *winY);
534
538 void enableRedraw(bool enable);
539
550 void getPageBox(int page, const QString &box,
551 double *xMin, double *yMin, double *xMax, double *yMax) const;
552
556 double getPageWidth(int page) const;
557
561 double getPageHeight(int page) const;
562
566 int getPageRotation(int page) const;
567
571
577 bool getCurrentSelection(int *page, double *x0, double *y0,
578 double *x1, double *y1) const;
579
583 void setCurrentSelection(int page, double x0, double y0,
584 double x1, double y1);
585
588
592
596
601
606
608 void setSelectionColor(const QColor &selectionColor);
609
610#ifdef HIGHLIGHTED_REGIONS
618 XpdfRegionHandle addRegion(int page,
619 double x0, double y0,
620 double x1, double y1,
621 const QColor &color, const QColor &selectColor,
622 bool selectable, const QString &label);
623
625 void setRegionLabel(XpdfRegionHandle region, const QString &label);
626
628 void setRegionResizable(XpdfRegionHandle region, bool resizable);
629
632 void deleteRegion(XpdfRegionHandle region);
633
636 void deleteAllRegions();
637
639 int getNumRegions() const;
640
644 XpdfRegionHandle getRegion(int idx) const;
645
649 XpdfRegionHandle getSelectedRegion() const;
650
652 void setSelectedRegion(XpdfRegionHandle region);
653
657 void makeRegionVisible(XpdfRegionHandle region);
658
663 void getRegionInfo(XpdfRegionHandle region,
664 int *page, double *x0, double *y0,
665 double *x1, double *y1,
666 QColor *color, QColor *selectColor,
667 QString *label) const;
668#endif
669
672
673#if XPDFWIDGET_PRINTING
682 bool okToPrint() const;
683
689 ErrorCode print(bool showDialog);
690
693 ErrorCode print(QPrinter *prt);
694
697 void cancelPrint() { printCanceled = true; }
698
699 void updatePrintStatus(int nextPage, int firstPage, int lastPage);
700 bool isPrintCanceled() { return printCanceled; }
701
706 void setPrintDPI(int hDPI, int vDPI);
707#endif // XPDFWIDGET_PRINTING
708
717 QImage convertPageToImage(int page, double dpi, bool transparent = false,
718 ImageColorMode color = pdfImageColorRGB);
719
729 QImage convertRegionToImage(int page, double x0, double y0,
730 double x1, double y1, double dpi,
731 bool transparent = false,
732 ImageColorMode color = pdfImageColorRGB);
733
740 QImage getThumbnail(int page);
741
750 bool okToExtractText() const;
751
760 void setTextEncoding(const QString &encodingName);
761
769 QString extractText(int page, double x0, double y0,
770 double x1, double y1);
771
776
779
793 bool find(const QString &text, int flags = 0);
794
803 QVector<XpdfFindResult> findAll(const QString &text, int firstPage,
804 int lastPage, int flags = 0);
805
809
814 QString getPageLabelFromPageNum(int pageNum);
815
820 int getPageNumFromPageLabel(QString pageLabel);
821
826
831
836
840
843
846
849
852 int getNumLayers() const;
853
856 XpdfLayerHandle getLayer(int idx) const;
857
860 QString getLayerName(XpdfLayerHandle layer) const;
861
865
870 void setLayerVisibility(XpdfLayerHandle layer, bool visibility);
871
878
885
888
893
897
900
904
907
912
915
917 QString getEmbeddedFileName(int idx);
918
921 bool saveEmbeddedFile(int idx, QString fileName);
922
923 //--- for internal use
924
926
927 virtual QSize sizeHint() const;
928 QtPDFCore *getCore() { return core; }
929
931
932signals:
933
938 void pageChange(int pageNum);
939
945 void midPageChange(int pageNum);
946
948 void preLoad();
949
951 void postLoad();
952
954 void keyPress(QKeyEvent *e);
955
957 void mousePress(QMouseEvent *e);
958
960 void mouseRelease(QMouseEvent *e);
961
967 void mouseClick(QMouseEvent *e);
968
975 void mouseDoubleClick(QMouseEvent *e);
976
984 void mouseTripleClick(QMouseEvent *e);
985
987 void mouseMove(QMouseEvent *e);
988
990 void mouseWheel(QWheelEvent *e);
991
1008 void linkClick(const QString &linkType, const QString &dest, int page);
1009
1013
1018 void paintDone(bool finished);
1019
1021 void resized();
1022
1023#ifdef HIGHLIGHTED_REGIONS
1025 void regionSelected(XpdfRegionHandle region);
1026
1028 void regionChanged(XpdfRegionHandle region);
1029#endif
1030
1031#if XPDFWIDGET_PRINTING
1037 void printStatus(int nextPage, int firstPage, int lastPage);
1038#endif
1039
1041
1042 void tileDone();
1043
1045
1046protected:
1047
1049
1050 virtual void paintEvent(QPaintEvent *eventA);
1051 virtual void resizeEvent(QResizeEvent *eventA);
1052 virtual void scrollContentsBy(int dx, int dy);
1053 virtual void keyPressEvent(QKeyEvent *e);
1054 virtual void mousePressEvent(QMouseEvent *e);
1055 virtual void mouseReleaseEvent(QMouseEvent *e);
1056 virtual void mouseMoveEvent(QMouseEvent *e);
1057 virtual void wheelEvent(QWheelEvent *e);
1058 virtual bool eventFilter(QObject *obj, QEvent *event);
1059
1061
1062private slots:
1063
1064 void tick();
1065
1066private:
1067
1068 void setup(const QColor &paperColor, const QColor &matteColor,
1069 bool reverseVideo);
1070 static void updateCbk(void *data, GString *fileName,
1071 int pageNum, int numPages,
1072 const char *linkLabel);
1073 static void midPageChangedCbk(void *data, int pageNum);
1074 static void preLoadCbk(void *data);
1075 static void postLoadCbk(void *data);
1076 static void linkCbk(void *data, const char *type,
1077 const char *dest, int page);
1078 static void selectDoneCbk(void *data);
1079 static void paintDoneCbk(void *data, bool finished);
1080 static void tileDoneCbk(void *data);
1081#ifdef HIGHLIGHTED_REGIONS
1082 static void regionSelectedCbk(void *data);
1083 static void regionChangedCbk(void *data);
1084#endif
1085
1086 friend class XpdfViewer;
1087 bool getLinkTarget(int page, double xx, double yy,
1088 QString &targetFileName, int &targetPage,
1089 QString &targetDest);
1090
1091#if XPDFWIDGET_PRINTING
1092 QPrinter *printerForDialog;
1093 QPrintDialog *printDialog;
1094 int printHDPI, printVDPI;
1095 bool printCanceled;
1096#endif
1097
1098 static QMutex initMutex;
1099
1100 QtPDFCore *core;
1101 double scaleFactor;
1102
1103 bool keyPassthrough;
1104 bool mousePassthrough;
1105 int lastMousePressX[3], lastMousePressY[3];
1106 ulong lastMousePressTime[3];
1107 bool lastMouseEventWasPress;
1108
1109 bool touchPanEnabled;
1110 bool touchZoomEnabled;
1111 double pinchZoomStart;
1112
1113 QTimer *tickTimer;
1114};
1115
1116#endif
void * XpdfLayerOrderHandle
Definition: XpdfWidget.h:51
void * XpdfDocHandle
Definition: XpdfWidget.h:60
void * XpdfFormFieldHandle
Definition: XpdfWidget.h:57
void * XpdfLayerHandle
Definition: XpdfWidget.h:48
void * XpdfAnnotHandle
Definition: XpdfWidget.h:54
void * XpdfOutlineHandle
Definition: XpdfWidget.h:35
A PDF viewer widget class for Qt.
Definition: XpdfWidget.h:86
QString getLinkInfo(int page, double xx, double yy)
Get destination information for the hyperlink at the specified page and coordinates.
void postLoad()
This signal is emitted just after a PDF file is loaded.
QString getLayerOrderName(XpdfLayerOrderHandle order) const
Get the name of a layer display order tree node.
void enableRedraw(bool enable)
Enable or disable window redraws.
void resized()
This signal is emitted when the widget is resized.
ErrorCode saveAs(const QString &fileName)
Save the PDF file with another name.
void setTextEncoding(const QString &encodingName)
Set the encoding to use for text extraction.
static const int findBackward
search backward from the starting point
Definition: XpdfWidget.h:133
QString getFormFieldName(XpdfFormFieldHandle field)
Get the form field's name.
void goBackward()
Go backward along the history list.
bool getLayerVisibility(XpdfLayerHandle layer) const
Get the visibility state of a layer.
void setZoom(double zoom)
Change the zoom factor.
int getScrollY() const
Return the current scroll position y coordinate.
void setLinearSelectMode()
Set linear selection mode.
void enableHyperlinks(bool on)
Control handling of hyperlinks.
DisplayMode getDisplayMode()
Return the current display mode.
QString extractText(int page, double x0, double y0, double x1, double y1)
Extract text from a region of a page.
ErrorCode loadFile(const QString &fileName, const QString &password="")
Load a PDF file and display its first page.
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 closeFile()
Close the currently open PDF file (if any).
void setDisplayMode(DisplayMode mode)
Set the display mode.
bool getOutlineStartsOpen(XpdfOutlineHandle outline)
Return true if the specified outline entry starts open.
void scrollPageUp()
Scroll one screen up.
void convertPDFToWindowCoords(int page, double pdfX, double pdfY, int *winX, int *winY)
Convert PDF coordinates to window coordinates.
void copySelection()
Copy the current selection to the clipboard.
bool hasSelection()
Check to see if there is a selection.
double getZoomPercent(int page=1) const
Return the current zoom factor as a percentage.
bool hasPageLabels()
Check if the PDF file has page labels.
void enableTouchPan(bool on)
Control touchscreen panning.
void goForward()
Go forward along the history list.
double getZoom() const
Return the current zoom factor.
bool find(const QString &text, int flags=0)
Find a text string.
bool onLink(int page, double xx, double yy)
Returns true if the specified coordinates are inside a hyperlink.
XpdfFormFieldHandle onFormField(int page, double xx, double yy)
Check for a form field containing the specified point.
void freeDoc(XpdfDocHandle doc)
Free a PDF document.
void setMousePassthrough(bool on)
Control mouse event passthrough.
Definition: XpdfWidget.h:245
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 ...
QImage convertPageToImage(int page, double dpi, bool transparent=false, ImageColorMode color=pdfImageColorRGB)
Convert a page to an image.
static const int findOnePageOnly
limit the search to the current page
Definition: XpdfWidget.h:139
void unsetCursor()
Reset to the default cursor.
void setCurrentSelection(int page, double x0, double y0, double x1, double y1)
Set the selection.
int getLayerViewState(XpdfLayerHandle layer) const
Get the suggested state for this layer in viewing mode.
void zoomCentered(double zoom)
Set the zoom factor, while maintaining the current center.
void setMatteColor(const QColor &matteColor)
Set the matte color, i.e., the color used for background outside the actual page area.
void setReverseVideo(bool reverse)
Turn reverse video mode on/off. The default is off.
static void init(const QString &configFileName=QString())
Initialize the XpdfWidget class, reading a configuration file.
int getNumLayers() const
Return the number of layers in the PDF file.
bool gotoNamedDestination(const QString &dest)
Go to a named destination.
XpdfLayerOrderHandle getLayerOrderParent(XpdfLayerOrderHandle order)
Return the parent of a layer display order tree node.
void setContinuousMode(bool continuous)
Set continuous or single-page view mode.
void enableTouchZoom(bool on)
Control touchscreen zooming.
virtual ~XpdfWidget()
Destroys the XpdfWidget.
static const int zoomToPage
zoom to fit whole page
Definition: XpdfWidget.h:124
int getCurrentPage() const
Return the currently displayed page number.
void setLayerVisibility(XpdfLayerHandle layer, bool visibility)
Set the visibility state of a layer.
void getFormFieldBBox(XpdfFormFieldHandle field, int *pageNum, double *xMin, double *yMin, double *xMax, double *yMax)
Get the form field's bounding box.
void getPageBox(int page, const QString &box, double *xMin, double *yMin, double *xMax, double *yMax) const
Return the coordinates of the specified page box.
QString getPageLabelFromPageNum(int pageNum)
Convert a page number to a page label.
bool mouseOverLink()
Returns true if the mouse is currently over a hyperlink.
void linkClick(const QString &linkType, const QString &dest, int page)
This signal is emitted whenever the user clicks on a hyperlink.
XpdfLayerHandle getLayer(int idx) const
Get a layer handle.
void zoomToRect(int page, double xMin, double yMin, double xMax, double yMax)
Zoom in to the specified rectangle.
double getPageWidth(int page) const
Return the width of the specified page.
void gotoNextPage(bool scrollToTop=true)
Display the next page.
bool hasOpenDocument() const
Returns true if there is currently a PDF file open.
void preLoad()
This signal is emitted just before a PDF file is loaded.
bool isBlockSelectMode()
Check for block selection mode.
bool getLayerOrderIsName(XpdfLayerOrderHandle order) const
Check the type of a layer display order tree node.
ErrorCode loadDoc(XpdfDocHandle doc)
Load a PDF document and display its first page.
void setBlockSelectMode()
Set block selection mode.
static void setConfig(const QString &command)
Process a configuration command, i.e., one line of an xpdfrc file.
void mouseDoubleClick(QMouseEvent *e)
This signal is emitted whenever a mouse button is double-clicked.
void scrollBy(int dx, int dy)
Scroll the page by (dx,dy) pixels.
QVector< XpdfFindResult > findAll(const QString &text, int firstPage, int lastPage, int flags=0)
Find all occurrences of a text string.
void gotoPage(int pageNum)
Display the specified page.
void gotoPreviousPage(bool scrollToTop=true)
Display the previous page.
void keyPress(QKeyEvent *e)
This signal is emitted whenever a key is pressed.
int getNumEmbeddedFiles()
Return the number of embedded files in the current PDF file.
double getPageHeight(int page) const
Return the height of the specified page.
bool getContinuousMode() const
Return true if the viewer is in continuous view mode, or false if it is in any other mode.
static const int zoomToWidth
zoom to fit page width
Definition: XpdfWidget.h:125
void scrollPageDown()
Scroll one screen down.
void gotoFirstPage()
Display the first page.
ErrorCode
Error codes returned by certain XpdfViewer functions.
Definition: XpdfWidget.h:92
@ pdfErrDamaged
PDF file was damaged and couldn't be repaired.
Definition: XpdfWidget.h:96
@ pdfErrBadArg
invalid argument
Definition: XpdfWidget.h:109
@ pdfErrBadCatalog
couldn't read the page catalog
Definition: XpdfWidget.h:95
@ pdfOk
no error
Definition: XpdfWidget.h:93
@ pdfErrBadPageNum
invalid page number
Definition: XpdfWidget.h:104
@ pdfErrHighlightFile
nonexistent or invalid highlight file
Definition: XpdfWidget.h:100
@ pdfErrFileIO
file I/O error
Definition: XpdfWidget.h:105
@ pdfErrBusy
PDF component is busy.
Definition: XpdfWidget.h:108
@ pdfErrEncrypted
file was encrypted and password was incorrect or not supplied
Definition: XpdfWidget.h:98
@ pdfErrPrinting
error during printing
Definition: XpdfWidget.h:102
@ pdfErrOutOfMemory
out of memory
Definition: XpdfWidget.h:107
@ pdfErrBadPrinter
invalid printer
Definition: XpdfWidget.h:101
@ pdfErrPermission
PDF file doesn't allow that operation.
Definition: XpdfWidget.h:103
@ pdfErrNoHandle
NULL object handle.
Definition: XpdfWidget.h:106
@ pdfErrOpenFile
couldn't open the PDF file
Definition: XpdfWidget.h:94
void setSelectionColor(const QColor &selectionColor)
Set the selection color.
int getNumPages() const
Return the number of pages in the currently open PDF file.
QImage getThumbnail(int page)
Retrieve an embedded thumbnail image.
bool getCurrentSelection(int *page, double *x0, double *y0, double *x1, double *y1) const
Returns the current selection.
QImage convertRegionToImage(int page, double x0, double y0, double x1, double y1, double dpi, bool transparent=false, ImageColorMode color=pdfImageColorRGB)
Convert a rectangular region of a page to an image.
int getOutlineNumChildren(XpdfOutlineHandle outline)
Return the number of children of an outline tree node.
static const int findCaseSensitive
perform a case-sensitive search (default is case-insensitive)
Definition: XpdfWidget.h:135
QString getFormFieldType(XpdfFormFieldHandle field)
Get the form field's type.
ErrorCode loadMem(const char *buffer, unsigned int bufferLength, const QString &password="")
Load a PDF file from a memory buffer and display its first page.
int getPageNumFromPageLabel(QString pageLabel)
Convert a page label to a page number.
static const int findNext
start searching from the previous search result
Definition: XpdfWidget.h:137
void mouseClick(QMouseEvent *e)
This signal is emitted whenever a mouse button is clicked.
XpdfLayerOrderHandle getLayerOrderRoot() const
Get the root of the layer display order tree.
void selectDone()
This signal is emitted when the user selects an area.
static const int findWholeWord
limit the search to whole words
Definition: XpdfWidget.h:141
QString getLayerName(XpdfLayerHandle layer) const
Get the name of a layer.
void gotoOutlineTarget(XpdfOutlineHandle outline)
Jump to the target of the specified outline entry.
QString getOutlineTitle(XpdfOutlineHandle outline)
Get the title of an outline tree node.
void enablePan(bool on)
Control mouse panning.
XpdfWidget(QWidget *parentA, const QColor &paperColor=QColor(0xff, 0xff, 0xff), const QColor &matteColor=QColor(0x80, 0x80, 0x80), bool reverseVideo=false)
The XpdfWidget constructor.
bool gotoLinkAt(int page, double xx, double yy)
Activate the link (if any) at the specified page and coordinates.
void mouseRelease(QMouseEvent *e)
This signal is emitted whenever a mouse button is released.
DisplayMode
Display modes, to be passed to XpdfWidget::setDisplayMode().
Definition: XpdfWidget.h:113
@ pdfDisplaySideBySideContinuous
facing pages, stacked vertically
Definition: XpdfWidget.h:117
@ pdfDisplaySideBySideSingle
two facing pages
Definition: XpdfWidget.h:116
@ pdfDisplaySingle
single page
Definition: XpdfWidget.h:114
@ pdfDisplayContinuous
pages stacked vertically
Definition: XpdfWidget.h:115
@ pdfDisplayHorizontalContinuous
pages stacked horizontally
Definition: XpdfWidget.h:118
int getMidPage() const
Return the page number corresponding to the middle of the window.
int getLayerOrderNumChildren(XpdfLayerOrderHandle order)
Returns the number of children attached to a layer display order tree node.
bool saveEmbeddedFile(int idx, QString fileName)
Save the idx 'th embedded file with the specified file name.
bool isLinearSelectMode()
Check for linear selection mode.
ErrorCode reload()
Reload the current PDF file.
XpdfOutlineHandle getOutlineParent(XpdfOutlineHandle outline)
Return the parent of an outline tree node.
static const int zoomToHeight
zoom to fit page height
Definition: XpdfWidget.h:126
XpdfOutlineHandle getOutlineChild(XpdfOutlineHandle outline, int idx)
Return a child of an outline tree node.
int getScrollX() const
Return the current scroll position x coordinate.
void setKeyPassthrough(bool on)
Control keypress passthrough.
Definition: XpdfWidget.h:238
void showPasswordDialog(bool showDlg)
Control the password dialog.
void paintDone(bool finished)
This signal is emitted whenever the widget is repainted.
bool convertWindowToPDFCoords(int winX, int winY, int *page, double *pdfX, double *pdfY)
Convert window coordinates to PDF coordinates.
void clearSelection()
Clear the selection.
QString getFormFieldValue(XpdfFormFieldHandle field)
Get the form field's content.
void forceRedraw()
Force a complete redraw.
QString getAnnotContent(XpdfAnnotHandle annot)
Get the annotation's content.
void mouseTripleClick(QMouseEvent *e)
This signal is emitted whenever a mouse button is triple-clicked.
void enableSelect(bool on)
Control handling of text selection.
void zoomToCurrentWidth()
Zoom so that the current page(s) fill the window width.
void enableExternalHyperlinks(bool on)
Control handling of external hyperlinks.
int getRotate() const
Return the current page rotation.
XpdfAnnotHandle onAnnot(int page, double xx, double yy)
Check for an annotation containing the specified point.
void mousePress(QMouseEvent *e)
This signal is emitted whenever a mouse button is pressed.
XpdfLayerOrderHandle getLayerOrderChild(XpdfLayerOrderHandle order, int idx)
Returns the idx 'th child of a layer display order tree node.
int getOutlineTargetPage(XpdfOutlineHandle outline)
Return the target page number for the specified outline entry.
void mouseMove(QMouseEvent *e)
This signal is emitted whenever the mouse pointer is moved.
void gotoLastPage()
Display the last page.
XpdfLayerHandle getLayerOrderLayer(XpdfLayerOrderHandle order)
Get the layer associated with a layer display order tree node.
QString getMouseLinkInfo()
Get destination information for the hyperlink under the mouse.
void midPageChange(int pageNum)
This signal is emitted whenever the page shown at the middle of the window changes.
QString getSelectedText()
Get the currently selected text.
int getLayerPrintState(XpdfLayerHandle layer) const
Get the suggested state for this layer in printing mode.
void mouseWheel(QWheelEvent *e)
This signal is emitted whenever a mouse wheel is clicked.
int getPageRotation(int page) const
Get the default rotation for the specified page.
ErrorCode readDoc(XpdfDocHandle *docPtr, const QString &fileName, const QString &password="")
Load a PDF file and return a handle.
void setCursor(const QCursor &cursor)
Set the cursor.
ImageColorMode
Color modes, to be passed to the image conversion functions.
Definition: XpdfWidget.h:147
QString getAnnotType(XpdfAnnotHandle annot)
Get the annotation type.
void setRotate(int rotate)
Change the page rotation.
QString getFileName() const
Get the file name of the currently open PDF file.
QString getEmbeddedFileName(int idx)
Return the name of the idx 'th embedded file.
void pageChange(int pageNum)
This signal is emitted whenever the viewer displays a new page.
bool okToExtractText() const
Checks to see if text extraction is allowed.
Definition: XpdfWidget.h:65
int page
Definition: XpdfWidget.h:75
double xMax
Definition: XpdfWidget.h:79
double yMax
Definition: XpdfWidget.h:80
double yMin
Definition: XpdfWidget.h:78
double xMin
Definition: XpdfWidget.h:77