I am building a website which accepts pdf from users and the options, like pages to print, copies, color or black&white and the shop from which they want to get it printed.
The pdf will be stored in server and will be passed on to the shop to print. How do i get it printed automatically with those options applied. One way i thought was to edit the pdf and sent to the store to print with the options applied.
How do i print the pdf automatically and report back to the server that the pdf was printed?
chose python as it may have easy implementation. BTW i'll build website using NodeJS
CodePudding user response:
You can do the following:
import os
os.startfile("C:/Users/TestFile.txt", "print")
This will start the file, in its default opener, with the verb 'print', which will print to your default printer.Only requires the os module which comes with the standard library
This only works on windows. So if you want it to work on other OS's you'll need a way to detect which OS the pdf is being sent to.