在我的应用程序中,我下载了几个PDF文件,并将它们全部保存到一个存储代码中。
现在,我想编写一个代码,允许用户使用任何可以处理PDF的应用程序(比如PDF查看器)查看每个PDF文件的内容(每次一个)。
我该怎么做?
发布于 2017-12-01 06:40:20
参见:https://www.codenameone.com/blog/open-file-rendering.html
Form hi = new Form("PDF Viewer", BoxLayout.y());
Button devGuide = new Button("Show PDF");
devGuide.addActionListener(e -> {
FileSystemStorage fs = FileSystemStorage.getInstance();
String fileName = fs.getAppHomePath() + "pdf-sample.pdf";
if(!fs.exists(fileName)) {
Util.downloadUrlToFile("http://www.polyu.edu.hk/iaee/files/pdf-sample.pdf", fileName, true);
}
Display.getInstance().execute(fileName);
});
hi.add(devGuide);
hi.show();https://stackoverflow.com/questions/47580384
复制相似问题