简体   繁体   中英

NReco PdfGenerator character or letter spacing

I am using Nreco PdfGenerator to generate pdf from HTML. Everything is fine but characters are so close to each other and it is not easy to read.

Is there any way to fix this issue?

HTML version 在此处输入图片说明

PDF version 在此处输入图片说明

This is my CSS

<style type="text/css" media="screen">
    body { line-height: 18px; font-family: Arial, sans-serif; font-size: 12px; background: #fff; text-rendering: optimizeSpeed; }
    .topButton { width: 880px; margin: 0 auto; padding: 10px; background: #fff; border-bottom: 2px solid #007182; }
    .mainTable { width: 880px; margin: 0 auto; padding: 10px; background: #fff; /*border: 1px solid red;*/ }
    .just { text-align: justify; }
    .detailItinerary { width: 100%; border: 10px solid red; }
    .dailyTitle { color: #4C9897; margin-top: 10px; display: block; font-size: 12px; }
    .serviceRowsWithBorder { width: 100%; border-bottom: 1px solid #007182; padding: 10px 0; }
    .serviceRowsWithoutBorder { width: 100%; padding: 10px 0; }
    .topLink { text-decoration: none; color: #C74E1B; }
</style>
<style media="print">
    .topButton { display: none; }
    @page { size: auto; margin: 7mm; }
    body { background: #fff; margin: 0; font-family: Arial, sans-serif; font-size: 12px; text-rendering: optimizeSpeed; }
    .mainTable { width: 100%; margin: 0 auto; padding: 10px; background: #fff; /*border: 1px solid red;*/ }
    .just { text-align: justify; }
    .dailyTitle { color: #4C9897; margin-top: 10px; display: block; font-size: 12px; }
    .serviceRowsWithBorder { width: 100%; border-bottom: 1px solid #007182; padding: 10px 0; }
    .serviceRowsWithoutBorder { width: 100%; padding: 10px 0; }
</style>

Setting the 'CustomWkHtmlArgs' property with the "--dpi 300" option fixed this problem for me, eg

return new HtmlToPdfConverter
{
    Orientation = PageOrientation.Portrait,
    PageHeaderHtml = "<br/>",
    PageFooterHtml = "<div style=\"font-family: Arial;\">Page: <span class=\"page\"></span> of <span class=\"topage\"></span></div>",
    CustomWkHtmlArgs = "--dpi 300",
};

This is very vaguely explained on the NReco PDF website , but without it actually explaining how to set the property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM