QPdfWriter¶
The QPdfWriter
class is a class to generate PDFs that can be used as a paint device. More…
Synopsis¶
Functions¶
def
addFileAttachment
(fileName, data[, mimeType=””])def
creator
()def
documentXmpMetadata
()def
pdfVersion
()def
resolution
()def
setCreator
(creator)def
setDocumentXmpMetadata
(xmpMetadata)def
setPdfVersion
(version)def
setResolution
(resolution)def
setTitle
(title)def
title
()
Detailed Description¶
QPdfWriter
generates PDF out of a series of drawing commands using QPainter
. The newPage()
method can be used to create several pages.
- class PySide6.QtGui.QPdfWriter(device)¶
PySide6.QtGui.QPdfWriter(filename)
- Parameters
device –
PySide6.QtCore.QIODevice
filename – str
Constructs a PDF writer that will write the pdf to device
.
Constructs a PDF writer that will write the pdf to filename
.
- PySide6.QtGui.QPdfWriter.addFileAttachment(fileName, data[, mimeType=""])¶
- Parameters
fileName – str
data –
PySide6.QtCore.QByteArray
mimeType – str
Adds fileName
attachment to the PDF with (optional) mimeType
. data
contains the raw file data to embed into the PDF file.
- PySide6.QtGui.QPdfWriter.creator()¶
- Return type
str
Returns the creator of the document.
See also
- PySide6.QtGui.QPdfWriter.documentXmpMetadata()¶
- Return type
Gets the document metadata, as it was provided with a call to setDocumentXmpMetadata
. It will not return the default metadata.
See also
- PySide6.QtGui.QPdfWriter.pdfVersion()¶
- Return type
Returns the PDF version for this writer. The default is PdfVersion_1_4
.
See also
- PySide6.QtGui.QPdfWriter.resolution()¶
- Return type
int
Returns the resolution of the PDF in DPI.
See also
- PySide6.QtGui.QPdfWriter.setCreator(creator)¶
- Parameters
creator – str
Sets the creator of the document to creator
.
See also
- PySide6.QtGui.QPdfWriter.setDocumentXmpMetadata(xmpMetadata)¶
- Parameters
xmpMetadata –
PySide6.QtCore.QByteArray
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.
See also
- PySide6.QtGui.QPdfWriter.setPdfVersion(version)¶
- Parameters
version –
PdfVersion
Sets the PDF version for this writer to version
.
If version
is the same value as currently set then no change will be made.
See also
- PySide6.QtGui.QPdfWriter.setResolution(resolution)¶
- Parameters
resolution – int
Sets the PDF resolution
in DPI.
This setting affects the coordinate system as returned by, for example viewport()
.
See also
- PySide6.QtGui.QPdfWriter.setTitle(title)¶
- Parameters
title – str
Sets the title of the document being created to title
.
See also
- PySide6.QtGui.QPdfWriter.title()¶
- Return type
str
Returns the title of the document.
See also
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.