Print to PDF Issues

When printing a document the preview looks fine, but the PDF generated by wkhtmltopdf has serveral issues:

Font Family
Is set to Helvetica in print settings, but in PDF its DejaVuSans

Font Size
Is set to 9 in print settings, but in PDF its 11

Page Margins
Are roughly double the value they should be (10mm in css is 19.7mm in pdf, 5mm is 9.64mm)
Print Format CSS:

.print-format {
    padding: 0mm;
    margin-left: 10mm;
    margin-right: 5mm;
}

This seems to be a core problem as the same issues can be observed with the default standard print format in our test-instance on frappe cloud, which is completely stock.

ERPNext: v13.19.0 (version-13)
Frappe Framework: v13.19.0 (version-13)
Ubuntu 20.04.03-LTS
wkhtmltopdf 0.12.5 (with patched qt)

Pictures:



@philippm try to put it inside @media print .

@media print {
.print-format {
padding: 0mm;
margin-left: 10mm;
margin-right: 5mm;
}
}

also try to use !important

1 Like

Thanks for the help, unfortunately this has no effect. I abandoned the print format builder and Iā€™m using custom format now.

The margins and font-size are now working, but I am getting nowhere with the font-family issue. I installed Helvetica on the server and it is showing up in fc-list, but wkhtmltopdf is still defaulting to DejaVuSans.

We updated to wkhtmltopdf 0.12.6 and it solved some of the font issues we were having. Worth a try!

1 Like