# Python X2Go (Client) API Documentation (v0.6.1.4)

## x2go.backends.printing.file module

`x2go.backends.printing.file.X2GoClientPrinting` class is one of Python X2Go’s public API classes.

Retrieve an instance of this class from your `x2go.client.X2GoClient` instance.

Use this class in your Python X2Go based applications to access the »printing« configuration of your X2Go client application.

class x2go.backends.printing.file.X2GoClientPrinting(config_files=['/sbuild-nonexistent/.x2goclient/printing', '/etc/x2goclient/printing'], defaults={'CUPS': {'defaultprinter': 'PDF'}, 'General': {'pdfview': True, 'showdialog': False}, 'print': {'command': 'lpr', 'ps': False, 'startcmd': False, 'stdin': False}, 'save': {'folder': 'PDF'}, 'view': {'command': 'xdg-open', 'open': True}}, client_instance=None, logger=None, loglevel=56)

  Bases: `X2GoIniFile`

  `x2go.backends.printing.file.X2GoClientPrinting` provides access to the X2Go ini-like file »printing« as stored in `~/.x2goclient/printing` resp. globally `/etc/x2goclient/printing`.

  An instance of `x2go.backends.printing.file.X2GoClientPrinting` is created on each incoming print job. This facilitates that on every print job the print action for this job is derived from the »printing« configuration file.

  Thus, changes on the file are active for the next incoming print job.

  config_files = []
  get_print_action(reload=False, reinit=False, return_name=False)

    Return the print action described by the »printing« configuration file.

    Parameters:

      - reload (`bool`) – reload the configuration file before retrieving the print action? (Default value = False)

      - reinit (`bool`) – re-detect the print action from what is stored in cache? (Default value = False)

      - return_name (`bool`) – return the print action name, not the class (Default value = False)

    Returns:

      the configured print action

    Return type:

      `obj` or `str`

  get_property(print_property)

    Retrieve a printing property as mapped by the `_print_property_map()` dictionary.

    Parameters:

      print_property (`str`) – a printing property

    Returns:

      the stored value for `<print_property>`

    Return type:

      `str`

    Raises:

      X2GoClientPrintingException – if the printing property does not exist

  property print_action

    Return the print action described by the »printing« configuration file.

    This method has property status and wraps around the `get_print_action()`

    Returns:

      Returns the print action object

    Return type:

      `obj` or `str`

  set_property(print_property, value)

    Set a printing property as mapped by the `_print_property_map()` dictionary.

    Parameters:

      - print_property (`str`) – a printing property

      - value (`str`) – the value to be stored as `<print_property>`

    Raises:

      X2GoClientPrintingException – if the printing property does not exist or if there is a type mismatch

  store_print_action(print_action, **print_properties)

    Accept a new print action configuration. This includes the print action itself (DIALOG, PDFVIEW, PDFSAVE, PRINT or PRINTCMD) and related printing properties as mapped by the `_print_property_map()` dictionary.

    Parameters:

      - print_action (`str`) – the print action name

      - print_properties (`dict`) – the printing properties to set for the given print action