Bug 422095 - Bad printout quality of kmail
Summary: Bad printout quality of kmail
Status: REPORTED
Alias: None
Product: kmail2
Classification: Applications
Component: misc (show other bugs)
Version: 5.14.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-26 11:44 UTC by Gerhard
Modified: 2024-04-16 20:00 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerhard 2020-05-26 11:44:09 UTC
Printing any mail from kmail2 to a printer or to pdf file results in a printout that has a low resolution and is slightly blurred.

On a real printer, the printout shows small dithered "clouds" around the text. If you print to a pdf, the text has a low resolution.
 
It seems as if the text is printed out as some sort of graphics, even if it's plain text.

The expected result is that the printed text is crisp and if printed to pdf, that you can change the zoom in a pdf-viewer and the text stay crisp.
 
SOFTWARE/OS VERSIONS
openSUSE Tumbleweed 
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.70
Qt Version: 5.14.1

ADDITIONAL INFORMATION
I can rule out problems with the printer or printer driver. Printout from other KDE apps like kate just work perfectly.
I toggled the setting "print background color and pictures", but it's the same.
Comment 1 Kevin Kofler 2020-11-17 00:38:31 UTC
This is due to how the QtWebEngine print method work. At least for PDF output, this can be easily fixed by using the printToPdf method instead, as done in Falkon.

Please see https://bugs.kde.org/show_bug.cgi?id=378843 and in particular https://bugs.kde.org/show_bug.cgi?id=378843#c11 .

For output to a physical printer, the only way to avoid the rasterization is to use the FilePrinter class from Okular though. Falkon used to do that (I had submitted that code back when the QtWebEngine did not have the print method at all, only printToPdf), but switched to using the print method for physical printers.
Comment 2 Laurent Montel 2020-11-17 07:12:04 UTC
Git commit 9538a30356896ea0c0ee80dfd2f0899f33be5cc0 by Laurent Montel.
Committed on 17/11/2020 at 07:11.
Pushed by mlaurent into branch 'release/20.12'.

Start to fix print to pdf

M  +17   -1    messageviewer/src/viewer/viewer_p.cpp
M  +2    -1    messageviewer/src/viewer/viewer_p.h

https://invent.kde.org/pim/messagelib/commit/9538a30356896ea0c0ee80dfd2f0899f33be5cc0
Comment 3 Laurent Montel 2020-11-17 07:13:36 UTC
Git commit 5b85cf609f37a6a6fcd4add5bb1b3b6aaf75f0ef by Laurent Montel.
Committed on 17/11/2020 at 07:13.
Pushed by mlaurent into branch 'master'.

Start to fix print to pdf

M  +17   -1    messageviewer/src/viewer/viewer_p.cpp
M  +2    -1    messageviewer/src/viewer/viewer_p.h

https://invent.kde.org/pim/messagelib/commit/5b85cf609f37a6a6fcd4add5bb1b3b6aaf75f0ef
Comment 4 Attila 2022-06-10 08:21:35 UTC
Hi,

printing to PDF file is OK. The PDF file has real "text" and fonts are embedded. This has been fixed.

Printing to a real printer produces blurred text. The quality is very poor and the text is not easy to read. Can someone please take a look at this. KMail Version 5.19.2 (21.12.2).

Operating System: Fedora Linux 35
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Kernel Version: 5.17.11-200.fc35.x86_64 (64-bit)
Graphics Platform: X11
Comment 5 Kevin Kofler 2022-06-10 11:24:28 UTC
Printing to a real printer still sends a bitmap to the printer. As I wrote:

> For output to a physical printer, the only way to avoid the rasterization is to use the FilePrinter class from Okular though. Falkon used to do that (I had submitted that code back when the QtWebEngine did not have the print method at all, only printToPdf), but switched to using the print method for physical printers.

What QtWebEngine cannot do is print directly to a QPrinter. The Chromium code can only output PDFs. Then you have to get that PDF to the printer somehow. How QtWebEngine does it is that it renders the PDF to a pixmap using the PDFium library that happens to be bundled with Chromium and then sends that pixmap to the printer. How Okular prints PDFs (and how Falkon used to do it at the beginning) is that it runs the lpr CLI command to send the PDF to the printer. The main difficulty with that is that you have to translate settings such as margins or page orientation or they will just get ignored, and that it also only works with printers that lpr knows about (e.g., you cannot print to PDF with that approach).
Comment 6 Attila 2022-06-13 07:45:35 UTC
(In reply to Kevin Kofler from comment #5)
> Printing to a real printer still sends a bitmap to the printer. As I wrote:
> 
> > For output to a physical printer, the only way to avoid the rasterization is to use the FilePrinter class from Okular though. Falkon used to do that (I had submitted that code back when the QtWebEngine did not have the print method at all, only printToPdf), but switched to using the print method for physical printers.
> 
> What QtWebEngine cannot do is print directly to a QPrinter. The Chromium
> code can only output PDFs. Then you have to get that PDF to the printer
> somehow. How QtWebEngine does it is that it renders the PDF to a pixmap
> using the PDFium library that happens to be bundled with Chromium and then
> sends that pixmap to the printer. How Okular prints PDFs (and how Falkon
> used to do it at the beginning) is that it runs the lpr CLI command to send
> the PDF to the printer. The main difficulty with that is that you have to
> translate settings such as margins or page orientation or they will just get
> ignored, and that it also only works with printers that lpr knows about
> (e.g., you cannot print to PDF with that approach).

Hi,

thank you for the explanation from the developer's point of view.
This is from the user's point of view not satisfying. The printout of e-mails with embedded messages is even worse. The output is very blurred and almost not readable. I think nothing is impossible in the world of IT, so there must be a solution for this issue.
My workaround is to export e-mails to PDF, open them with Okular and print them. This is not really cool. It is a bad user experience.

Please try to find a way to bring the print functionality back with no rasterization.
Comment 7 Erik Quaeghebeur 2022-12-13 22:40:07 UTC
The default print quality is so bad, that it would be better to only offer export/print to pdf (allowing for margin setting) and drop the current print result. Perhaps there is some opendesktop standard for opening files with their default application and open the print dialog?
Comment 8 Arrigo Gosparini 2024-04-16 20:00:36 UTC
At least give the option to export an e-mail to pdf ("export to pdf...") and instead of saving to hd open the e-mail directly in Okular.
This would be an acceptable workaround.