wooio / htmltopdf-java

An HTML to PDF conversion library written in Java, based on wkhtmltopdf.
MIT License
172 stars 97 forks source link

Blank pages always appear at the end. #45

Closed l0pest closed 4 years ago

l0pest commented 4 years ago

Converting the URL to PDF creates a blank page on the last page. How do I prevent a blank page from being added?

boolean success = HtmlToPdf.create() .pageSize(PdfPageSize.A4) .object(HtmlToPdfObject.forUrl(url)) .convert(pathPC);

l0pest commented 4 years ago

Sorry. I found a solution. There were no problems from the beginning. My HTML document was the problem. The last blank page was solved in the following way. <c:choose> <c:when test="${loop.index == totalPageSize }"> <div style="page-break-after:auto;">page ${loop.index } / ${totalPageSize}</div> </c:when> <c:otherwise> <div style="page-break-after:always;">page ${loop.index } / ${totalPageSize}</div> </c:otherwise> </c:choose>