Reputation: 58
I have a printer connected to raspberry pi and I want to print a .xlxs file which is in raspberry pi using python or php .I have tried CUPS and libreoffice.By using CUPS i did able to print txt file but not any other file using python using below code..
import cups
conn = cups.Connection()
printers = conn.getPrinters()
printer_name = printers.keys()[0]
conn.printFile(printer_name,'path to file',"",{})
By using libreoffice and subprocess i can print .xlxs file but only when i run python file directly and not able to print when python file is executed by php file.
subprocess.call('libreoffice --pt <printername> <path to file>',shell=True)
So which method to follow to print file?
Upvotes: 0
Views: 138