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
30class QMutex;
31class QTimer;
32#if XPDFWIDGET_PRINTING
33class QPrinter;
34class QPrintDialog;
35#endif
36
37class GString;
38class PDFDoc;
39class QtPDFCore;
40
41//------------------------------------------------------------------------
42
43#ifdef HIGHLIGHTED_REGIONS
45typedef void *XpdfRegionHandle;
46#endif
47
49typedef void *XpdfOutlineHandle;
50
52typedef void *XpdfLayerHandle;
53
56
58typedef void *XpdfAnnotHandle;
59
61typedef void *XpdfFormFieldHandle;
62
64typedef 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
81 double xMin,
85};
86
87//------------------------------------------------------------------------
88
90class XpdfWidget: public QAbstractScrollArea {
91 Q_OBJECT
92
93public:
94
96 enum ErrorCode {
97 pdfOk = 0,
100 pdfErrDamaged = 3,
102 pdfErrEncrypted = 4,
112 pdfErrBusy = 1003,
113 pdfErrBadArg = 1004
114 };
115
123 };
124
127
128 static const int zoomToPage = -1;
129 static const int zoomToWidth = -2;
130 static const int zoomToHeight = -3;
132
135
136
137 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
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
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
316
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
362
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
383
386
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
437
440 void setRotate(int rotate);
441
444 int getRotate() const;
445
451 void setContinuousMode(bool continuous);
452
455 bool getContinuousMode() const;
456
459
462
465
469 bool onLink(int page, double xx, double yy);
470
476 QString getLinkInfo(int page, double xx, double yy);
477
483
487 bool gotoLinkAt(int page, double xx, double yy);
488
492 XpdfAnnotHandle onAnnot(int page, double xx, double yy);
493
496
500
504 XpdfFormFieldHandle onFormField(int page, double xx, double yy);
505
508
511
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
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
583
587
591
596
601
603 void setSelectionColor(const QColor &selectionColor);
604
605#ifdef HIGHLIGHTED_REGIONS
613 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
667
668#if XPDFWIDGET_PRINTING
677 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
709 QImage convertPageToImage(int page, double dpi, bool transparent = false);
710
717 QImage convertRegionToImage(int page, double x0, double y0,
718 double x1, double y1, double dpi,
719 bool transparent = false);
720
727 QImage getThumbnail(int page);
728
737 bool okToExtractText() const;
738
747 void setTextEncoding(const QString &encodingName);
748
756 QString extractText(int page, double x0, double y0,
757 double x1, double y1);
758
763
766
780 bool find(const QString &text, int flags = 0);
781
790 QVector<XpdfFindResult> findAll(const QString &text, int firstPage,
791 int lastPage, int flags = 0);
792
796
801 QString getPageLabelFromPageNum(int pageNum);
802
807 int getPageNumFromPageLabel(QString pageLabel);
808
813
818
823
827
830
833
836
839 int getNumLayers() const;
840
843 XpdfLayerHandle getLayer(int idx) const;
844
847 QString getLayerName(XpdfLayerHandle layer) const;
848
852
857 void setLayerVisibility(XpdfLayerHandle layer, bool visibility);
858
865
872
875
880
884
887
891
894
899
902
904 QString getEmbeddedFileName(int idx);
905
908 bool saveEmbeddedFile(int idx, QString fileName);
909
910 //--- for internal use
911
913
914 virtual QSize sizeHint() const;
915 QtPDFCore *getCore() { return core; }
916
918
919signals:
920
925 void pageChange(int pageNum);
926
932 void midPageChange(int pageNum);
933
935 void preLoad();
936
938 void postLoad();
939
941 void keyPress(QKeyEvent *e);
942
944 void mousePress(QMouseEvent *e);
945
947 void mouseRelease(QMouseEvent *e);
948
954 void mouseClick(QMouseEvent *e);
955
962 void mouseDoubleClick(QMouseEvent *e);
963
971 void mouseTripleClick(QMouseEvent *e);
972
974 void mouseMove(QMouseEvent *e);
975
977 void mouseWheel(QWheelEvent *e);
978
995 void linkClick(const QString &linkType, const QString &dest, int page);
996
1000
1005 void paintDone(bool finished);
1006
1008 void resized();
1009
1010#ifdef HIGHLIGHTED_REGIONS
1012 void regionSelected(XpdfRegionHandle region);
1013
1015 void regionChanged(XpdfRegionHandle region);
1016#endif
1017
1018#if XPDFWIDGET_PRINTING
1024 void printStatus(int nextPage, int firstPage, int lastPage);
1025#endif
1026
1028
1029 void tileDone();
1030
1032
1033protected:
1034
1036
1037 virtual void paintEvent(QPaintEvent *eventA);
1038 virtual void resizeEvent(QResizeEvent *eventA);
1039 virtual void scrollContentsBy(int dx, int dy);
1040 virtual void keyPressEvent(QKeyEvent *e);
1041 virtual void mousePressEvent(QMouseEvent *e);
1042 virtual void mouseReleaseEvent(QMouseEvent *e);
1043 virtual void mouseMoveEvent(QMouseEvent *e);
1044 virtual void wheelEvent(QWheelEvent *e);
1045 virtual bool eventFilter(QObject *obj, QEvent *event);
1046
1048
1049private slots:
1050
1051 void tick();
1052
1053private:
1054
1055 void setup(const QColor &paperColor, const QColor &matteColor,
1056 bool reverseVideo);
1057 static void updateCbk(void *data, GString *fileName,
1058 int pageNum, int numPages,
1059 const char *linkLabel);
1060 static void midPageChangedCbk(void *data, int pageNum);
1061 static void preLoadCbk(void *data);
1062 static void postLoadCbk(void *data);
1063 static void linkCbk(void *data, const char *type,
1064 const char *dest, int page);
1065 static void selectDoneCbk(void *data);
1066 static void paintDoneCbk(void *data, bool finished);
1067 static void tileDoneCbk(void *data);
1068#ifdef HIGHLIGHTED_REGIONS
1069 static void regionSelectedCbk(void *data);
1070 static void regionChangedCbk(void *data);
1071#endif
1072
1073 friend class XpdfViewer;
1074 bool getLinkTarget(int page, double xx, double yy,
1075 QString &targetFileName, int &targetPage,
1076 QString &targetDest);
1077
1078#if XPDFWIDGET_PRINTING
1079 QPrinter *printerForDialog;
1080 QPrintDialog *printDialog;
1081 int printHDPI, printVDPI;
1082 bool printCanceled;
1083#endif
1084
1085 static QMutex initMutex;
1086
1087 QtPDFCore *core;
1088 double scaleFactor;
1089
1090 bool keyPassthrough;
1091 bool mousePassthrough;
1092 int lastMousePressX[3], lastMousePressY[3];
1093 ulong lastMousePressTime[3];
1094 bool lastMouseEventWasPress;
1095
1096 bool touchPanEnabled;
1097 bool touchZoomEnabled;
1098 double pinchZoomStart;
1099
1100 QTimer *tickTimer;
1101};
1102
1103#endif
void * XpdfLayerOrderHandle
Definition: XpdfWidget.h:55
void * XpdfDocHandle
Definition: XpdfWidget.h:64
void * XpdfFormFieldHandle
Definition: XpdfWidget.h:61
void * XpdfLayerHandle
Definition: XpdfWidget.h:52
void * XpdfAnnotHandle
Definition: XpdfWidget.h:58
void * XpdfOutlineHandle
Definition: XpdfWidget.h:39
A PDF viewer widget class for Qt.
Definition: XpdfWidget.h:90
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:137
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:240
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 ...
static const int findOnePageOnly
limit the search to the current page
Definition: XpdfWidget.h:143
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.
QImage convertPageToImage(int page, double dpi, bool transparent=false)
Convert a page to a color image.
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:128
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:129
void scrollPageDown()
Scroll one screen down.
void gotoFirstPage()
Display the first page.
ErrorCode
Error codes returned by certain XpdfViewer functions.
Definition: XpdfWidget.h:96
@ pdfErrDamaged
PDF file was damaged and couldn't be repaired.
Definition: XpdfWidget.h:100
@ pdfErrBadArg
invalid argument
Definition: XpdfWidget.h:113
@ pdfErrBadCatalog
couldn't read the page catalog
Definition: XpdfWidget.h:99
@ pdfOk
no error
Definition: XpdfWidget.h:97
@ pdfErrBadPageNum
invalid page number
Definition: XpdfWidget.h:108
@ pdfErrHighlightFile
nonexistent or invalid highlight file
Definition: XpdfWidget.h:104
@ pdfErrFileIO
file I/O error
Definition: XpdfWidget.h:109
@ pdfErrBusy
PDF component is busy.
Definition: XpdfWidget.h:112
@ pdfErrEncrypted
file was encrypted and password was incorrect or not supplied
Definition: XpdfWidget.h:102
@ pdfErrPrinting
error during printing
Definition: XpdfWidget.h:106
@ pdfErrOutOfMemory
out of memory
Definition: XpdfWidget.h:111
@ pdfErrBadPrinter
invalid printer
Definition: XpdfWidget.h:105
@ pdfErrPermission
PDF file doesn't allow that operation.
Definition: XpdfWidget.h:107
@ pdfErrNoHandle
NULL object handle.
Definition: XpdfWidget.h:110
@ pdfErrOpenFile
couldn't open the PDF file
Definition: XpdfWidget.h:98
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.
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:139
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:141
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:145
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:117
@ pdfDisplaySideBySideContinuous
facing pages, stacked vertically
Definition: XpdfWidget.h:121
@ pdfDisplaySideBySideSingle
two facing pages
Definition: XpdfWidget.h:120
@ pdfDisplaySingle
single page
Definition: XpdfWidget.h:118
@ pdfDisplayContinuous
pages stacked vertically
Definition: XpdfWidget.h:119
@ pdfDisplayHorizontalContinuous
pages stacked horizontally
Definition: XpdfWidget.h:122
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:130
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:233
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.
QImage convertRegionToImage(int page, double x0, double y0, double x1, double y1, double dpi, bool transparent=false)
Convert a rectangular region of a page to a color image.
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.
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:69
int page
Definition: XpdfWidget.h:79
double xMax
Definition: XpdfWidget.h:83
double yMax
Definition: XpdfWidget.h:84
double yMin
Definition: XpdfWidget.h:82
double xMin
Definition: XpdfWidget.h:81