check printing margin
Scott Lair
scott at laircpa.com
Fri Nov 28 20:00:55 GMT 2025
On Fri, 21 Nov 2025 11:44:45 -0500
Jack via KMyMoney <kmymoney at kde.org> wrote:
> On 11/21/25 11:11 AM, Scott Lair via KMyMoney wrote:
> [snip.....]
> > I was going into properties in the print dialog that pops up when I
> > click on print check and decreasing the margin as much as possible.
> > I have tried to print to PDF as well and the margins appear the
> > same on screen. When printing a hard copy of the PDF the margins
> > are the same.
> >
> > I did some digging and it appears that KMM 5.2 uses qtextdocument.
> > https://doc.qt.io/qt-6/qtextdocument.html#documentMargin-prop
> > From what I can tell the default margin is set to 2cm which is
> > about what I'm getting. Also, by default a page number is printed
> > at the bottom, which I am also seeing. Assuming I'm on the right
> > track, how do I set the margins to 1mm and get rid of the page
> > number?
>
> My best guess is that the page number is inserted by CUPS or the
> printing system itself, not by KMM or KDE. You should be able to
> adjust/fix that somewhere in the print dialog where you tried to
> decrease the margin.
>
> I suspect (but am not certain) that margin property can be set in
> css, but if it's not already in the css file used by KMM, then I
> would have to research or experiment with the right syntax.
>
To follow up. I determined the page numbers were not added by CUPS, but
by QtextDocument which is the default. Also, by default QtextDocument
sets the margins to 20mm all around. By adding a few lines like this in
the checkprinting.cpp plugin file the problem is resolved:
QSizeF ltr(612,792);
htmlPart->setPageSize(ltr); //set page to US letter size
htmlPart->setDocumentMargin(10);
This reduces the margins and gives plenty of room to properly print a
check. Setting the PageSize gets rid of the auto page numbering that
QtextDocument defaults to.
Can you let me know what I need to do to ask that these changes or
similar get in the plugin?
thanks
More information about the KMyMoney
mailing list