Printer

With the printer module, you can print the tracks built with the library. It uses CUPS.

Warning

This module can be used only on Linux and macOS.

class printer.Printer

Bases: object

Manage the printer to print a track. It is composed of three fields:

  • conn: connection to the CUPS server

  • printer_name: the name of the default printer

  • file_tiles: the path to the PDF document with the tiles to print

Raises:

LineTrackDesignerError – no printers found

Note

If no printer is found, you need to add one in your devices.

__init__()

Init a Printer object.

property conn

Get the connection.

property printer_name

Get the name of the printer.

property file_tiles

Get the path of the PDF file.

__str__()

Make the string format of the Printer object. It returns the name of the printer.

__repr__()

Make the repr format of the Printer object. It’s the same than the string format.

print_page(copies, pages, title, media='a4')

Ask to the printer to print pages of the PDF file.

Parameters:
  • copies (int) – number of copies to print

  • pages (int) – pages to print

  • title (str) – name of the printing

  • media (str) – format (default: ‘a4’)

Raises:

LineTrackDesignerError – printing failed