PySide6.QtGui.QPdfWriter¶
- class QPdfWriter¶
- The - QPdfWriterclass is a class to generate PDFs that can be used as a paint device. More…- Synopsis¶- Methods¶- def - __init__()
- def - colorModel()
- def - creator()
- def - documentId()
- def - outputIntent()
- def - pdfVersion()
- def - resolution()
- def - setColorModel()
- def - setCreator()
- def - setDocumentId()
- 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¶- QPdfWritergenerates PDF out of a series of drawing commands using- QPainter. The- newPage()method can be used to create several pages.- class ColorModel¶
- This enumeration describes the way in which the PDF engine interprets stroking and filling colors, set as a - QPainter‘s pen or brush (via- QPenand- QBrush).- Constant - Description - QPdfWriter.ColorModel.RGB - All colors are converted to RGB and saved as such in the PDF. - QPdfWriter.ColorModel.Grayscale - All colors are converted to grayscale. For backwards compatibility, they are emitted in the PDF output as RGB colors, with identical quantities of red, green and blue. - QPdfWriter.ColorModel.CMYK - All colors are converted to CMYK and saved as such. - QPdfWriter.ColorModel.Auto - RGB colors are emitted as RGB; CMYK colors are emitted as CMYK. Colors of any other color spec are converted to RGB. This is the default since Qt 6.8. - Added in version 6.8. 
 - 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 - fileNameattachment to the PDF with (optional)- mimeType.- datacontains the raw file data to embed into the PDF file.- colorModel()¶
- Return type:
 
 - Returns the color model used by this PDF writer. The default is - Auto.- See also - creator()¶
- Return type:
- str 
 
 - Returns the creator of the document. - See also - Returns the ID of the document. By default, the ID is a randomly generated UUID. - 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 - outputIntent()¶
- Return type:
 
 - Returns the output intent used by this PDF writer. - 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 - setColorModel(model)¶
- Parameters:
- model – - ColorModel
 
 - Sets the color model used by this PDF writer to - model.- See also - setCreator(creator)¶
- Parameters:
- creator – str 
 
 - Sets the creator of the document to - creator.- See also - Sets the ID of the document to - documentId.- See also - setDocumentXmpMetadata(xmpMetadata)¶
- Parameters:
- xmpMetadata – - QByteArray
 
 - Sets the document metadata. This metadata is not influenced by the - setTitle/- setCreatormethods, so is up to the user to keep it consistent.- xmpMetadatacontains XML formatted metadata to embed into the PDF file.- See also - setOutputIntent(intent)¶
- Parameters:
- intent – - QPdfOutputIntent
 
 - Sets the output intent used by this PDF writer to - intent.- See also - setPdfVersion(version)¶
- Parameters:
- version – - PdfVersion
 
 - Sets the PDF version for this writer to - version.- If - versionis the same value as currently set then no change will be made.- See also - setResolution(resolution)¶
- Parameters:
- resolution – int 
 
 - Sets the PDF - resolutionin 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