Hi everyone,
I have a bit of a problem converting a JTextPane to an image.
I am able to convert the JTextPane to a PNG image but its quality is really bad. Is there a way that i can convert my JTextPane to a high quality image.
The type of image format does not matter
Here is what i have so far
I hope someone can help with this problemCode:public void export(JComponent Component) { File f1 = new File("C:\\Temp.PNG"); Dimension Size5 = Component.getSize(); BufferedImage Image1 = new BufferedImage(Size5.width, Size5.height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = Image1.createGraphics(); g2.setRenderingHint (RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC); Component.paint(g2); try { ImageIO.write(Image1, "PNG", f1); } catch (Exception e) { e.printStackTrace(); } }
Any help is greatly appreciated
Thank You
Yours Sincerely
Richard West


Reply With Quote


Bookmarks