Hi Albrecht:

On 02/07/2019 03:14:28 PM Thu, Albrecht Dreß wrote:
Hi all,

printing of HTML message parts is a feature missing in Balsa, and some users 
complained about it.  The problem is that Webkit supports printing, but not 
“embedded” into the email structure.  As a workaround, Balsa supports printing 
the html part /only/ (right-click on the html view), but this lacks the headers 
and other parts in the result.

Attached is a proposal for solving the issue.  The basic idea is to let Webkit 
render the HTML content into a Cairo (image, pixel) surface, and then print the 
surface pretty much like an image, if necessary split over multiple pages.

The patch uses a resolution of approximately 200 dpi (as it is not easy to 
control the output width Webkit uses when rendering to an offline window) and a 
zoom factor of 2 which for me gives a “usable” output.  It is not vector 
graphics, so the quality is somewhat limited, but IMHO should be sufficient.  
Maybe we should make the dpi and zoom factor setting configurable.

An other problem may occur when longer HTML parts are distributed over multiple 
pages: a line of text may be split into two halves, as the splitter of course 
has no idea about the content.  A solution might be adding a little overlap 
(maybe 2-3mm), i.e. if the last line one one page is intersected, if will 
(hopefully) be complete on top of the next page.

The print dialogue has two new options: whether text/plain shall be preferred 
over text/html or not, and whether external images shall be loaded for 
printing.  Note that these two options are “volatile” – the former is 
initialised from the same display option, and the latter is always off as 
default for privacy reasons.  Related to this, I took the opportunity to clean 
printing multipart/alternative parts by printing only the selected version.

As always, any comment is welcome!

Cheers,
Albrecht.

Thanks for the patch! Great to add the missing functionality--works well for me.

Best,

Peter

Attachment: pgpOWEtby8Ugo.pgp
Description: PGP signature

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list

Reply via email to