In this tutorial we’ll look at how to use Electron showSaveDialog. The save dialog will return a string containing a path which the user selected.
To only display a save dialog this is what is needed as a minimum:
But as with the other dialogs we can do more with it:
The code above proposes a path and a filename to the user when opening the save dialog with defaultPath
. It uses app.getPath to get the path to our users document folder and then appends a filename.pdf
I’ve also changed so that the callback method is used which gives us the path. I’d recommend to look at the showSaveDialog documentation to see what more options you can use.
This code is added to Electron tutorial app and you can take a look at the dialog.js file to see this code.
In the next tutorial we’ll continue from here and save the pdf. But that post is coming soon.