I have downloaded the evaluation version of Aspose.Html for java to see whether it’s suitable.
The online example only shows how to save a pdf on the file system, but i want to write the pdf to a javax.servlet.ServletOutputStream. Is it possible?
Here’s the code snippet:
HTMLDocument html = new HTMLDocument(is, "");
HtmlRenderer renderer = new HtmlRenderer();
renderer.render(new PdfDevice(new PdfRenderingOptions(), "newdoc.pdf"), html);
PdfDevice constructor only accepts:
A. file name
B. com.aspose.html.internal.ms.System.IO.Stream
C. com.aspose.html.io.ICreateStreamProvider
but it’s not clear how write the pdf to a java OutputStream or a ServletOutputStream using option B or C.
We have logged a ticket with ID HTMLJAVA-139 in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.
We are afraid that logged ticket is pending for investigations at the moment, owing to previously logged tickets. We will update you as soon as some significant progress will be made. We appreciate your patience and comprehension in this regard.
We would like to update you that the issue HTMLJAVA-139 has been resolved and the constructor PdfDevice(java.io.OutputStream stream) will be supported in the upcoming release. However, you can use a workaround approach for now, as in the lines of code below:
java.io.OutputStream fos = new FileOutputStream("newdoc.pdf");
OutputStreamAdapter outputStreamAdapter = new OutputStreamAdapter(fos);
renderer.render(new PdfDevice(new PdfRenderingOptions(), outputStreamAdapter), html);
We have opened the following new ticket(s) in our internal issue tracking system to investigate this issue. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.