0

how to open a save as popup window on click of generatePDF button to save pdf at local drive.i am using jspdf and auto table js to export html table data to pdf.

1 Answers1

1

According to this answer there is no way to force modern browsers to open a save as dialog. Which I am personally happy about as a user. Some people have had luck with using window.open('file.txt');, but that only opens a new tab in chrome.

I would advise you to rethink if you have to give the user a save as dialog or if there is another way to handle it. Maybe it is enough asking them what filename they want to use and then use the default way to save a pdf in jspdf:

var filename = document.getElementById('filename-input').textContent;
jspdfDocument.save(filename);
Community
  • 1
  • 1
Simon Bengtsson
  • 7,573
  • 3
  • 58
  • 87