- class QPdfWriter#
The
QPdfWriter
class is a class to generate PDFs that can be used as a paint device. More…Synopsis#
Methods#
def
__init__()
def
creator()
def
pdfVersion()
def
resolution()
def
setCreator()
def
setPdfVersion()
def
setResolution()
def
setTitle()
def
title()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
QPdfWriter
generates PDF out of a series of drawing commands usingQPainter
. ThenewPage()
method can be used to create several pages.Constructs a PDF writer that will write the pdf to
device
.- __init__(filename)
- Parameters:
filename – str
Constructs a PDF writer that will write the pdf to
filename
.- addFileAttachment(fileName, data[, mimeType=""])#
- Parameters:
fileName – str
data –
QByteArray
mimeType – str
Adds
fileName
attachment to the PDF with (optional)mimeType
.data
contains the raw file data to embed into the PDF file.- creator()#
- Return type:
str
Returns the creator of the document.
See also
- 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
- pdfVersion()#
- Return type:
Returns the PDF version for this writer. The default is
PdfVersion_1_4
.See also
- resolution()#
- Return type:
int
Returns the resolution of the PDF in DPI.
See also
- setCreator(creator)#
- Parameters:
creator – str
Sets the creator of the document to
creator
.See also
- setDocumentXmpMetadata(xmpMetadata)#
- Parameters:
xmpMetadata –
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
- 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
- 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
- setTitle(title)#
- Parameters:
title – str
Sets the title of the document being created to
title
.See also
- title()#
- Return type:
str
Returns the title of the document.
See also