Created
August 2, 2012 05:18
-
-
Save sreeprasad/3233907 to your computer and use it in GitHub Desktop.
Convert html to pdf using iText and Flying Saucer.
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
String inputFile = "~/github/iText/myhtml.xhtml"; | |
String url = new File(inputFile).toURI().toURL().toString(); | |
String outputFile = "~/github/iText/generated.pdf"; | |
OutputStream os = new FileOutputStream(outputFile); | |
ITextRenderer renderer = new ITextRenderer(); | |
renderer.setDocument(url); | |
renderer.layout(); | |
renderer.createPDF(os); | |
os.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment