QPrinterInfo#

The QPrinterInfo class gives access to information about existing printers. More

Synopsis#

Functions#

Static functions#

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#

Use the static functions to generate a list of QPrinterInfo objects. Each QPrinterInfo object in the list represents a single printer and can be queried for name, supported paper sizes, and whether or not it is the default printer.

class PySide6.QtPrintSupport.QPrinterInfo#

PySide6.QtPrintSupport.QPrinterInfo(printer)

PySide6.QtPrintSupport.QPrinterInfo(other)

Parameters:

Constructs an empty QPrinterInfo object.

See also

isNull()

Constructs a QPrinterInfo object from printer.

Constructs a copy of other.

static PySide6.QtPrintSupport.QPrinterInfo.availablePrinterNames()#
Return type:

list of strings

Returns a list of all the available Printer Names on this system.

It is recommended to use this instead of availablePrinters() as it will be faster on most systems.

Note that the list may become outdated if changes are made on the local system or remote print server. Only instantiate required QPrinterInfo instances when needed, and always check for validity before calling.

static PySide6.QtPrintSupport.QPrinterInfo.availablePrinters()#
Return type:

.list of QPrinterInfo

Returns a list of QPrinterInfo objects for all the available printers on this system.

It is NOT recommended to use this as creating each printer instance may take a long time, especially if there are remote networked printers, and retained instances may become outdated if changes are made on the local system or remote print server. Use availablePrinterNames() instead and only instantiate printer instances as you need them.

PySide6.QtPrintSupport.QPrinterInfo.defaultColorMode()#
Return type:

ColorMode

Returns the default color mode of this printer.

PySide6.QtPrintSupport.QPrinterInfo.defaultDuplexMode()#
Return type:

DuplexMode

Returns the default duplex mode of this printer.

PySide6.QtPrintSupport.QPrinterInfo.defaultPageSize()#
Return type:

PySide6.QtGui.QPageSize

Returns the current default Page Size for this printer.

static PySide6.QtPrintSupport.QPrinterInfo.defaultPrinter()#
Return type:

PySide6.QtPrintSupport.QPrinterInfo

Returns the default printer on the system.

The return value should be checked using isNull() before being used, in case there is no default printer.

On some systems it is possible for there to be available printers but none of them set to be the default printer.

static PySide6.QtPrintSupport.QPrinterInfo.defaultPrinterName()#
Return type:

str

Returns the current default printer name.

PySide6.QtPrintSupport.QPrinterInfo.description()#
Return type:

str

Returns the human-readable description of the printer.

See also

printerName()

PySide6.QtPrintSupport.QPrinterInfo.isDefault()#
Return type:

bool

Returns whether this printer is currently the default printer.

PySide6.QtPrintSupport.QPrinterInfo.isNull()#
Return type:

bool

Returns whether this QPrinterInfo object holds a printer definition.

An empty QPrinterInfo object could result for example from calling defaultPrinter() when there are no printers on the system.

PySide6.QtPrintSupport.QPrinterInfo.isRemote()#
Return type:

bool

Returns whether this printer is a remote network printer.

PySide6.QtPrintSupport.QPrinterInfo.location()#
Return type:

str

Returns the human-readable location of the printer.

PySide6.QtPrintSupport.QPrinterInfo.makeAndModel()#
Return type:

str

Returns the human-readable make and model of the printer.

PySide6.QtPrintSupport.QPrinterInfo.maximumPhysicalPageSize()#
Return type:

PySide6.QtGui.QPageSize

Returns the maximum physical page size supported by this printer.

PySide6.QtPrintSupport.QPrinterInfo.minimumPhysicalPageSize()#
Return type:

PySide6.QtGui.QPageSize

Returns the minimum physical page size supported by this printer.

static PySide6.QtPrintSupport.QPrinterInfo.printerInfo(printerName)#
Parameters:

printerName – str

Return type:

PySide6.QtPrintSupport.QPrinterInfo

Returns the printer printerName.

The return value should be checked using isNull() before being used, in case the named printer does not exist.

See also

isNull()

PySide6.QtPrintSupport.QPrinterInfo.printerName()#
Return type:

str

Returns the name of the printer.

This is a unique id to identify the printer and may not be human-readable.

PySide6.QtPrintSupport.QPrinterInfo.state()#
Return type:

PrinterState

Returns the current state of this printer.

This state may not always be accurate, depending on the platform, printer driver, or printer itself.

PySide6.QtPrintSupport.QPrinterInfo.supportedColorModes()#
Return type:

.list of QPrinter.ColorMode

Returns the supported color modes of this printer.

PySide6.QtPrintSupport.QPrinterInfo.supportedDuplexModes()#
Return type:

.list of QPrinter.DuplexMode

Returns a list of duplex modes supported by this printer.

PySide6.QtPrintSupport.QPrinterInfo.supportedPageSizes()#
Return type:

.list of QPageSize

Returns a list of Page Sizes supported by this printer.

PySide6.QtPrintSupport.QPrinterInfo.supportedResolutions()#
Return type:

.list of int

Returns a list of resolutions supported by this printer.

PySide6.QtPrintSupport.QPrinterInfo.supportsCustomPageSizes()#
Return type:

bool

Returns whether this printer supports custom page sizes.