Created
September 29, 2017 13:44
-
-
Save JasonCrowe/faebf5694c3e48ea69eabeb459bf113e to your computer and use it in GitHub Desktop.
Printing from python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tempfile | |
import win32api | |
import win32print | |
filename = tempfile.mktemp (".txt") | |
open (filename, "w").write (str(df)) | |
win32api.ShellExecute ( | |
0, | |
"print", | |
filename, | |
# | |
# If this is None, the default printer will | |
# be used anyway. | |
# | |
'/d:"%s"' % win32print.GetDefaultPrinter (), | |
".", | |
0 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment