I am trying to use the SurveyJS “Export to PDF” feature, described here on a form with several pages. I follow the steps for a JavaScript application (importing Javascript libraries in HEAD, adding the rest of their code after I define the JSON of the survey) and nothing happens. When I open the Javascript console, I see two errors:
Uncaught TypeError: Cannot read properties of undefined (reading 'Serializer')
at survey.pdf.min.js:2:33043
at survey.pdf.min.js:2:179807
at survey.pdf.min.js:2:179813
at survey.pdf.min.js:2:306
at survey.pdf.min.js:2:326
survey_rct_wrapper.js:33 Uncaught ReferenceError: SurveyPDF is not defined
at savePdf (survey_rct_wrapper.js:33:23)
at t.action (survey_rct_wrapper.js:41:19)
at HTMLInputElement.<anonymous> (survey.jquery.min.js:11:47630)
at HTMLInputElement.dispatch (jquery.min.js:2:40035)
at v.handle (jquery.min.js:2:38006)
Apparently, this is due to the variable c
not being defined in line 2, column 33041 of the SurveyPDF library:
c.Serializer.addProperty("question", {...});
How can I fix this issue, or find another way to export from a SurveyJS JSON form to a PDF file?