能够打开pdf文件。但是不知道如何将pdf文件的内容保存在数组或其他文件中,这样我就可以随心所欲地显示pdf了。有没有人能建议我如何保存pdf content...is,有没有库可以使用?
以下代码片段显示了如何打开pdf。
File file = new File("/sdcard/example1.pdf");
if (file.exists()) {
Uri path = Uri.fromFile(file);
Log.e("path of the file",path.toString());
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
Toast.makeText(getApplicationContext(),
"No Application Available to View PDF",
Toast.LENGTH_SHORT).show();
}
}谢谢
发布于 2011-07-19 13:51:36
你应该使用iText库..
iText是一个Java库,最初由Bruno Lowagie创建,允许创建、读取和操作
这是链接。http://www.vogella.de/articles/JavaPDF/article.html
发布于 2011-07-19 13:53:09
看看Mono for Android吧。它将使您能够使用C#和.NET为安卓进行开发,并允许您安装和访问iTextSharp library
iTextSharp是用于创建和操作adobe pdf文档的一个非常广泛且有充分文档记录的库。
https://stackoverflow.com/questions/6742784
复制相似问题