use correct printer for computer
This commit is contained in:
		
							parent
							
								
									be61aa14fb
								
							
						
					
					
						commit
						b16e4847e3
					
				
					 2 changed files with 14 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -4751,12 +4751,18 @@ Let's use pdf-tools for a lot better interaction with pdfs.
 | 
			
		|||
  (pdf-tools-install)
 | 
			
		||||
  :config
 | 
			
		||||
 | 
			
		||||
  (defun chris/list-printers ()
 | 
			
		||||
    "Lists the printers that are available for the computer"
 | 
			
		||||
    (interactive)
 | 
			
		||||
    (split-string (shell-command-to-string "lpstat -p | awk '{print $2}'")))
 | 
			
		||||
 | 
			
		||||
  (defun chris/print-multi-pdf ()
 | 
			
		||||
    "Print the pdf in as many copies as needed"
 | 
			
		||||
    (interactive)
 | 
			
		||||
    (let* ((copies (completing-read "How many copies: " '("1" "2" "3")))
 | 
			
		||||
           (sides (completing-read "Print both sides or one? " '("two sided" "one sided")))
 | 
			
		||||
           (pdf-misc-print-program-args `("-o media=Letter" ,(format "-# %s" copies) "-P Home" "-o fit-to-page"
 | 
			
		||||
           (printer (completing-read "Which printer do you want to use?" (chris/list-printers)))
 | 
			
		||||
           (pdf-misc-print-program-args `("-o media=Letter" ,(format "-# %s" copies) ,(format "-P %s" printer) "-o fit-to-page"
 | 
			
		||||
                                          ,(if (string= sides "two sided")
 | 
			
		||||
                                              "-o sides=two-sided-long-edge"
 | 
			
		||||
                                             ""))))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								init.el
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								init.el
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -3456,12 +3456,18 @@ targets."
 | 
			
		|||
  (pdf-tools-install)
 | 
			
		||||
  :config
 | 
			
		||||
 | 
			
		||||
  (defun chris/list-printers ()
 | 
			
		||||
    "Lists the printers that are available for the computer"
 | 
			
		||||
    (interactive)
 | 
			
		||||
    (split-string (shell-command-to-string "lpstat -p | awk '{print $2}'")))
 | 
			
		||||
 | 
			
		||||
  (defun chris/print-multi-pdf ()
 | 
			
		||||
    "Print the pdf in as many copies as needed"
 | 
			
		||||
    (interactive)
 | 
			
		||||
    (let* ((copies (completing-read "How many copies: " '("1" "2" "3")))
 | 
			
		||||
           (sides (completing-read "Print both sides or one? " '("two sided" "one sided")))
 | 
			
		||||
           (pdf-misc-print-program-args `("-o media=Letter" ,(format "-# %s" copies) "-P Home" "-o fit-to-page"
 | 
			
		||||
           (printer (completing-read "Which printer do you want to use?" (chris/list-printers)))
 | 
			
		||||
           (pdf-misc-print-program-args `("-o media=Letter" ,(format "-# %s" copies) ,(format "-P %s" printer) "-o fit-to-page"
 | 
			
		||||
                                          ,(if (string= sides "two sided")
 | 
			
		||||
                                              "-o sides=two-sided-long-edge"
 | 
			
		||||
                                             ""))))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue