Python Forum
printing to a printer vs the screen
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
printing to a printer vs the screen
#1
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
Reply
#2
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.
Reply
#3
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.
Reply
#4
It is just a subprocess call to lpr command on Linux. For Windows...
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to send file to printer with no results. chob_thomas 2 3,267 Dec-21-2022, 07:12 AM
Last Post: Pedroski55
  How do you marshal the default printer setup to print? hammer 0 1,251 May-29-2022, 02:54 PM
Last Post: hammer
  Can you print a string variable to printer hammer 2 1,894 Apr-30-2022, 11:48 PM
Last Post: hammer
  Printing to a printer connected to pi 4 alan 2 2,382 Oct-04-2020, 10:08 PM
Last Post: alan
  python-printer-escpos 0.0.3 ERROR neethuvp 1 3,632 Nov-12-2019, 12:20 PM
Last Post: Larz60+
  Is this possible in Python? Auto-Send-to-printer on script run? pcsailor 8 16,689 Jul-19-2019, 09:33 AM
Last Post: perfringo
  wn = turtle.screen() AttributeError: module 'turtle' has no attribute 'screen' Shadower 1 6,127 Feb-06-2019, 01:25 AM
Last Post: woooee
  Control a dot matrix printer Clement_2000 4 4,813 Jan-27-2019, 09:00 PM
Last Post: Clement_2000
  Screen printing on different threads MuntyScruntfundle 1 2,394 Dec-10-2017, 03:46 PM
Last Post: hshivaraj
  print a persian file by thermal printer and python-escpos mnodule gray 12 12,427 Nov-03-2017, 11:15 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020