Fix for printouts without margins

Kurt Pfeifle k1pfeifle at
Tue Jan 18 20:54:02 GMT 2005

On Tuesday 18 January 2005 20:00, David Faure wrote:
> After my wife hit that bug yet again, I decided it was time to fix it :)

Don't fix what ain't broken!   ;-)

> When printing from KHTML (a webpage or a mail), it is quite common to end up with
> a printout that has no margins at all - i.e. the text tries to start from the top and left borders
> of the physical page, and the printer eats a few characters due to that.

If the printer eats characters, the PPD for that printer is probably 
the wrong one (or has a bug).

> The reason is that the PPD file for the printer says
> *ImageableArea A4/A4: "0 0 595 842"
> *PaperDimension A4/A4: "595 842"

To make that PPD describe your printer's capabilities for A4, this 
should probably be changed to 

  *ImageableArea A4/A4: "24 24 571 818"

> i.e. no margins at all.
> (Of course people who use a PPD which specifies margins don't see this bug - lucky them).
> I think kdeprint should ignore that and let qt use default margins in such a case.

I dont think kdeprint should interfere with that by "ignoring".

There is already a way for users to control margins for HTML 

  kprinter --> Properties --> Margins --> Use custom margins [ --> Save ]

Works perfectly. (Note that you only see the "Margins" tab if 
you print from a KDE application.)

> Applications which use setFullPage(true), like kword, can still print in the corners
> as one would expect; the change seems to only affect code that use setFullPage(false),
> like KHTML.
> Any objections to me committing the attached patch?

Yes. (But I admit I am not fully aware of the implications. If 
they still allow to go back to "zero" margins in cases where I
need them, it may be OK for me).
Kurt  [ who thinks it is by far more sucking that he cant control font
        sizes from khtml printing. After all, khtml can re-render font
        sizes for on-screen layout on the fly -- why not for on-paper 
        layout. The way khtml determines font sizes is a mystery to me.
        It seems to take into account images on the page too, and scales
        them plus the text the same amount. Result is more often than
        not way to small fonts. Gimme a "Zoom Printed Font" control, 
        please! ]

More information about the kde-core-devel mailing list