我有一个 pdf 生成代码,需要使用“另存为”对话框进行保存,但我不知道如何在 java 类应用程序中执行此操作。这是我的代码..
PdfWriter writer = null;
Document document = new Document();
try {
writer = PdfWriter.getInstance(document, new FileOutputStream(
fileName));
document.open();
请建议我如何添加“另存为对话框”。
最佳答案
尝试 JFileChooser:http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html
然后使用路径和文件名保存在后端函数中。
关于java - 如何在 Java 类应用程序中添加另存为对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23085572/