PythonQt.QtGui.QPrinter
QPrinter
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
This device represents a series of pages of printed output, and is used in almost exactly the same way as other paint devices such as QWidget and QPixmap. A set of additional functions are provided to manage device-specific features, such as orientation and resolution, and to step through the pages in a document as it is generated.
When printing directly to a printer on Windows or macOS, QPrinter uses the built-in printer drivers. On X11, QPrinter uses the Common Unix Printing System (CUPS) to send PDF output to the printer. As an alternative, the printProgram() function can be used to specify the command or utility to use instead of the system default.
Note that setting parameters like paper size and resolution on an invalid printer is undefined. You can use QPrinter::isValid() to verify this before changing any parameters.
QPrinter supports a number of parameters, most of which can be changed by the end user through a print dialog. In general, QPrinter passes these functions onto the underlying QPrintEngine.
The most important parameters are:
- setOrientation() tells QPrinter which page orientation to use.
- setPaperSize() tells QPrinter what paper size to expect from the printer.
- setResolution() tells QPrinter what resolution you wish the printer to provide, in dots per inch (DPI).
- setFullPage() tells QPrinter whether you want to deal with the full page or just with the part the printer can draw on.
- setCopyCount() tells QPrinter how many copies of the document it should print.
Many of these functions can only be called before the actual printing begins (i.e., before QPainter::begin() is called). This usually makes sense because, for example, it's not possible to change the number of copies when you are halfway through printing. There are also some settings that the user sets (through the printer dialog) and that applications are expected to obey. See QAbstractPrintDialog's documentation for more details.
When QPainter::begin() is called, the QPrinter it operates on is prepared for a new page, enabling the QPainter to be used immediately to paint the first page in a document. Once the first page has been painted, newPage() can be called to request a new blank page to paint on, or QPainter::end() can be called to finish printing. The second page and all following pages are prepared using a call to newPage() before they are painted.
The first page in a document does not need to be preceded by a call to newPage(). You only need to calling newPage() after QPainter::begin() if you need to insert a blank page at the beginning of a printed document. Similarly, calling newPage() after the last page in a document is painted will result in a trailing blank page appended to the end of the printed document.
If you want to abort the print job, abort() will try its best to stop printing. It may cancel the entire job or just part of it.
Since QPrinter can print to any QPrintEngine subclass, it is possible to extend printing support to cover new types of printing subsystem by subclassing QPrintEngine and reimplementing its interface.
Source: https://doc.qt.io/archives/qt-5.15/qprinter.html
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
A0 |
attribute | Any |
(shared captured text) |
A1 |
attribute | Any |
(shared captured text) |
A10 |
attribute | Any |
(shared captured text) |
A2 |
attribute | Any |
(shared captured text) |
A3 |
attribute | Any |
(shared captured text) |
A3Extra |
attribute | Any |
(shared captured text) |
A4 |
attribute | Any |
(shared captured text) |
A4Extra |
attribute | Any |
(shared captured text) |
A4Plus |
attribute | Any |
(shared captured text) |
A4Small |
attribute | Any |
(shared captured text) |
A5 |
attribute | Any |
(shared captured text) |
A5Extra |
attribute | Any |
(shared captured text) |
A6 |
attribute | Any |
(shared captured text) |
A7 |
attribute | Any |
(shared captured text) |
A8 |
attribute | Any |
(shared captured text) |
A9 |
attribute | Any |
(shared captured text) |
Aborted |
attribute | Any |
|
Active |
attribute | Any |
(shared captured text) |
AllPages |
attribute | Any |
(shared captured text) |
AnsiA |
attribute | Any |
(shared captured text) |
AnsiB |
attribute | Any |
(shared captured text) |
AnsiC |
attribute | Any |
(shared captured text) |
AnsiD |
attribute | Any |
(shared captured text) |
AnsiE |
attribute | Any |
(shared captured text) |
ArchA |
attribute | Any |
(shared captured text) |
ArchB |
attribute | Any |
(shared captured text) |
ArchC |
attribute | Any |
(shared captured text) |
ArchD |
attribute | Any |
(shared captured text) |
ArchE |
attribute | Any |
(shared captured text) |
Auto |
attribute | Any |
|
B0 |
attribute | Any |
(shared captured text) |
B1 |
attribute | Any |
(shared captured text) |
B10 |
attribute | Any |
(shared captured text) |
B2 |
attribute | Any |
(shared captured text) |
B3 |
attribute | Any |
(shared captured text) |
B4 |
attribute | Any |
(shared captured text) |
B5 |
attribute | Any |
(shared captured text) |
B5Extra |
attribute | Any |
(shared captured text) |
B6 |
attribute | Any |
(shared captured text) |
B7 |
attribute | Any |
(shared captured text) |
B8 |
attribute | Any |
(shared captured text) |
B9 |
attribute | Any |
(shared captured text) |
C5E |
attribute | Any |
(shared captured text) |
Cassette |
attribute | Any |
|
Cicero |
attribute | Any |
(shared captured text) |
Color |
attribute | Any |
|
ColorMode |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
Comm10E |
attribute | Any |
(shared captured text) |
CurrentPage |
attribute | Any |
(shared captured text) |
Custom |
attribute | Any |
(shared captured text) |
CustomSource |
attribute | Any |
|
DLE |
attribute | Any |
(shared captured text) |
DevicePixel |
attribute | Any |
|
Didot |
attribute | Any |
(shared captured text) |
DoublePostcard |
attribute | Any |
(shared captured text) |
DuplexAuto |
attribute | Any |
|
DuplexLongSide |
attribute | Any |
|
DuplexMode |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
DuplexNone |
attribute | Any |
|
DuplexShortSide |
attribute | Any |
|
Envelope |
attribute | Any |
|
Envelope10 |
attribute | Any |
(shared captured text) |
Envelope11 |
attribute | Any |
(shared captured text) |
Envelope12 |
attribute | Any |
(shared captured text) |
Envelope14 |
attribute | Any |
(shared captured text) |
Envelope9 |
attribute | Any |
(shared captured text) |
EnvelopeB4 |
attribute | Any |
(shared captured text) |
EnvelopeB5 |
attribute | Any |
(shared captured text) |
EnvelopeB6 |
attribute | Any |
(shared captured text) |
EnvelopeC0 |
attribute | Any |
(shared captured text) |
EnvelopeC1 |
attribute | Any |
(shared captured text) |
EnvelopeC2 |
attribute | Any |
(shared captured text) |
EnvelopeC3 |
attribute | Any |
(shared captured text) |
EnvelopeC4 |
attribute | Any |
(shared captured text) |
EnvelopeC5 |
attribute | Any |
(shared captured text) |
EnvelopeC6 |
attribute | Any |
(shared captured text) |
EnvelopeC65 |
attribute | Any |
(shared captured text) |
EnvelopeC7 |
attribute | Any |
(shared captured text) |
EnvelopeChou3 |
attribute | Any |
(shared captured text) |
EnvelopeChou4 |
attribute | Any |
(shared captured text) |
EnvelopeDL |
attribute | Any |
(shared captured text) |
EnvelopeInvite |
attribute | Any |
(shared captured text) |
EnvelopeItalian |
attribute | Any |
(shared captured text) |
EnvelopeKaku2 |
attribute | Any |
(shared captured text) |
EnvelopeKaku3 |
attribute | Any |
(shared captured text) |
EnvelopeManual |
attribute | Any |
|
EnvelopeMonarch |
attribute | Any |
(shared captured text) |
EnvelopePersonal |
attribute | Any |
(shared captured text) |
EnvelopePrc1 |
attribute | Any |
(shared captured text) |
EnvelopePrc10 |
attribute | Any |
(shared captured text) |
EnvelopePrc2 |
attribute | Any |
(shared captured text) |
EnvelopePrc3 |
attribute | Any |
(shared captured text) |
EnvelopePrc4 |
attribute | Any |
(shared captured text) |
EnvelopePrc5 |
attribute | Any |
(shared captured text) |
EnvelopePrc6 |
attribute | Any |
(shared captured text) |
EnvelopePrc7 |
attribute | Any |
(shared captured text) |
EnvelopePrc8 |
attribute | Any |
(shared captured text) |
EnvelopePrc9 |
attribute | Any |
(shared captured text) |
EnvelopeYou4 |
attribute | Any |
(shared captured text) |
Error |
attribute | Any |
|
Executive |
attribute | Any |
(shared captured text) |
ExecutiveStandard |
attribute | Any |
(shared captured text) |
FanFoldGerman |
attribute | Any |
(shared captured text) |
FanFoldGermanLegal |
attribute | Any |
(shared captured text) |
FanFoldUS |
attribute | Any |
(shared captured text) |
FirstPageFirst |
attribute | Any |
|
Folio |
attribute | Any |
(shared captured text) |
FormSource |
attribute | Any |
|
GrayScale |
attribute | Any |
|
HighResolution |
attribute | Any |
|
Idle |
attribute | Any |
|
Imperial10x11 |
attribute | Any |
(shared captured text) |
Imperial10x13 |
attribute | Any |
(shared captured text) |
Imperial10x14 |
attribute | Any |
(shared captured text) |
Imperial12x11 |
attribute | Any |
(shared captured text) |
Imperial15x11 |
attribute | Any |
(shared captured text) |
Imperial7x9 |
attribute | Any |
(shared captured text) |
Imperial8x10 |
attribute | Any |
(shared captured text) |
Imperial9x11 |
attribute | Any |
(shared captured text) |
Imperial9x12 |
attribute | Any |
(shared captured text) |
Inch |
attribute | Any |
(shared captured text) |
JisB0 |
attribute | Any |
(shared captured text) |
JisB1 |
attribute | Any |
(shared captured text) |
JisB10 |
attribute | Any |
(shared captured text) |
JisB2 |
attribute | Any |
(shared captured text) |
JisB3 |
attribute | Any |
(shared captured text) |
JisB4 |
attribute | Any |
(shared captured text) |
JisB5 |
attribute | Any |
(shared captured text) |
JisB6 |
attribute | Any |
(shared captured text) |
JisB7 |
attribute | Any |
(shared captured text) |
JisB8 |
attribute | Any |
(shared captured text) |
JisB9 |
attribute | Any |
(shared captured text) |
Landscape |
attribute | Any |
(shared captured text) |
LargeCapacity |
attribute | Any |
|
LargeFormat |
attribute | Any |
|
LastPageFirst |
attribute | Any |
|
LastPageSize |
attribute | Any |
(shared captured text) |
LastPaperSource |
attribute | Any |
|
Ledger |
attribute | Any |
(shared captured text) |
Legal |
attribute | Any |
(shared captured text) |
LegalExtra |
attribute | Any |
(shared captured text) |
Letter |
attribute | Any |
(shared captured text) |
LetterExtra |
attribute | Any |
(shared captured text) |
LetterPlus |
attribute | Any |
(shared captured text) |
LetterSmall |
attribute | Any |
(shared captured text) |
Lower |
attribute | Any |
|
Manual |
attribute | Any |
|
MaxPageSource |
attribute | Any |
|
Middle |
attribute | Any |
|
Millimeter |
attribute | Any |
(shared captured text) |
NPageSize |
attribute | Any |
(shared captured text) |
NPaperSize |
attribute | Any |
(shared captured text) |
NativeFormat |
attribute | Any |
(shared captured text) |
Note |
attribute | Any |
(shared captured text) |
OnlyOne |
attribute | Any |
|
Orientation |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
OutputFormat |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
PageOrder |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
PageRange |
attribute | Any |
(shared captured text) |
PageSize |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
PaintDeviceMetric |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
PaperSource |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
PdfFormat |
attribute | Any |
|
PdmDepth |
attribute | Any |
(shared captured text) |
PdmDevicePixelRatio |
attribute | Any |
(shared captured text) |
PdmDevicePixelRatioScaled |
attribute | Any |
(shared captured text) |
PdmDpiX |
attribute | Any |
(shared captured text) |
PdmDpiY |
attribute | Any |
(shared captured text) |
PdmHeight |
attribute | Any |
(shared captured text) |
PdmHeightMM |
attribute | Any |
(shared captured text) |
PdmNumColors |
attribute | Any |
(shared captured text) |
PdmPhysicalDpiX |
attribute | Any |
(shared captured text) |
PdmPhysicalDpiY |
attribute | Any |
(shared captured text) |
PdmWidth |
attribute | Any |
(shared captured text) |
PdmWidthMM |
attribute | Any |
(shared captured text) |
Pica |
attribute | Any |
(shared captured text) |
Point |
attribute | Any |
(shared captured text) |
Portrait |
attribute | Any |
(shared captured text) |
Postcard |
attribute | Any |
(shared captured text) |
Prc16K |
attribute | Any |
(shared captured text) |
Prc32K |
attribute | Any |
(shared captured text) |
Prc32KBig |
attribute | Any |
(shared captured text) |
PrintRange |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
PrinterMode |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
PrinterResolution |
attribute | Any |
|
PrinterState |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
Quarto |
attribute | Any |
(shared captured text) |
ScreenResolution |
attribute | Any |
|
Selection |
attribute | Any |
(shared captured text) |
SmallFormat |
attribute | Any |
|
Statement |
attribute | Any |
(shared captured text) |
SuperA |
attribute | Any |
(shared captured text) |
SuperB |
attribute | Any |
(shared captured text) |
Tabloid |
attribute | Any |
(shared captured text) |
TabloidExtra |
attribute | Any |
(shared captured text) |
Tractor |
attribute | Any |
|
Unit |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
Upper |
attribute | Any |
|
__init__ |
function | (self, *args: Any, **kwargs: Any) -> None |
Native constructor; consult class documentation for supported overloads. (shared captured text) |
abort |
function | (self) -> bool |
X.abort() -> bool |
actualNumCopies |
function | (self) -> int |
X.actualNumCopies() -> int |
className |
function | (self, *args: Any, **kwargs: Any) -> Any |
Return the classname of the object (shared captured text) |
collateCopies |
function | (self) -> bool |
X.collateCopies() -> bool |
colorCount |
function | (self) -> int |
X.colorCount() -> int (shared captured text) |
colorMode |
function | (self) -> Any |
Returns the current color mode. |
copyCount |
function | (self) -> int |
X.copyCount() -> int |
creator |
function | (self) -> str |
X.creator() -> str |
delete |
function | (self, *args: Any, **kwargs: Any) -> Any |
Deletes the C++ object (at your own risk, my friend!) (shared captured text) |
depth |
function | (self) -> int |
X.depth() -> int (shared captured text) |
devType |
function | (self) -> int |
X.devType() -> int |
devicePageLayout |
function | (self) -> Any |
X.devicePageLayout() -> PythonQt.QtGui.QPageLayout (shared captured text) |
devicePixelRatio |
function | (self) -> int |
X.devicePixelRatio() -> int (shared captured text) |
devicePixelRatioF |
function | (self) -> float |
X.devicePixelRatioF() -> float (shared captured text) |
devicePixelRatioFScale |
function | (self) -> float |
X.devicePixelRatioFScale() -> float (shared captured text) |
docName |
function | (self) -> str |
X.docName() -> str |
doubleSidedPrinting |
function | (self) -> bool |
X.doubleSidedPrinting() -> bool |
duplex |
function | (self) -> Any |
Returns the current duplex mode. |
fontEmbeddingEnabled |
function | (self) -> bool |
X.fontEmbeddingEnabled() -> bool |
fromPage |
function | (self) -> int |
X.fromPage() -> int |
fullPage |
function | (self) -> bool |
X.fullPage() -> bool |
getPageMargins |
function | (self, left: Any, top: Any, right: Any, bottom: Any, unit: Any) -> Any |
X.getPageMargins(left, top, right, bottom, unit) |
height |
function | (self) -> int |
X.height() -> int (shared captured text) |
heightMM |
function | (self) -> int |
X.heightMM() -> int (shared captured text) |
help |
function | (self, *args: Any, **kwargs: Any) -> Any |
Shows the help of available methods for this class (shared captured text) |
inherits |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns if the class inherits or is of given type name (shared captured text) |
initPainter |
function | (self, painter: Any) -> Any |
(shared captured text) |
isValid |
function | (self) -> bool |
X.isValid() -> bool |
logicalDpiX |
function | (self) -> int |
X.logicalDpiX() -> int (shared captured text) |
logicalDpiY |
function | (self) -> int |
X.logicalDpiY() -> int (shared captured text) |
margins |
function | (self) -> Any |
X.margins() -> PythonQt.QtGui.QPagedPaintDevice::Margins (shared captured text) |
metric |
function | (self, arg__1: Any) -> int |
X.metric(arg__1) -> int |
newPage |
function | (self) -> bool |
X.newPage() -> bool |
numCopies |
function | (self) -> int |
X.numCopies() -> int |
orientation |
function | (self) -> Any |
|
outputFileName |
function | (self) -> str |
X.outputFileName() -> str |
outputFormat |
function | (self) -> Any |
Returns the output format for this printer. |
pageLayout |
function | (self) -> Any |
X.pageLayout() -> PythonQt.QtGui.QPageLayout |
pageOrder |
function | (self) -> Any |
Returns the current page order. |
pageRect |
function | (self, arg__1: Any) -> Any |
X.pageRect(arg__1) -> PythonQt.QtCore.QRect |
pageSize |
function | (self) -> Any |
|
pageSizeMM |
function | (self) -> Any |
X.pageSizeMM() -> PythonQt.QtCore.QSizeF (shared captured text) |
paintEngine |
function | (self) -> Any |
X.paintEngine() -> PythonQt.QtGui.QPaintEngine |
paintingActive |
function | (self) -> bool |
X.paintingActive() -> bool (shared captured text) |
paperName |
function | (self) -> str |
X.paperName() -> str |
paperRect |
function | (self, arg__1: Any) -> Any |
X.paperRect(arg__1) -> PythonQt.QtCore.QRect |
paperSize |
function | (self, unit: Any) -> Any |
|
paperSource |
function | (self) -> Any |
Returns the printer's paper source. |
physicalDpiX |
function | (self) -> int |
X.physicalDpiX() -> int (shared captured text) |
physicalDpiY |
function | (self) -> int |
X.physicalDpiY() -> int (shared captured text) |
printEngine |
function | (self) -> Any |
X.printEngine() -> PythonQt.QtGui.QPrintEngine |
printProgram |
function | (self) -> str |
X.printProgram() -> str |
printRange |
function | (self) -> Any |
Returns the page range of the [QPrinter](https://doc.qt.io/archives/qt-5.15/qprinter.html). |
printerName |
function | (self) -> str |
X.printerName() -> str |
printerState |
function | (self) -> Any |
Returns the current state of the printer. |
redirected |
function | (self, offset: Any) -> Any |
X.redirected(offset) -> PythonQt.QtGui.QPaintDevice (shared captured text) |
resolution |
function | (self) -> int |
X.resolution() -> int |
setCollateCopies |
function | (self, collate: bool) -> None |
Sets the default value for collation checkbox when the print dialog appears. |
setColorMode |
function | (self, arg__1: Any) -> None |
Sets the printer's color mode to newColorMode, which can be either Color or GrayScale. |
setCopyCount |
function | (self, arg__1: int) -> None |
Sets the number of copies to be printed to count. |
setCreator |
function | (self, arg__1: str) -> None |
Sets the name of the application that created the document to creator. |
setDocName |
function | (self, arg__1: str) -> None |
Sets the document name to name. |
setDoubleSidedPrinting |
function | (self, enable: bool) -> None |
|
setDuplex |
function | (self, duplex: Any) -> None |
Enables double sided printing based on the duplex mode. |
setEngines |
function | (self, printEngine: Any, paintEngine: Any) -> None |
X.setEngines(printEngine, paintEngine) |
setFontEmbeddingEnabled |
function | (self, enable: bool) -> None |
Enabled or disables font embedding depending on enable. |
setFromTo |
function | (self, fromPage: int, toPage: int) -> None |
X.setFromTo(fromPage, toPage) |
setFullPage |
function | (self, arg__1: bool) -> None |
If fp is true, enables support for painting over the entire page; otherwise restricts painting to the printable area reported by the device. |
setMargins |
function | (self, m: Any) -> None |
|
setNumCopies |
function | (self, arg__1: int) -> None |
|
setOrientation |
function | (self, arg__1: Any) -> None |
|
setOutputFileName |
function | (self, arg__1: str) -> None |
Sets the name of the output file to fileName. |
setOutputFormat |
function | (self, format: Any) -> None |
Sets the output format for this printer to format. |
setPageLayout |
function | (self, pageLayout: Any) -> bool |
X.setPageLayout(pageLayout) -> bool |
setPageMargins |
function | (self, left: Any, top: Any, right: Any, bottom: Any, unit: Any) -> Any |
X.setPageMargins(left, top, right, bottom, unit) |
setPageOrder |
function | (self, arg__1: Any) -> None |
Sets the page order to pageOrder. |
setPageOrientation |
function | (self, orientation: Any) -> bool |
X.setPageOrientation(orientation) -> bool |
setPageSize |
function | (self, arg__1: Any) -> Any |
Sets the page size to pageSize. |
setPageSizeMM |
function | (self, size: Any) -> None |
|
setPaperName |
function | (self, paperName: str) -> None |
|
setPaperSize |
function | (self, paperSize: Any, unit: Any) -> None |
X.setPaperSize(paperSize, unit) |
setPaperSource |
function | (self, arg__1: Any) -> None |
Sets the paper source setting to source. |
setPrintProgram |
function | (self, arg__1: str) -> None |
Sets the name of the program that should do the print job to printProg. |
setPrintRange |
function | (self, range: Any) -> None |
Sets the print range option in to be range. |
setPrinterName |
function | (self, arg__1: str) -> None |
Sets the printer name to name. |
setResolution |
function | (self, arg__1: int) -> None |
Requests that the printer prints at dpi or as near to dpi as possible. |
setWinPageSize |
function | (self, winPageSize: int) -> None |
|
sharedPainter |
function | (self) -> Any |
X.sharedPainter() -> PythonQt.QtGui.QPainter (shared captured text) |
supportedResolutions |
function | (self) -> tuple |
X.supportedResolutions() -> tuple |
supportsMultipleCopies |
function | (self) -> bool |
X.supportsMultipleCopies() -> bool |
toPage |
function | (self) -> int |
X.toPage() -> int |
width |
function | (self) -> int |
X.width() -> int (shared captured text) |
widthMM |
function | (self) -> int |
X.widthMM() -> int (shared captured text) |
winPageSize |
function | (self) -> int |
X.winPageSize() -> int |