10 | itext 7.1.9 11 | converting HTML to PDF 12 |
13 |Title | 17 |iText - Java HTML to PDF | 18 |
---|---|
URL | 21 |http://hmkcode.com/itext-html-to-pdf-using-java | 22 |
This was created using iText
" 14 | + "hmkcode.com"; 15 | 16 | 17 | public static void main( String[] args ) throws FileNotFoundException, IOException 18 | { 19 | 20 | // String to PDF 21 | HtmlConverter.convertToPdf(HTML, new FileOutputStream("string-to-pdf.pdf")); 22 | 23 | 24 | // HTML file to PDF 25 | HtmlConverter.convertToPdf(new FileInputStream("index.html"), 26 | new FileOutputStream("index-to-pdf.pdf")); 27 | 28 | 29 | System.out.println( "PDF Created!" ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /itext-java-html-pdf/style.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color:#ccc; 3 | } 4 | table tr td{ 5 | text-align:center; 6 | border:1px solid gray; 7 | padding:4px; 8 | } 9 | table tr th{ 10 | background-color:#84C7FD; 11 | color:#fff; 12 | width: 100px; 13 | } 14 | .itext{ 15 | color:#84C7FD; 16 | font-weight:bold; 17 | } 18 | .description{ 19 | color:gray; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /itext-java-pdf-table/.classpath: -------------------------------------------------------------------------------- 1 | 2 |