adding color to my printing function

This commit is contained in:
Chris Cochrun 2026-02-06 15:17:08 -06:00
parent c58ec8f0db
commit 9b73c8a121
2 changed files with 10 additions and 2 deletions

View file

@ -5094,11 +5094,15 @@ Let's use pdf-tools for a lot better interaction with pdfs.
(interactive)
(let* ((copies (completing-read "How many copies: " '("1" "2" "3")))
(sides (completing-read "Print both sides or one? " '("two sided" "one sided")))
(color (y-or-n-p "Print with color?"))
(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"
""))))
"")
,(if color
"-o ColorModel=RGB"
"-o ColorModel=Gray"))))
(message "printing %s copies." copies)
(async-shell-command (format "lpr %s '%s'" (string-join pdf-misc-print-program-args " ") (buffer-file-name)))))

View file

@ -3741,11 +3741,15 @@ current buffer's, reload dir-locals."
(interactive)
(let* ((copies (completing-read "How many copies: " '("1" "2" "3")))
(sides (completing-read "Print both sides or one? " '("two sided" "one sided")))
(color (y-or-n-p "Print with color?"))
(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"
""))))
"")
,(if color
"-o ColorModel=RGB"
"-o ColorModel=Gray"))))
(message "printing %s copies." copies)
(async-shell-command (format "lpr %s '%s'" (string-join pdf-misc-print-program-args " ") (buffer-file-name)))))