Reputation: 1870
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
Upvotes: 8
Views: 10568
Reputation: 191
I had this problem. PDF converter has a problem with flex and grid system. If it possible try to use tables instead of col and row
Upvotes: 0
Reputation: 11
You can try converting your HTML to PDF using the Syncfusion online demo. We are handling text and image split across the pages.
Note: I work for Syncfusion.
Upvotes: 0
Reputation: 1870
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.
Upvotes: 4
Reputation: 716
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;
}
}
Upvotes: 2
Reputation: 167
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
Upvotes: 1