'how to print a png/jpeg/pdf to my default printer everyday at a specifc time
i tried doing this, but it does not work with png, if you can help out, that would be great!
import datetime
while True:
now = datetime.datetime.now()
if now.hour == 8 and now.minute == 10:
os.startfile(r'''D:\testpage.png''', "print")
break
Solution 1:[1]
Is it necessary to be done with python? Instead of writing a program that runs in the background and checks the time, it is better to use a built-in solution in your OS like cron.
You can find here how to run scheduled tasks on Windows: Setting up a cron job in Windows
And how to print files from command line: command line tool for print picture?
Solution 2:[2]
Answer: i used the command
mspaint /pt [image filename]
using notepad and saved it as a batch file, and used Windows Task Scheduler to run the batch file everyday Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | fela |
| Solution 2 |
