metalx1000

lpr Printing notes

Mar 18th, 2021
1,024
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #install cups lpr - This is different then the lpr stand alone package
  2. sudo apt install cups cups-bsd
  3.  
  4. #get a list of printers
  5. lpstat -p -d
  6.  
  7. #if you don't have a default printer set for your system
  8. lpoptions -d "<Printer from list above>"
  9.  
  10. #print to default printer
  11. lpr file.txt
  12. lpr file.pdf
  13. lpr file.png
  14. echo "Hello World"|lpr
  15. ls |lpr
  16.  
  17. #choose printer to print to
  18. lpr -P "<printer name>" file.txt
  19.  
  20. ###Print to PDF###
  21. sudo apt install cups-pdf
  22.  
  23. #print to pdf
  24. #output goes in ~/PDF
  25. lpr -P PDF file.txt
  26.  
  27. #set job title
  28. lpr -P PDF -t My_Text_File file.txt
  29.  
  30. #set PDF as default printer
  31. lpoptions -d "PDF"
  32. lpr -P PDF -t My_Text_File file.txt
  33.  
  34. ###print office document##
  35. #lpr can not print office docs
  36. #so we convert them to pdf first with unoconv
  37. sudo apt install unoconv
  38. unoconv --stdout /tmp/file.odt |lpr -P PDF -T Writer_Document
  39. unoconv --stdout /tmp/sheet.ods |lpr -P PDF -T Spread_Sheet
RAW Paste Data