Skip to content

Printer

Qt Base Class: QPrinter

Signature: QPrinter(self, mode: PySide6.QtPrintSupport.QPrinter.PrinterMode = Instance(PySide6.QtPrintSupport.QPrinter.PrinterMode.ScreenResolution)) -> None QPrinter(self, printer: PySide6.QtPrintSupport.QPrinterInfo, mode: PySide6.QtPrintSupport.QPrinter.PrinterMode = Instance(PySide6.QtPrintSupport.QPrinter.PrinterMode.ScreenResolution)) -> None

Base classes

Name Children Inherits
PagedPaintDeviceMixin
prettyqt.gui.pagedpaintdevice
QPrinter
PySide6.QtPrintSupport
QPrinter(self, mode: PySide6.QtPrintSupport.QPrinter.PrinterMode \= Instance(PySide6.QtPrintSupport.QPrinter.PrinterMode.ScreenResolution)) -> None

⋔ Inheritance diagram

graph TD
  1473572238864["printsupport.Printer"]
  1473245618752["gui.PagedPaintDeviceMixin"]
  1473245548480["gui.PaintDeviceMixin"]
  140713234304496["builtins.object"]
  1473572059520["QtPrintSupport.QPrinter"]
  1473300089200["QtGui.QPagedPaintDevice"]
  1473300082368["QtGui.QPaintDevice"]
  1473291690208["Shiboken.Object"]
  1473245618752 --> 1473572238864
  1473245548480 --> 1473245618752
  140713234304496 --> 1473245548480
  1473572059520 --> 1473572238864
  1473300089200 --> 1473572059520
  1473300082368 --> 1473300089200
  1473291690208 --> 1473300082368
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: PagedPaintDeviceMixin, QPrinter

Paint device that paints on a printer.

Source code in prettyqt\printsupport\printer.py
class Printer(gui.PagedPaintDeviceMixin, QtPrintSupport.QPrinter):
    """Paint device that paints on a printer."""

    # def get_source(self) -> pathlib.Path:
    #     return pathlib.Path(self.source().toLocalFile())

    def get_duplex(self) -> DuplexModeStr:
        return DUPLEX_MODE.inverse[self.duplex()]

    def get_pdf_version(self) -> gui.pagedpaintdevice.PdfVersionStr:
        return gui.pagedpaintdevice.PDF_VERSION.inverse[self.pdfVersion()]

    def set_pdf_version(
        self,
        version: gui.pagedpaintdevice.PdfVersionStr | gui.PagedPaintDevice.PdfVersion,
    ):
        """Set pdf version.

        Args:
            version: pdf version
        """
        self.setPdfVersion(gui.pagedpaintdevice.PDF_VERSION.get_enum_value(version))

set_pdf_version(version: gui.pagedpaintdevice.PdfVersionStr | gui.PagedPaintDevice.PdfVersion)

Set pdf version.

Parameters:

Name Type Description Default
version PdfVersionStr | PdfVersion

pdf version

required
Source code in prettyqt\printsupport\printer.py
def set_pdf_version(
    self,
    version: gui.pagedpaintdevice.PdfVersionStr | gui.PagedPaintDevice.PdfVersion,
):
    """Set pdf version.

    Args:
        version: pdf version
    """
    self.setPdfVersion(gui.pagedpaintdevice.PDF_VERSION.get_enum_value(version))