Created
May 29, 2012 13:41
-
-
Save ogavrisevs/2828437 to your computer and use it in GitHub Desktop.
Create pdf using iText 2.08 + ITextRenderer (R8 or R8pre) from html with styles
This file contains 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
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); | |
docBuilderFactory.setNamespaceAware(false); | |
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); | |
org.w3c.dom.Document doc = docBuilder.parse(stream); | |
ITextRenderer renderer = new ITextRenderer(); | |
renderer.setDocument(doc, null); | |
renderer.layout(); | |
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); | |
renderer.createPDF(outputStream); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment