astroid
astroid copied to clipboard
Printing not possible anymore
In the past I was able to print messages without issues. Now with the current AUR I am not able to print. Pressing the shortcut has no effects. Maybe something connected with the major upgrade around webkit? Thank you!
Matthias Kirschner writes on September 12, 2018 8:50:
In the past I was able to print messages without issues. Now with the current AUR I am not able to print. Pressing the shortcut has no effects. Maybe something connected with the major upgrade around webkit? Thank you!
Confirmed. Has not been implemented for webkit2 yet.
Thanks for confirming. It would be very helpful for me to have this function back under webkit2. Again thanks for your work.
It's been ten months now since this issue was reported. Is there any road map or time estimate for restoring printing in astroid?
Is there a work-around? Has anyone written a script which, for example, pipes the HTML to a command-line renderer to PDF and then opens a print dialog?
Is there a work-around? Has anyone written a script which, for example, pipes the HTML to a command-line renderer to PDF and then opens a print dialog?
I haven't played with html as not all emails have a html part. Instead, I've written a couple of python hook scripts which take the message id of the currently displayed email (thread view), locate the eml file for the email, convert that file to pdf using Nick Russler's java-based EML to PDF converter (github repo), and then either save the pdf file to disk or print it.
Here are the scripts: save_as_pdf.gz and print_via_pdf.gz.
I bound the scripts to w and W, respectively. Here is the relevant extract from my keybindings file:
# w = save email as pdf
thread_view.run(hooks::save_as_pdf %2)=w
# W = print email
thread_view.run(hooks::print_via_pdf %2)=W
Some massive caveats:
- The EML to PDF converter has trouble downloading some, but not all, external image links in emails, but it gets the overall layout correct and I find it good enough for my needs.
- The final quality of the pdf is nowhere close to professional EML to PDF conversion products (there are several such services available online) but, again, I find it is usually good enough for my needs.
- Printing is implemented only for linux (by using xpp) -- those wanting to print in Windows or MacOS will need to add that functionality to the script if they want it. Of course, a simple workaround is to save an email to pdf and then open the pdf in an application with print capability.
- The scripts use the freedesktop.org notification system for displaying error messages -- for those whose desktops do not support that, all error messages are also written to the console.
The scripts are released under GPL-3+ so please feel free to use, play, steal, etc.