• Post Reply Bookmark Topic Watch Topic
  • New Topic

Html to jpg

 
Rashmee H S
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys
Anyone know Converting Web pages to images using Java.

[ August 01, 2008: Message edited by: Rashmee H S ]
[ August 01, 2008: Message edited by: Rashmee H S ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what this has to do with EJB and Other Java EE technologies.

What is a n HTML request? Do you mean you want to create an image of a web page?
 
Alaa Nassef
Ranch Hand
Posts: 471
Hibernate Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that you want to convert an HTML webpage to a JPEG file. If this is so, there are a couple of ways I know of to do so. The first one is the direct method, where you directly do the conversion using some swing classes, including JEditorPane. Your HTML code must be simple, since JEditorPane cannot render too complex pages. You can view two samples for the code to do this here (go to the end of the page if you are not a member) and here (requires registration).

The second method is an indirect one, but would be useful with complex pages, and if you don't want to use swing components. You can simply convert your HTML page to PDF using iText then convert this PDF to JPEG files using Adobe's java APIs, like in the following example. Of course in this solution you have to have Adobe's LiveCycle, which is proprietary. You can instead use ImageMagick instead.
[ July 30, 2008: Message edited by: Alaa Nassef ]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This was also discussed here: http://www.coderanch.com/t/345582/GUI/java/rendering-html-image
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!