【问题标题】:Table row is getting cut while using wkhtmltopdf node module converting to pdf使用 wkhtmltopdf 节点模块转换为 pdf 时,表格行被剪切
【发布时间】:2020-02-02 10:09:38
【问题描述】:

在将 HTML 转换为 PDF 时面临的问题是可以使用将近 3-4 页的表格数据。它被削减和扭曲。

我尝试了大部分与 wkhtmltopdf stackoverflow 线程相关的解决方案。

table, tr, td, th, tbody, thead, tfoot {
    page-break-inside: avoid !important;
}

这对我没有帮助

有什么帮助吗?

【问题讨论】:

  • 打破表格行的目标是什么?好像你的css错了,你指定不要在任何地方破坏页面。
  • 你试过简单的tr {page-break-inside: avoid; }吗?还要确保你使用latest wkhtmltopdf library
  • 我试过这个也没有用@skobaljic
  • 它被削减了一半。我必须解决这个问题。
  • 是的...似乎他们还没有解决它,检查thisthat...也许最好在打印/转换之前划分你的表?

标签: html css node.js wkhtmltopdf wkhtmltopdf-binary


【解决方案1】:

将 wkhtmltopdf 升级到 0.12.5 版并修补 qt 解决了我的问题。

Script to install wkhtmltopdf 0.12.5 with qt patched on ubuntu

如果您遇到任何与缩放和额外空白相关的问题,请尝试在 wkhtmltopdf npm package

--zoom  value between 0.0 to 1.0

--disable-smart-shrinking 

与 github 相关的问题: Regression on upgrade from 0.12.3 to 0.12.5

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多