将 HTML 转换为 PDF 时面临的问题是可以使用将近 3-4 页的表格数据。它被削减和扭曲。
我尝试了大多数与 wkhtmltopdf stackoverflow 线程相关的解决方案。
table, tr, td, th, tbody, thead, tfoot {
page-break-inside: avoid !important;
}
这对我没有帮助
这有什么帮助吗?
使用 qt 补丁将 wkhtmltopdf 升级到 0.12.5 版解决了我的问题。
在 ubuntu 上使用 qt 补丁安装 wkhtmltopdf 0.12.5 的脚本
如果您遇到与缩放和额外空白相关的任何问题,请尝试在 wkhtmltopdf npm 包中添加这些选项
--zoom value between 0.0 to 1.0
--disable-smart-shrinking
与 github 相关的问题: 从 0.12.3 升级到 0.12.5 时的回归