I am using ReportMill to generate a report. The following is the code which generates a pdf document.
My question is: How do I pass the generated pdf document to a filechooser in Javafx ?
This so that it enables the user to save it to a folder of his choice. ReportMill itself can save the generated pdf to a string path specified as indicated in the code snippet below.
However once the application is installed on different computers instead of finding out user home directory, I would like to use a filechooser so that the generated pdf is saved to a directory of the users choice.
RMDocument report = template.generateReport(adminRecords);
report.getBytesPDF();
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Save Report To : ");
FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter("PDF files (*.pdf)", "report.pdf");
fileChooser.getExtensionFilters().add(filter);
fileChooser.showSaveDialog(stageReport);
The following line can save to the path specified:
report.writePDF("c:/Users/xyz/Desktop/Report.pdf");
But as I mentioned that is not what I want. Would appreciate any help with this thanks.