How can I read an HTML file from InputStream and how to convert the HTML to String?

0
Hi, In my application, I am uploading a HTML file through FileManager. Now I want to convert this HTML file into PDF. For that I am writing a JavaAction. In that, I don't know how to read the HTML file into InputStream and how to convert that content of HTML file into String. How can I do this? Please help me with your valuable suggestion. I need the syntax of HTML file reader and convertion of that to string. I hope I am clear from my end. If not please let me know.  Thanks, Venkat.
asked
2 answers
2

Hi Venkat,

Depending on your use case you might not need an additional java action. Take a look at the popular Community Commons module which contains a StringFromFile action, as well as many other useful file utilities. At the very least it should help you on your quest to get the InputStream from a a file.

Or try:

Core.getFileDocumentContent(getContext(), this.<fileDocumentObject>)

fileDocumentObject must implement system.FileDocument.  

answered
2

You can do this with native Mendix. Get the html from the filedocemt with StringFromFile. Put the result in an attribute. Create a simple documenttemplate with one attribute of type XHTML. Create the document.

answered