Created
April 22, 2013 09:10
-
-
Save Se7soz/5433444 to your computer and use it in GitHub Desktop.
IText renderer code
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
private void convertHtmlToPdf(File inputFile, File outputFile) throws IOException, FileNotFoundException, DocumentException { | |
String path = inputFile.toURI().toURL().toString(); | |
ITextRenderer renderer = new ITextRenderer(); | |
ITextFontResolver fr = renderer.getFontResolver(); | |
fr.addFont(properties.getProperty("itext.fonts.lucidaFontPath"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); | |
renderer.setDocument(path); | |
renderer.layout(); | |
OutputStream os = new FileOutputStream(outputFile); | |
renderer.createPDF(os); | |
os.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment