PySide6.QtPrintSupport.QPrintEngine¶
- class QPrintEngine¶
The
QPrintEngine
class defines an interface for howQPrinter
interacts with a given printing subsystem.Details
The common case when creating your own print engine is to derive from both QPaintEngine and
QPrintEngine
. Various properties of a print engine are given withproperty()
and set withsetProperty()
.See also
Synopsis¶
Virtual methods¶
def
abort()
def
metric()
def
newPage()
def
printerState()
def
property()
def
setProperty()
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
- class PrintEnginePropertyKey¶
This enum is used to communicate properties between the print engine and
QPrinter
. A property may or may not be supported by a given print engine.Constant
Description
QPrintEngine.PrintEnginePropertyKey.PPK_CollateCopies
A boolean value indicating whether the printout should be collated or not.
QPrintEngine.PrintEnginePropertyKey.PPK_ColorMode
Refers to
ColorMode
, either color or monochrome.QPrintEngine.PrintEnginePropertyKey.PPK_Creator
A string describing the document’s creator.
QPrintEngine.PrintEnginePropertyKey.PPK_Duplex
A boolean value indicating whether both sides of the printer paper should be used for the printout.
QPrintEngine.PrintEnginePropertyKey.PPK_DocumentName
A string describing the document name in the spooler.
QPrintEngine.PrintEnginePropertyKey.PPK_FontEmbedding
A boolean value indicating whether data for the document’s fonts should be embedded in the data sent to the printer.
QPrintEngine.PrintEnginePropertyKey.PPK_FullPage
A boolean describing if the printer should be full page or not.
QPrintEngine.PrintEnginePropertyKey.PPK_NumberOfCopies
Obsolete. An integer specifying the number of copies. Use PPK_CopyCount instead.
QPrintEngine.PrintEnginePropertyKey.PPK_Orientation
Specifies a QPageLayout::Orientation value.
QPrintEngine.PrintEnginePropertyKey.PPK_OutputFileName
The output file name as a string. An empty file name indicates that the printer should not print to a file.
QPrintEngine.PrintEnginePropertyKey.PPK_PageOrder
Specifies a
PageOrder
value.QPrintEngine.PrintEnginePropertyKey.PPK_PageRect
A QRect specifying the page rectangle
QPrintEngine.PrintEnginePropertyKey.PPK_PageSize
Obsolete. Use PPK_PaperSize instead.
QPrintEngine.PrintEnginePropertyKey.PPK_PaperRect
A QRect specifying the paper rectangle.
QPrintEngine.PrintEnginePropertyKey.PPK_PaperSource
Specifies a
PaperSource
value.QPrintEngine.PrintEnginePropertyKey.PPK_PaperSources
Specifies more than one
PaperSource
value.QPrintEngine.PrintEnginePropertyKey.PPK_PaperName
A string specifying the name of the paper.
QPrintEngine.PrintEnginePropertyKey.PPK_PaperSize
Specifies a QPrinter::PaperSize value.
QPrintEngine.PrintEnginePropertyKey.PPK_PrinterName
A string specifying the name of the printer.
QPrintEngine.PrintEnginePropertyKey.PPK_PrinterProgram
A string specifying the name of the printer program used for printing,
QPrintEngine.PrintEnginePropertyKey.PPK_Resolution
An integer describing the dots per inch for this printer.
QPrintEngine.PrintEnginePropertyKey.PPK_SelectionOption
QPrintEngine.PrintEnginePropertyKey.PPK_SupportedResolutions
A list of integer QVariants describing the set of supported resolutions that the printer has.
QPrintEngine.PrintEnginePropertyKey.PPK_WindowsPageSize
An integer specifying a DM_PAPER entry on Windows.
QPrintEngine.PrintEnginePropertyKey.PPK_CustomPaperSize
A QSizeF specifying a custom paper size in the
Point
unit.QPrintEngine.PrintEnginePropertyKey.PPK_PageMargins
A QList<QVariant> containing the left, top, right and bottom margin values in the
Point
unit.QPrintEngine.PrintEnginePropertyKey.PPK_CopyCount
An integer specifying the number of copies to print.
QPrintEngine.PrintEnginePropertyKey.PPK_SupportsMultipleCopies
A boolean value indicating whether or not the printer supports printing multiple copies in one job.
QPrintEngine.PrintEnginePropertyKey.PPK_QPageSize
Set the page size using a QPageSize object.
QPrintEngine.PrintEnginePropertyKey.PPK_QPageMargins
Set the page margins using a std::pair of QMarginsF and QPageLayout::Unit.
QPrintEngine.PrintEnginePropertyKey.PPK_QPageLayout
Set the page layout using a QPageLayout object.
QPrintEngine.PrintEnginePropertyKey.PPK_CustomBase
Basis for extension.
- abstract abort()¶
- Return type:
bool
Instructs the print engine to abort the printing process. Returns true if successful; otherwise returns
false
.- abstract metric(id)¶
- Parameters:
id –
PaintDeviceMetric
- Return type:
int
Returns the metric for the given
id
.- abstract newPage()¶
- Return type:
bool
Instructs the print engine to start a new page. Returns
true
if the printer was able to create the new page; otherwise returnsfalse
.- abstract printerState()¶
- Return type:
Returns the current state of the printer being used by the print engine.
- abstract property(key)¶
- Parameters:
key –
PrintEnginePropertyKey
- Return type:
object
Returns the print engine’s property specified by
key
.See also
- abstract setProperty(key, value)¶
- Parameters:
key –
PrintEnginePropertyKey
value – object
Sets the print engine’s property specified by
key
to the givenvalue
.See also