【问题标题】:NReco PdfGenerator character or letter spacingNReco PdfGenerator 字符或字母间距
【发布时间】:2016-09-13 06:56:12
【问题描述】:

我正在使用 Nreco PdfGenerator 从 HTML 生成 pdf。一切都很好,但是字符之间的距离太近了,不容易阅读。

有没有办法解决这个问题?

HTML 版本

PDF 版本

这是我的 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>

【问题讨论】:

  • Essential PDF 可以将 HTML 转换为 PDF - 您可以尝试一下,看看问题是否已解决。 community license 对年收入低于 100 万美元的公司免费。
  • 找到解决方案了吗? (这不涉及更改您的库!)

标签: css pdf pdf-generation letter-spacing


【解决方案1】:

使用“--dpi 300”选项设置“CustomWkHtmlArgs”属性为我解决了这个问题,例如

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 website 上的解释非常模糊,但实际上并没有解释如何设置属性。

【讨论】:

    猜你喜欢
    • 2015-11-18
    • 1970-01-01
    • 2018-04-10
    • 2017-04-09
    • 2012-07-26
    • 1970-01-01
    • 2012-09-13
    • 1970-01-01
    • 2012-10-25
    相关资源
    最近更新 更多