Python Forum

Full Version: printing to a printer vs the screen
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As a beginner, I have searched this forum (though I may not be doing it right) and the internet to find out how to print to my printer vs a print command that prints  in a window on my screen (I am using Pycharm editor).  I have formatted a nice report that prints on my screen but cannot find out how to print the same report to my default printer.

Can someone direct me to a source or show the line of code that will do it?

thanks
This is likely not really something for a fresh beginner to tackle.
As some suggest in this stack thread you will probably be able to accomplish it with system calls.
Doing this in a platform agnostic way would be the tricky part.
I looked at the thread. WOW! I thought it would be a simple thing. Apparently not. Thank you for the link -- I will wait till I know more to tackle it.
It is just a subprocess call to lpr command on Linux. For Windows...
See pyscreenshot package: https://pypi.python.org/pypi/pyscreenshot
Quote:The pyscreenshot module can be used to copy the contents of the screen to a PIL or Pillow image memory. Replacement for the ImageGrab Module, which works on Windows only. For handling image memory (e.g. saving to file, converting,..) please read PIL or Pillow documentation.