Question T10473
Visible to All Users

File question doesn't allow downloading Word document when survey is exported to PDF

created 3 years ago (modified 3 years ago)

[Ticket cloned from T10307: How attachments are exported onto PDF]

Hi Serge, apologies for re-opening quite an old ticket. I've added a question type of 'file' to an example on SurveyJs and I've uploaded a very simple word document. This adds a link to the exported PDF just fine. However, when I come to click on the link, the attachment doesn't download. I have to instead right-click, and open the link in a new tab in order for the attachment to successfully download. Is this normal behavior?

Answers approved by surveyjs Support

created 3 years ago

Hello Mo,
It seems PDF file attachments were never meant to be downloaded by clicking a link. When exporting a survey to PDF, we Base64 encode a file and produce a link tag in the resulting PDF file using the jsPDF library.
To save an embedded file to your computer, simply right-click the attachment link, select "Save link as…" and proceed with saving a file.

Please let us know if you have any questions.

    Show previous comments (1)

      Hello Mo,
      Unfortunately, it seems no. In the LinkBrick.renderInteractive method, we use the jsPDF doc.textWithLink method to generate a link. The this.link parameter which is used there is simply a Base64 encoded document. That is, when a user click a link, this doesn't basically trigger a browser download file action.

      Hope this clarifies the situation. Drop me a line if anything remains unclear.

        Thank you Jane. This makes sense.

          You're welcome, Mo. Please feel free to contact us if you have any questions.