I have wriiten some code ., that convert html code to Image "png" file.
I am not getting the full content in the image file what could be the problem.
I am stuck with this.
Code Snippets:
HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
HTMLDocument htmlDocument = (HTMLDocument) htmlEditorKit
.createDefaultDocument();
JEditorPane editor = new JEditorPane();
editor.setEditable(false);
editor.setEditorKit(htmlEditorKit);
editor.setText(templateString);
// Write to file
Dimension prefSize = editor.getPreferredSize();
BufferedImage img = new BufferedImage(prefSize.width, editor
.getPreferredSize().height, BufferedImage.TYPE_INT_ARGB);
Graphics graphics = img.getGraphics();
editor.setSize(prefSize);
editor.paint(graphics);
ImageIO.write(img, "png", file);