toga icon indicating copy to clipboard operation
toga copied to clipboard

Implement interaction with printer

Open VFLins opened this issue 3 months ago • 1 comments

What is the problem or limitation you are having?

Toga currently offers support to some hardware, like camera and computer screen, but doesn't offer direct access to printer or scanner.

Describe the solution you'd like

The ideal implementation of this feature would be able to handle:

  • Raw text
  • Text files (e.g. txt or pdf)
  • Image files (e.g. png or jpeg)

One pice of the content listed above would be handed to the OS-specfic print dialog, like the ones attached below, where page selection, printer selection, orientation and other configurations should happen, outside of the Toga application.

Linux (GTK): https://docs.gtk.org/gtk4/class.PrintUnixDialog.html

Windows: Image

MacOS: Image

Android: Image

Describe alternatives you've considered

Handling printers and printing in python is not very straightfoward:

  • there is a package dedicated to windows win32print, win32ui
  • the solution I found for Unix systems would issue a lp command to the system, using Python's subprocess package

Additional context

No response

VFLins avatar Sep 05 '25 12:09 VFLins

I'm generally skeptical about adding support for hardware devices to Toga, but in this case it definitely makes sense, because the printer dialog will need to be linked to the app's existing UI.

mhsmith avatar Sep 05 '25 18:09 mhsmith