Error handling on pdf creation

1
Anybody found a workaround on how to handle errors when creating PDF's?. For some strange reason you can not set an error handlers on this activity. That is nice if Mendix would handle the exceptions that could occur when the document is created. But alas this does not seem to be the case. Cause of the problem is users copying and pasting text from word or other sources. We see that sometimes strange code comes along in the text that is not visible to the user, but breaks the generating of a PDF where we want to show this text. I know the community commons has some functionality to strip HTML for instance but I have not found a one for all java action. It even gets more complicated if the PDF needs to have styling and you want to use the XHTML rendering option from the PDF generation. If the XHTML is not right you get the famous red error. And because error handling is not possible this results in a not so user friendly sollution. I feel that the platform should handle this more elegant. It would be so nice if I only would have to choose between plain text or HTML text and that the platform would check if the text is compliant or not and tell the user which part of the text is wrong. I know that the idear forum has a template improvement suggestion high in the list. I hope this problem will be incorporated if Mendix decides to upgrade this much needed functionlity. I am loosing much time to try to create a document generating proces where it is impossible for the user to create a hard error. If somebody has an idea on how to do this I would really like to here it. Regards, Ronald
asked
2 answers
0

A sub microflow with the error handling on the microflow call? Or try calling the document generation from a java action and add the proper error handling in the java code.

answered
0

I added some options to the sanitize functions of CommunityCommons. These should help prevent those errors. And close a security hole in the process. Sanitize the user input when saving an object with rich text. The user may have used copy-paste to put in some content from another editor, like MS Word. Have a look at the From rich text to PDF sample in the appstore. Unfortunately the hyperlink does not work. Searching for PDF works.

answered