我尝试使用 pdflayer.com 的 api 从 HTML/CSS 文档生成 PDF 文件。到目前为止,一切都很好。一切正常。但是有一个问题。如果有分页符,一行有时会像照片中那样被拆分:
有没有办法解决这个问题?我也试过 html2pdfrocket.com 那里是一样的。
文本放置在这个 html 结构中:
<html>
<body>
<div class="overall">
<div class="content">
<div class="wrapper">
<div class="article">
Text
最佳答案
我发现编译多个 div 中的内容存在问题。 CSS 规则不影响问题的行为。
所以我有了一个想法,我所做的就是生成一个“raw-html-output”。在这个html文件中只有
<html>
<head>
<style>
The only necessary css-rules.
</style>
</head>
<body>
Some text here.
</body>
</html>
仅此而已。
API 从简单化的 html 文件中获取数据并很好地编译它们。
关于html - 将 html 转换为 pdf - 分页符拆分文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54308275/