Java Magazine, July/August 2018
ORACLE COM JAVAMAGAZINE JULY AUGUST 2018 25 libraries tr If you take a closer look at the HTML code youll notice that the header is in a thead section to make sure it will be repeated on every page The 50 data rows are inside the tbody section The code to convert this HTML file to PDF is very simple it consists of the single line shown in Listing 5 Listing 5 public void createPdf String html String dest throws IOException HtmlConverter convertToPdf new File html new File dest Figure 5 shows the result after executing the createPdf method It looks exactly like the HTML that was rendered and then shown in Figure 4 but now there are also page numbers Figure 5 HTML rendered to PDF with iText and pdfHTML
You must have JavaScript enabled to view digital editions.