Question T18586
Visible to All Users

PDF Generation breaks if html contains < and > signs

created 9 months ago

Hi,
While trying to create a PDF of a survey, we saw it didn't worked and could pin it to an issue in rendering an HTML component.
The HTML content contained some ">>" signs to create visually a list. We replaced that with an Unordered List and the PDF worked again. So far so good.

The problem was that there was no correct error was thrown. Just an cannot read property of undefined (read "1") in console when executing the save(filename) method.
Could you may look into that as low prio? I am thinking of throwing an exception in the save function when rendering fails or may update the render function of html components…

Further the component is displayed correctly in the survey, so issues there, and version 1.9.139 is used.

Thanks

Answers approved by surveyjs Support

created 9 months ago

Hello Martin,

Thank you for reaching out to us.

As you may know, the SurveyPDF Generator uses the fromHTML function of the jsPDF library to export HTML questions to PDF. The exception is actually raised by the jsPDF from_html.js plugin, which is unable to parse the supplied HTML.
We currently do not handle complex HTML export scenarios at the level of the SurveyJS PDF Generator. Therefore, we do not recommend using the SurveyJS PDF Generator to export large or complex HTML content. Our library is suitable for exporting relatively simple/basic HTML content. If you need to export large or complex HTML content, please consider using a dedicated export library.

Please let me know if you have further questions.