Bug 338031 - printer output cut off on the left
Summary: printer output cut off on the left
Status: RESOLVED WORKSFORME
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: 3.13.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-04 14:54 UTC by Glenn Holmer
Modified: 2015-10-04 18:41 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Photograph of printed output. On the left is output from "lpr -P<printer-name> <filename>", and on the right is output from kate. (833.58 KB, image/png)
2014-08-04 14:54 UTC, Glenn Holmer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Glenn Holmer 2014-08-04 14:54:18 UTC
Created attachment 88102 [details]
Photograph of printed output. On the left is output from "lpr -P<printer-name> <filename>", and on the right is output from kate.

When printing, a couple of pixels on the left are missing. My printer is an HP CP1525nw color LaserJet. I tried it on Kubuntu 14.04 with the "HP Color LaserJet CP1510 Series Postscript (recommended)" driver as well as OpenSUSE 13.1 with hplip. Printing from e.g. emacs or "lpr <filename>" works normally. See attachment.

Several people on the Kubuntu mailing list have confirmed the same issue:
https://lists.ubuntu.com/archives/kubuntu-users/2014-August/059710.html
Comment 1 Doug McGarrett 2014-08-04 16:32:55 UTC
This is Doug McGarrett, one of those who confirmed the problem. On my LaserJet 2200dn, I usually lose the whole first character on each line, not just a few pixels.
Comment 2 Christoph Feck 2014-08-04 19:20:11 UTC
Try changing the margin settings in .kde/share/config/katerc

[Kate Print Settings][Margins]
bottom=10
left=10
right=10
top=10

On my system, these are "millimeters", but the actual unit may depend on locale, so experiment with them. To save toner or ink, please print to PDF file, and you can use Okular to view how big the margins are.
Comment 3 Glenn Holmer 2014-08-04 19:46:34 UTC
I changed all four settings from 3.52777777777944 to 5 and it prints fine now. But why doesn't kate print properly out of the box? Where does that number come from initially?
Comment 4 Christoph Feck 2014-08-04 21:51:02 UTC
3.52777mm = 10pt. From what I see, this value comes from QPrinter.
Inside the Kate sources, you can find this comment:

  // NOTE: Saving & loading the margins works around QPrinter/QPrintDialog bugs:
  // - https://bugreports.qt.nokia.com/browse/QTBUG-15351
  // - https://bugs.kde.org/show_bug.cgi?id=205802
  // - https://bugs.kde.org/show_bug.cgi?id=180051
  // Changing the margins now works. However, when you reopen the print dialog
  // later, the WRONG margins are displayed. The correct ones are still used.
  // This is a critical bug in Qt.

Maybe this comment is outdated, and we can now trust Qt 4.8 and should remove that part of the code. At least this should be re-evaluated for Qt 5.3, which has completely rewritten margin handling.
Comment 5 Martin Walch 2014-08-13 07:55:23 UTC
Qt Bug 15351 says that it is fixed in Qt 5, but not yet in 4.8. Fix was planned for 4.8.6, but got delayed for 4.8.7. Now it is doubtful that it will make it into 4.8.7 as that is to be released within several weeks, while the fix is still not backported.

https://bugreports.qt-project.org/browse/QTBUG-15351
Comment 6 Christoph Cullmann 2015-10-04 18:41:55 UTC
IMHO the code was changed in the KF5 port, at least I fail to find that comment and it works with Qt 5 / KF 5, for KDE 4.x we won't change stuff, if Qt fixes it in Qt 4.x, nice, else we need to live with that for 4.x