QPdfWriter Class▲
-
Header: QPdfWriter
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
-
qmake: QT += gui
-
Inherits: QObject and QPagedPaintDevice
-
Group: QPdfWriter is part of Painting Classes
Detailed Description▲
QPdfWriter generates PDF out of a series of drawing commands using QPainter. The newPage() method can be used to create several pages.
Member Function Documentation▲
[explicit] QPdfWriter::QPdfWriter(const QString &filename)▲
Constructs a PDF writer that will write the pdf to filename.
[explicit] QPdfWriter::QPdfWriter(QIODevice *device)▲
Constructs a PDF writer that will write the pdf to device.
[virtual] QPdfWriter::~QPdfWriter()▲
Destroys the pdf writer.
[since 5.15] void QPdfWriter::addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType = QString())▲
Adds fileName attachment to the PDF with (optional) mimeType. data contains the raw file data to embed into the PDF file.
This function was introduced in Qt 5.15.
QString QPdfWriter::creator() const▲
[since 5.15] QByteArray QPdfWriter::documentXmpMetadata() const▲
Gets the document metadata, as it was provided with a call to setDocumentXmpMetadata. It will not return the default metadata.
This function was introduced in Qt 5.15.
See Also▲
See also setDocumentXmpMetadata()
[override virtual] bool QPdfWriter::newPage()▲
Reimplements: QPagedPaintDevice::newPage().
[override virtual protected] QPaintEngine *QPdfWriter::paintEngine() const▲
Reimplements: QPaintDevice::paintEngine() const.
[since 5.10] QPagedPaintDevice::PdfVersion QPdfWriter::pdfVersion() const▲
Returns the PDF version for this writer. The default is PdfVersion_1_4.
This function was introduced in Qt 5.10.
See Also▲
See also setPdfVersion()
[since 5.3] int QPdfWriter::resolution() const▲
Returns the resolution of the PDF in DPI.
This function was introduced in Qt 5.3.
See Also▲
See also setResolution()
void QPdfWriter::setCreator(const QString &creator)▲
[since 5.15] void QPdfWriter::setDocumentXmpMetadata(const QByteArray &xmpMetadata)▲
Sets the document metadata. This metadata is not influenced by the setTitle / setCreator methods, so is up to the user to keep it consistent. xmpMetadata contains XML formatted metadata to embed into the PDF file.
This function was introduced in Qt 5.15.
See Also▲
See also documentXmpMetadata()
[since 5.10] void QPdfWriter::setPdfVersion(QPagedPaintDevice::PdfVersion version)▲
Sets the PDF version for this writer to version.
If version is the same value as currently set then no change will be made.
This function was introduced in Qt 5.10.
See Also▲
See also pdfVersion()
[since 5.3] void QPdfWriter::setResolution(int resolution)▲
Sets the PDF resolution in DPI.
This setting affects the coordinate system as returned by, for example QPainter::viewport().
This function was introduced in Qt 5.3.
See Also▲
See also resolution()