surveyjs / survey-pdf

Supplementary component to the SurveyJS Form Library to download surveys as PDF files and generate editable PDF forms.
https://surveyjs.io/pdf-generator/examples/survey-pdf-export/
Other
58 stars 29 forks source link

An exception is thrown if the `onDownloadFile` event handler is not implemented #283

Closed JaneSjs closed 8 months ago

JaneSjs commented 8 months ago

User Issue: T14799 - Urgent Help needed - Issue with SurveyPdf https://surveyjs.answerdesk.io/internal/ticket/details/T14799


View Demo When files are stored by their names/ids in a survey, it's expected that a developer implements the onDownloadFile function and downloads files to render their File question previews. However, if this function is not implemented, a SurveyJS PDF Generator fails with an exception.

Purposed solution: The SurveyJS PDF Generator should not fail with an exception if the onDownloadFile callback function is not attached to a SurveyJS PDF model instance. As an option, we may simply generate an empty file preview, similar to the following one: image