如何将内存中的 HTML 代码渲染为图像?
我发现 http://code.google.com/p/flying-saucer/
这应该是最适合我的项目的解决方案。但这些文档似乎只能从文件中读取。
但就我而言,我想从代码中渲染,并且不想保存临时 XML 文件。例如 Graphics2DRenderer
中的 renderToImageAutoSize
静态java.awt.image.BufferedImage renderToImageAutoSize(java.lang.String url, int 宽度, int 缓冲图像类型) 一种静态实用方法,用于自动从文档创建图像,其中高度根据文档内容确定。
有没有办法让渲染器直接从内存中读取HTML代码?
I found http://code.google.com/p/flying-saucer/
which should be the most suitable solution for my project. But the documents only seem to be able to read from file.
But I my case I want to render from code and I don't want to save a temporary XML file. For example renderToImageAutoSize
in Graphics2DRenderer
static java.awt.image.BufferedImage
renderToImageAutoSize(java.lang.String url, int width, int
bufferedImageType)
A static utility method to automatically create an image from a document, where height is determined based on document content.
Is there any way to let the renderer read directly from HTML code in memory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Graphics2DRenderer
不是实用程序类。您应该创建它的一个新实例。请参阅http://today.java.net/pub/a/today/2006/10/31/combine-facelets-and-flying-saucer-renderer.html#xhtml-to-image-conversion< /a>
Graphics2DRenderer
is not a utility class. You should create a new instance of it.See http://today.java.net/pub/a/today/2006/10/31/combine-facelets-and-flying-saucer-renderer.html#xhtml-to-image-conversion