Hi,
I used to render html to png in aspose.HTML 18.11 as follows:
java.io.InputStream content = ...;
// load the document to be rendered
html = new HTMLDocument( content, "" );
// Create output stream
ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
// render to image
HtmlRenderer renderer = new HtmlRenderer();
ImageRenderingOptions imageRenderingOptions = new ImageRenderingOptions( getAsposeHtmlImageRenderingFormat( previewFormat ) );
// Set resolution ...
ImageDevice imageDevice = new ImageDevice( imageRenderingOptions, imageStream );
renderer.render( imageDevice, html );
Since version 19.3 the following constructor is missing:
public ImageDevice(ImageRenderingOptions options, java.io.OutputStream outputStream)
It seems to be replaced with the following:
public ImageDevice(ImageRenderingOptions options, com.aspose.html.internal.ms.System.IO.Stream stream)
My questions are:
-
Is there still a way to render html to png using OutputStream in version 19.3 / 19.5? I would like to avoid saving to disk first.
-
What is the prefered way to render html to png? Searching the forum I stumbled upon this: HTML to Image Conversion Although Aspose.HTML for Java is auto-ported version of Aspose.HTML for .NET I don’t see how to use this approach in Java.
Regards,
Michae