Meaningless Drivel is fun!
The moose likes Swing / AWT / SWT and the fly likes JTextPane to BufferedImage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextPane to BufferedImage" Watch "JTextPane to BufferedImage" New topic

JTextPane to BufferedImage

Martin Arrech

Joined: Jan 17, 2012
Posts: 1
Hi everyone.
I'm maintaining a code of an application that prints stuff, like photos, text, in a pdf ready to get printed.
Now i have an annoying bug, the application converts text from a textpanel into a BufferedImage and save it to disk, but this image don't really represents what i see on screen.
Here's the code, I know it's a shame, but this code is not mine, I'm just maintaining it and fixing bugs

And then saves that image to disk

this is what i see on the app

this is what i get on image file (thumbnails don't work for png so, click on the image please)

in the second image, the text is cropped at right edge, very weird

Hope you can help me, before i get bald.
Sorry for my english
I agree. Here's the link:
subject: JTextPane to BufferedImage
jQuery in Action, 3rd edition