I tried to generate a PDF-file from a HTML/CSS-document by using the api of pdflayer.com. So far so good. everything worked fine. But there is one issue. If there is a page break, a line sometimes gets split like in the photo:
is there a way to get rid of this issue? I also tried html2pdfrocket.com it is the same there.
The text is placed within this html-construct:
<html>
<body>
<div class="overall">
<div class="content">
<div class="wrapper">
<div class="article">
Text
I found out that there exists a problem with compiling the content inside of multiple divs. CSS-rules did not affect the behaviour of the issue.
So I had an idea and what I made was to generate a "raw-html-output". In this html document is only
<html>
<head>
<style>
The only necessary css-rules.
</style>
</head>
<body>
Some text here.
</body>
</html>
Nothing more.
The API grabs the data from the simplyfied html-file and compiles them well.
i think the best solution would to prevent a break inside a paragraph on print. Something like this:
@media print and (min-width:700px) {
/* you can change the selector to whatever you need */
.article {
break-inside: avoid;
page-break-inside: avoid;
}
}
If you use firefox, open the html doc with it and install the add-on named PDF Mage. Just click the icon to convert the page to PDF. It always works for me without any problems.
Viele Grüße
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With