I have a richtextbox where users can type in some text. In my pdf I read those text using a dynamic label with the “Render XHTML” propery set to “true”. If the user types a double enter (white-space = <br>) it application crashes. In short the error says: XHTML → <Br> needs a </br> → When i remove the whitespaces (=<br>) from the texts, the app works fine. (with <br> it doesn’t) Any ideas on how to solve this?
You should always clean the user input. You can use the community commons XSSSanitize and even that will not solve all your problems because XHTML is even stricter. You could filter the string yourself before committing and creating the PDF template.