blob: df6e69fd95ef509fec80c905af950b4a7fab6ee0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#ifndef QPDFDOCUMENT_H
#define QPDFDOCUMENT_H
#include <QObject>
#include <QImage>
#include "qtpdfglobal.h"
class QPdfDocumentPrivate;
class QNetworkReply;
class Q_PDF_EXPORT QPdfDocument : public QObject
{
Q_OBJECT
Q_PROPERTY(int pageCount READ pageCount NOTIFY pageCountChanged FINAL)
Q_PROPERTY(QString password READ password WRITE setPassword FINAL)
public:
enum Error {
NoError,
UnknownError,
FileNotFoundError,
InvalidFileFormatError,
IncorrectPasswordError,
UnsupportedSecuritySchemeError
};
explicit QPdfDocument(QObject *parent = 0);
~QPdfDocument();
Error load(const QString &fileName, const QString &password = QString());
Error load(QIODevice *device, const QString &password = QString());
void loadAsynchronously(QNetworkReply *device);
void setPassword(const QString &password);
QString password() const;
Error error() const;
int pageCount() const;
QSizeF pageSize(int page) const;
QImage render(int page, const QSizeF &pageSize);
Q_SIGNALS:
void passwordRequired();
void documentReady();
void pageCountChanged();
private:
Q_PRIVATE_SLOT(d, void _q_initiateAsyncLoad())
Q_PRIVATE_SLOT(d, void _q_readFromDevice())
QScopedPointer<QPdfDocumentPrivate> d;
};
#endif // QPDFDOCUMENT_H
|