Advertisement
metalx1000

lpr Printing notes

Mar 18th, 2021 (edited)
1,915
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.06 KB | None | 0 0
  1. #install cups lpr - This is different then the lpr stand alone package
  2. sudo apt install cups cups-bsd hplip
  3.  
  4. # setup network printer
  5. lpadmin -p HP_PRINTER -E -v ipp://192.168.1.170/ipp/print -m everywhere
  6.  
  7. # set default printer
  8. lpoptions -d HP_PRINTER
  9.  
  10. #get a list of printers
  11. lpstat -p -d
  12.  
  13. #if you don't have a default printer set for your system
  14. lpoptions -d "<Printer from list above>"
  15.  
  16. #print to default printer
  17. lpr file.txt
  18. lpr file.pdf
  19. lpr file.png
  20. echo "Hello World"|lpr
  21. ls |lpr
  22.  
  23. #choose printer to print to
  24. lpr -P "<printer name>" file.txt
  25.  
  26. ###Print to PDF###
  27. sudo apt install cups-pdf
  28.  
  29. #print to pdf
  30. #output goes in ~/PDF
  31. lpr -P PDF file.txt
  32.  
  33. #set job title
  34. lpr -P PDF -t My_Text_File file.txt
  35.  
  36. #set PDF as default printer
  37. lpoptions -d "PDF"
  38. lpr -P PDF -t My_Text_File file.txt
  39.  
  40. ###print office document##
  41. #lpr can not print office docs
  42. #so we convert them to pdf first with unoconv
  43. sudo apt install unoconv
  44. unoconv --stdout /tmp/file.odt |lpr -P PDF -T Writer_Document
  45. unoconv --stdout /tmp/sheet.ods |lpr -P PDF -T Spread_Sheet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement