1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QPDFWRITER_H
5#define QPDFWRITER_H
6
7#include <QtGui/qtguiglobal.h>
8
9#ifndef QT_NO_PDF
10
11#include <QtCore/qobject.h>
12#include <QtGui/qpagedpaintdevice.h>
13#include <QtGui/qpagelayout.h>
14
15QT_BEGIN_NAMESPACE
16
17class QIODevice;
18class QPdfWriterPrivate;
19
20class Q_GUI_EXPORT QPdfWriter : public QObject, public QPagedPaintDevice
21{
22 Q_OBJECT
23public:
24 explicit QPdfWriter(const QString &filename);
25 explicit QPdfWriter(QIODevice *device);
26 ~QPdfWriter();
27
28 void setPdfVersion(PdfVersion version);
29 PdfVersion pdfVersion() const;
30
31 QString title() const;
32 void setTitle(const QString &title);
33
34 QString creator() const;
35 void setCreator(const QString &creator);
36
37 bool newPage() override;
38
39 void setResolution(int resolution);
40 int resolution() const;
41
42 void setDocumentXmpMetadata(const QByteArray &xmpMetadata);
43 QByteArray documentXmpMetadata() const;
44
45 void addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType = QString());
46
47protected:
48 QPaintEngine *paintEngine() const override;
49 int metric(PaintDeviceMetric id) const override;
50
51private:
52 Q_DISABLE_COPY(QPdfWriter)
53 Q_DECLARE_PRIVATE(QPdfWriter)
54};
55
56QT_END_NAMESPACE
57
58#endif // QT_NO_PDF
59
60#endif
61

source code of qtbase/src/gui/painting/qpdfwriter.h