开发者

Rendering Java Graphics to HTML

I have a Swing Graphics2D object which I would like to render to HT开发者_运维百科ML/JS/CSS. Is there a library or other way to do this?

I'm thinking of something similar to iText for exporting Java to PDF, but for exporting to HTML.

Thanks in advance!


You can save it as a image (i.e. jpg) and then show this image with a simple <img /> tag.


If your graphics rendering is primarily paths and lines and polygons and circles, this should translate easily to SVG (but I don't know of a library). Otherwise a bitmap is your safest bet (PNG should beat JPG for quality and filesize for rendered graphics).


edit: I haven't used it personally, but Apache Batik has a subclass of Graphics2D which can be used to generate SVG files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜