I was wondering if it is possible to print out a physical document out of a printer with python. Wherever I look in google it talks about printing out something in the actual code. Any Ideas? Basically I want python to log all this data and then once a day print it out. The os I am using is Linux.
Asked
Active
Viewed 1,926 times
0
-
What do you mean when you say 'physical document'? Do you mean *print* by means of a printer (e.g. inkjet)? – Uli Köhler Feb 23 '14 at 16:25
-
Possibly related: http://stackoverflow.com/questions/12723818/print-to-standard-printer-from-python – Uli Köhler Feb 23 '14 at 16:26
-
@UliKöhler I will make an edit, I mean with a printer. – jped Feb 23 '14 at 16:29
-
1This is OS dependent so you need to add more – PyNEwbie Feb 23 '14 at 16:30
-
Try PyWin32 package [tutorial](http://www.blog.pythonlibrary.org/2010/02/14/python-windows-and-printers/) for accessing printers. – Feb 23 '14 at 16:43
1 Answers
0
First, you need to figure out how to print a document to the printer using the command line, e.g. using the lpr command. Then, you can use os.system to call the print command from your script:
import os
os.system('lpr <here you need to find out about the arguments>')

Colin Bernet
- 1,354
- 9
- 12