WKHTMLTOPDF - 允许在表格行中分页 [英] WKHTMLTOPDF - Allow page break in table row

查看:128
本文介绍了WKHTMLTOPDF - 允许在表格行中分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 Ubuntu 服务器上运行 wkhtmltopdf 0.12.2.1(带有补丁的 qt),我可以很好地生成 PDF.我一直在使用 wkhtmltopdf 生成一个包含多列的表格,有时其中一列有很多文本.

I'm running wkhtmltopdf 0.12.2.1 (with patched qt) on my Ubuntu server and I can generate PDFs just fine. I've been using wkhtmltopdf to generate a table with several columns and sometimes one of those columns has a LOT of text.

我的问题是:我希望我的表格行能够跨越多个页面而不会在行之前/之后留下空白.WKHTMLTOPDF 为我做了一些这样的工作,但如果行有很多文本,它通常会在行前留下不需要的空白,因为 wkthmltopdf 试图将整行保留在一页上.

My problem is this: I want my table rows to be able to span multiple pages without leaving white space before/after the row. WKHTMLTOPDF does some of this work for me, but it often leaves unwanted white space before the row if the row has lots of text because wkthmltopdf tries to keep the entire row on one page.

例如,当 wkh​​tmltopdf 遇到仅占该行约 3/4 页面的行时,该页面可能已占表格的一半.Wkthmltopdf 当前将第一页的下半部分留空,并在下一页开始真正的长行.我希望发生的是 wkhtmltopdf 在第一页上开始真正的长行,然后在下一页上结束长行.

For example, the page might be half way full of the table when wkhtmltopdf encounters a row that would take up about 3/4 of the page for just that one row. Wkthmltopdf currently leaves the bottom half of the first page empty and starts the really long row on the next page. What I'd like to have happen is that that wkhtmltopdf starts the really long row on the first page, and then finishes the long row on the next page.

我该怎么做?

我考虑过使用 div 和 span,但我需要表格边框仍然显示出来,所以使用表格似乎是最好的选择.有什么建议吗?

I've thought about using divs and spans, but I need the table borders to still show up, so it seems like using a table is the best option. Any advice?

推荐答案

在对这个问题进行一些思考之后,似乎最好的做法是将报告的格式更改为使用 divs 和 spans 而不是使用一张桌子.我已经这样做了,现在似乎一切正常.

After some thinking on this issue, it seems like the best thing to do would be to just change the format of the report to use divs and spans rather than use a table. I've gone ahead and done that and everything seems to work now.

这篇关于WKHTMLTOPDF - 允许在表格行中分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆