Advertisement
metalx1000

lpr Printing notes

Mar 18th, 2021 (edited)
1,966
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.22 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. #set jobs and information
  41. lpstat -o
  42. lpstat -t
  43.  
  44. #Cancel the current job on the default printer:
  45. lprm
  46.  
  47. #Cancel job 1234:
  48. lprm 1234
  49.  
  50. #Cancel all jobs:
  51. lprm -
  52.  
  53.  
  54. ###print office document##
  55. #lpr can not print office docs
  56. #so we convert them to pdf first with unoconv
  57. sudo apt install unoconv
  58. unoconv --stdout /tmp/file.odt |lpr -P PDF -T Writer_Document
  59. unoconv --stdout /tmp/sheet.ods |lpr -P PDF -T Spread_Sheet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement