2

I am using jsPDF to generate PDF file. What I want to do is when I click save button to save the file to specific location, for example in Desktop.

So far my code does this:

var doc = new jsPDF();
doc.addImage(imgData, 'JPEG', 0, 0, 210, 40);
doc.save('test.pdf');

The .save function just gives us the opportunity to download the file, but what I want is to save the file to specific location, for example C:\Users\username\Desktop.

Thank you.

user3116539
  • 49
  • 3
  • 9
  • 3
    Possible duplicate of [Save files into selected directory (javascript)](http://stackoverflow.com/questions/20888867/save-files-into-selected-directory-javascript) (tl;dr: you can't.) – JJJ Apr 10 '16 at 15:57
  • _" but what I want is to save the file to specific location, for example `C:\Users\username\Desktop`"_ Select `C:\Users\username\Desktop` at `Save File` dialog? – guest271314 Apr 10 '16 at 16:06

1 Answers1

2

You can't do that: JavaScript has no access to filesystem.

Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128