Created
May 29, 2012 13:38
-
-
Save ogavrisevs/2828423 to your computer and use it in GitHub Desktop.
Create pdf using iText from html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
com.lowagie.text.Document document = new com.lowagie.text.Document(); | |
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); | |
PdfWriter.getInstance(document, outputStream); | |
HtmlWriter.getInstance(document, System.out); | |
document.open(); | |
List<Element> objects = HTMLWorker.parseToList(reader, null, null); | |
for (Element element : objects) { | |
document.add(element); | |
} | |
document.close(); | |
document.open(); | |
HTMLWorker htmlWorker = new HTMLWorker(document); | |
document.close(); | |
htmlWorker.parse(reader); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment