Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 查看以显示PDFPage_Android_Pdf - Fatal编程技术网

Android 查看以显示PDFPage

Android 查看以显示PDFPage,android,pdf,Android,Pdf,我正在实现某种杂志查看器(用于浏览android gallery中的页面),其内容取自pdf文件;页面必须可缩放。首先,我尝试使用pdf中的单独图片。我借用了ImageViewTouch和ImageViewTouchViewPager。它工作得很好,但我不能在内存中保存超过3-4个大图片(OutOfMemory错误),所以实现不适合我。(我需要内存中的5个大图片加上内存中大约50个小图片来显示目录) 所以我决定使用pdf文件。我曾尝试使用PdfViewer.jar显示pdf,但使用PDFView

我正在实现某种杂志查看器(用于浏览android gallery中的页面),其内容取自pdf文件;页面必须可缩放。首先,我尝试使用pdf中的单独图片。我借用了ImageViewTouch和ImageViewTouchViewPager。它工作得很好,但我不能在内存中保存超过3-4个大图片(OutOfMemory错误),所以实现不适合我。(我需要内存中的5个大图片加上内存中大约50个小图片来显示目录)

所以我决定使用pdf文件。我曾尝试使用PdfViewer.jar显示pdf,但使用PDFViewerActivity的此实现在您尝试放大或缩小时缺少图片或文本

你能告诉我如何在android gallery中显示我的pdf格式吗?或者,至少,请告诉我,如果你知道视图,哪一个可以显示带有缩放选项的PDFPage


已编辑:我不需要打开side app来查看pdf。我需要在我的应用程序中播放它。

您可以尝试一下:

public static void openPdf(Context context, String filename) {
File targetFile = new File(filename);
Uri targetUri = Uri.fromFile(targetFile);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(targetUri, "application/pdf");
try {
    context.startActivity(intent);
} catch (ActivityNotFoundException act ) {
    Toast.makeText(context, "Please install a pdf reader to view help",Toast.LENGTH_LONG).show();
}

}

您可以尝试一下:

public static void openPdf(Context context, String filename) {
File targetFile = new File(filename);
Uri targetUri = Uri.fromFile(targetFile);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(targetUri, "application/pdf");
try {
    context.startActivity(intent);
} catch (ActivityNotFoundException act ) {
    Toast.makeText(context, "Please install a pdf reader to view help",Toast.LENGTH_LONG).show();
}

}

此实现是否打开设备上安装的pdf阅读器?我不需要,我需要在我的应用程序中显示pdf。你可以尝试在你的应用程序中集成pdf查看器。MuPDF通常在各种设备上工作。尝试以下操作:此实现是否正在打开设备上安装的pdf阅读器?我不需要,我需要在我的应用程序中显示pdf。你可以尝试在你的应用程序中集成pdf查看器。MuPDF通常在各种设备上工作。试试这个: