更新时间:2021-11-05 22:30:58
当我在github上找到此pull请求时,我遇到了类似的挑战并解决了它: https://github.com/ArthurHub/HTML-Renderer/pull/41
I had a similar challenge and resolved it as I found this pull request on github: https://github.com/ArthurHub/HTML-Renderer/pull/41
您可以设置custom-css-property
You can set the custom-css-property
td { page-break-inside: avoid; }
在您要控制分页符的所有元素或选择器(td,p,.my-class等)上
on all elements or selectors you want (td, p, .my-class, etc.) to control the page breaking.
如果希望库控制某些元素的分页,则可以使用值"auto"
You can use the value "auto" if you want the library to control your page breaking on certain elements
td { page-break-inside: auto; }
还有一个在运行的文本中分页的示例.
There is also a example for page breaking in running text.