I m searching why my show *.showDialog for a "save to" doesn't work.
It works correctly when i m launching it with my IDE Intellij-idea.
But when i want to start my app with the .jar file, the showDialog doesn't work.
It would be run when i click on "Valider".
This is my code:
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new File("."+File.separator));
int reponse = chooser.showDialog(chooser, "Enregistrer sous");
if(reponse == JFileChooser.APPROVE_OPTION) {
String fichier = chooser.getSelectedFile().toString();
document.save(fichier+".pdf");
}
Edit:
This is the new code:
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new File(System.getProperty("user.home")));
int reponse = chooser.showDialog(chooser, "Enregistrer sous");
if(reponse == JFileChooser.APPROVE_OPTION) {
String fichier = chooser.getSelectedFile().toString();
document.save(fichier+".pdf");
}
Edit 14/03:
I have found my error:
"javax.imageio.IIOException: Can't read input file!"
I'm trying to resolve this one, it probably because the file path is uncorrectly defined.
This is my code to draw my image:
PDImageXObject pdImage = PDImageXObject.createFromFile("myImage.png", document);
contentStream.drawImage(pdImage, 480, 720);
Thanks