I have tried 2 different methods and am stuck and could use some help. In a Microflow I have an html string. I tried using the CommunityCommons.StringToFile Java Method and it does create a file and the file does have size; however, when I use the Microflow action to download the file I get an error “Failed to load PDF document.” For input on the StringToFile action I selected my html string variable. For Destination I chose the new Document I had created in a step before. It’s a custom entity that uses System.FileDocument as the generalization. The second method I used was to create a document template and put a single dynamic label on it. I then mapped it to the field where I store the html string; however, when viewing the document I see all of the html, it did not actually render the html. I see all of the markup. I need to be able to take an HTML string and create a document, preferably a pdf document.
The second method should work. On the dynamic label, did you have this property set:
If so, you may need to sanitize the html source using the Sanitize Java action from Community Commons. Also, if its a full HTML document (i.e. starts with an <html> tag), you may need to remove the html tag to get it working.
Hope that helps,
Aren’t you able to parse the HTML into a different Mendix objects and create a PDF based on PDF template?