Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to print? #281

Open
julian-hoch opened this issue May 26, 2024 · 2 comments
Open

How to print? #281

julian-hoch opened this issue May 26, 2024 · 2 comments

Comments

@julian-hoch
Copy link

Perhaps I am missing something, but I cannot figure out how to print from pdf-tools.
I can print fine from dired using dired-do-print, but when I open the pdf in pdf-tools and try e.g. print-buffer, it only outputs the source code, not the rendered pdf.
The readme mentions C-c C-p, but for me this opens a query in the mini buffer ("Print with") where I am supposed to enter a path (not sure what to?), instead of printing the current file.

@aikrahguzar
Copy link

I have never tried this so I am going by reading the code so beware!

print-buffer has not chance of working with pdf-tools since it prints the buffer text which pdf-tools hides using overlays and instead shows the rendered images for pages.

pdf-misc-print-document which is bound to C-c C-p uses pdf-misc-print-program-executable and pdf-misc-print-program-args to do the printing. However they are unset by default which is why you get prompted for the path (i.e. you are supposed to enter the path to executable that does the printing).

Since print-buffer and dired-do-print are working, I think you should be able use the values of lpr-command and lpr-swithces for pdf-misc-print-program-executable and pdf-misc-print-program-args respectively. (If this works it would be nice if you could do a PR so that these values are used without user doing anything.)

@julian-hoch
Copy link
Author

Thanks! That was really helpful. Setting pdf-misc-print-program-executable to "lpr" worked, I guess setting that in my init.el will do the trick. Potentially it would be a good idea to fall back to "lpr" if nothing else is defined, but I am not sure if there are reasons we do not know why this was not done in the first place (I mean there must be a reason why this variable exists and is nil by default, right?).
In any case, my elisp chops are not up to standard yet to take that up myself, but hopefully if anyone else has the same issue this ticket will help guide them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants