I want to allow the user to choose the PDF file save location and filename. I'm generating PDF by using iText library. In the code I used, it's saving the PDF file in a predefined name and root folder.
try {
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("Supplier Details Report.pdf"));
document.open();
//code for generate pdf
document.close();
JOptionPane.showMessageDialog(null, "PDF Saved");
} catch(Exception e) {
JOptionPane.showMessageDialog(null, e);
}