Created
June 7, 2012 07:06
-
-
Save ogavrisevs/2887071 to your computer and use it in GitHub Desktop.
Create pdf using pd4ml from html (html table is unsuported )
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
ByteArrayInputStream inputStream = new ByteArrayInputStream(htmlData); | |
InputStreamReader inputStreamReader = new InputStreamReader(inputStream); | |
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); | |
PD4ML pd4ml = new PD4ML(); | |
pd4ml.enableDebugInfo(); | |
try { | |
pd4ml.setPageSize( PD4Constants.A4 ); | |
pd4ml.setPageInsetsMM( new Insets(topValue, leftValue, bottomValue, rightValue) ); | |
pd4ml.useTTF("path/registration/report", true); | |
pd4ml.setHtmlWidth(userSpaceWidth); | |
pd4ml.render( inputStreamReader, outputStream ); | |
}catch (Exception e ){ | |
e.printStackTrace(); | |
} | |
return outputStream.toByteArray(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment