NReco PdfGenerator 字符或字母间距。

问题描述 投票:3回答:1

我正在使用Nreco PdfGenerator从HTML中生成pdf。一切都很好,但字符是如此接近,它是不容易阅读。

有什么办法可以解决这个问题吗?

HTML版本enter image description here

PDF版enter image description here

这是我的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>
css pdf pdf-generation letter-spacing
1个回答
1
投票

用"--dpi 300 "选项设置'CustomWkHtmlArgs'属性,为我解决了这个问题,比如:"--dpi 300"。

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",
};

这个问题在 NReco PDF网站但它并没有实际解释如何设置该属性。

© www.soinside.com 2019 - 2024. All rights reserved.