Skip to content

Printer

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
  3139716372["printsupport.Printer"]
  843310278["gui.PagedPaintDeviceMixin"]
  625385617["gui.PaintDeviceMixin"]
  2751680898["builtins.object"]
  2762415953["QtPrintSupport.QPrinter"]
  3135357020["QtGui.QPagedPaintDevice"]
  673956333["QtGui.QPaintDevice"]
  37984305["Shiboken.Object"]
  843310278 --> 3139716372
  625385617 --> 843310278
  2751680898 --> 625385617
  2751680898 --> 843310278
  2762415953 --> 3139716372
  3135357020 --> 2762415953
  673956333 --> 3135357020
  37984305 --> 673956333
  2751680898 --> 37984305

🛈 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))

:fa-brands-github: Show source on GitHub