Reputation: 3472
I am not sure how to overcome this problem even though I have set the page size to be A4, I would assume that my page size would remain intact and my content would be wrapped correctly?
note I am using the wrapper WkHtmlToXSharp to create my pdf
Issue: If you enter strings that are not split, i.e. one long string - what I have showed in the image above will occur. How do I fix this? Is there some options for WkhtmlToPDF to wrap the text?
Upvotes: 5
Views: 4086
Reputation: 384
This is the css I'm using in gimli (https://github.com/walle/gimli) to fix this issue.
https://github.com/walle/gimli/commit/39981dda4de003902748c3e089aa42da809af6a9#L0R145
Upvotes: 2
Reputation: 13402
If you want a CSS solution, you could try setting a width for the element that overflows and then testing with word-wrap: break-word;
, overflow:hidden;
and white-space: nowrap
to control the issue, some of these or a combination might work for you. As for a wkhtmltopdf solution that would be universal... If you find any, I want one too!
Upvotes: 1
Reputation: 5326
You need to break the pages. It's easy as adding this:
<div style='page-break-after:always'></div>
For example, if you have a long table, you can do like this pseudo-code:
if ($row > 100) {
echo "</table>";
echo "<div style='page-break-after:always'></div>";
echo "<table>"; }
Upvotes: 0