00001 #ifndef PDFPAGER_H 00002 #define PDFPAGER_H 00003 00004 #include <poppler-qt4.h> 00005 00006 #include <QObject> 00007 #include <QImage> 00008 #include <QIntValidator> 00009 00014 class PDFPager : public QObject 00015 { 00016 Q_OBJECT 00017 public: 00018 PDFPager(); 00019 int page() { return m_pageNum; } 00020 QString path() { return m_path; } 00021 00022 public slots: 00023 00030 void openPDF(QString fpath); 00031 00035 void page(int pnum); 00036 00040 void page(QString pnum) { page(pnum.toInt()); } 00041 00045 virtual void renderSize(QSize s); 00046 00050 virtual void renderSize(const QRectF& s) 00051 { renderSize(s.size().toSize()); } 00052 00053 signals: 00054 void opened(QString fpath, int numPages); 00055 void numPages(int n); 00056 void rendering(bool t); 00057 void rendered(int pnum, QImage pm); 00058 void pageText(QList<Poppler::TextBox*>); 00059 void pageChanged(int p); 00060 void pageChanged(QString p); 00061 void thumbnail(int pnum, QImage pm, QString label); 00062 00063 public: 00067 Poppler::Document* pdf; 00068 00072 QIntValidator pageRange; 00073 00077 QString plainText() { return m_text; }; 00078 00079 protected: 00080 00084 virtual void render(int pnum, QSize renderSize = QSize()); 00085 00096 virtual void renderDone(int pnum, QImage pm); 00097 00098 protected: 00103 int m_pageNum; 00104 00108 QSize m_renderSize; 00109 00113 QString m_path; 00114 00119 QString m_text; 00120 }; 00121 00122 #endif // PDFPAGER_H
1.5.8