Anyone else having horizontal font compression & size issues? (0.12.4)

171 views
Skip to first unread message

Vern Jensen

unread,
Nov 20, 2017, 7:15:19 PM11/20/17
to wkhtmltopdf General
I have been having issues where the font is compressed horizontally, such that letters run into each other. Is anyone else having this? Example output attached.

Notice in the upper-right how "Mike Johnson" has the "Mi" squished into each other.

You can see similar cases throughout... such as "Myocardial" has the M and y running together, or "Nuclear" has the N and u running together.

ALL letters are compressed, but it's just most clearly obvious in these cases.

I have tried various css options to expand the font spacing, but these options are ignored by wkhtmltopdf.

I've tried a variety of different fonts (Helvetica, Arial, Georgia, Sans Unicode, Tahoma) and the same issue affects them all.

Anyone else having this issue?




My settings:

wkhtmltopdf_set_global_setting(gs, "margin.top", "57mm"); 
wkhtmltopdf_set_global_setting(gs, "margin.bottom", "25mm");
wkhtmltopdf_set_global_setting(gs, "margin.left", "8mm");
wkhtmltopdf_set_global_setting(gs, "margin.right", "8mm");

wkhtmltopdf_set_global_setting(gs, "dpi", "96");
wkhtmltopdf_set_global_setting(gs, "size.pageSize", "A4");

os = wkhtmltopdf_create_object_settings();

wkhtmltopdf_set_object_setting(os, "page", bodyHTMLFilePath.toUtf8().constData()); // wkhtmltopdf currently requires a file as input, not a string :-/
wkhtmltopdf_set_object_setting(os, "load.zoomFactor", "1.0"); //1.375");
wkhtmltopdf_set_object_setting(os, "web.printMediaType", "true"); // Make use of CSS that distinguishes between 'print' and 'screen' CSS
wkhtmltopdf_set_object_setting(os, "web.enableIntelligentShrinking", "false"); // We do NOT want intelligent shrinking!!!

wkhtmltopdf_set_object_setting(os, "footer.left", (QString("Electronically signed: ") + signDateTimeStr).toUtf8().constData() );
wkhtmltopdf_set_object_setting(os, "footer.right", "Page [page] of [topage]");
wkhtmltopdf_set_object_setting(os, "footer.spacing", "1.0");
wkhtmltopdf_set_object_setting(os, "footer.fontSize", "8"); // Seems to have no effect

wkhtmltopdf_set_object_setting(os, "header.spacing", "3.0");
wkhtmltopdf_set_object_setting(os, "header.htmlUrl", headerHTMLFilePath.toUtf8().constData());

Note that I do have this in my css:

@media print {
body, body.header *, body.body * {
font-size: 9pt;
}
}

to make 12-pt font on the screen print out at the expected size on paper. Not sure why this is necessary, but without this it prints out way too large.


compressedFont.png

ed...@replay-sdk.com

unread,
Nov 24, 2017, 10:18:09 AM11/24/17
to wkhtmltopdf General
I had the same issue (on Windows).
After reading dozen of bug reports on wkhtmltopdf, nothing worked, except increasing the dpi parameter to 300 (96 WAS NOT ENOUGH!). I had to resize slightly the fonts (using CSS), but this did the trick.

Hope this helps,

Regards,

E.
Reply all
Reply to author
Forward
0 new messages