Load existing html from ByteArray


#1

Hi,
we plan to store our mails as pdf files in our dms. Therefore we want to save the mails as mhtml with aspose-email in a bytearrayoutputstream and load the stream with aspose-html to extend header information and export it as pdf. Is there a possibility to load html from a bytearray (stream) within java?
Kind regards, Josef


#2

@dvtdaten

Thank you for contacting support.

We would like to share with you that Aspose.HTML API does not support loading an HTML document from ByteArray, at the moment. Therefore, a ticket with ID HTMLJAVA-118 has been logged 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.

In the meantime, you may use Aspose.PDF for Java API to meet your requirements, as in the code snippet below:

ByteArrayOutputStream baos = new ByteArrayOutputStream();
// Write data to OutputStream instance

baos.flush();     
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
MhtLoadOptions options = new MhtLoadOptions();
Document document = new Document(bais, options);
document.save(dataDir + "MHT2PDF.pdf" , SaveFormat.Pdf);

We hope this will be helpful. Please feel free to contact us if you encounter any problem.


#3

Hi,
thank you for your suggestion. We need to load and manipulate mhml before converting it to pdf. Therefore we check aspose-words and aspose-html.
Kind regards, Josef


#4

@dvtdaten

We are afraid Aspose.PDF does not support manipulating MHTML files. Therefore, you may create a post over Aspose.Words forum to check for such a feature until the logged ticket, HTMLJAVA-118, is investigated in our environment.