Search code examples
htmlitextitext7converters

iText7 - How add a page separator when using HtmlConverter


I try to figure out how to add a page separator when trying to convert a HTML document into a PDF.

String htmlContent = "<html><body><div id=\"p1\">Page 1 content</div> ???end_of_page??? <div id=\"p2\">Page 2 content</div>"
try {
    HtmlConverter.convertToPdf(htmlContent,
            new FileOutputStream(new File(DEST)));
} catch(Exception e) {
    e.printStackTrace(System.err);
}


Solution

  • I answer myself. Just add the attribute style="page-break-after: always;" in the first page tag.