如何在phonegap中的同一个应用程序中显示PDF文件 [英] How to Display PDF File with in the same App in phonegap

查看:204
本文介绍了如何在phonegap中的同一个应用程序中显示PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在同一个phonegap应用程序中显示Pdf文件。我试过Inappbrowser,Mupdf,PDFJS都显示PDF使用其他pdf viewer.i想打开pdf文件与在同一个应用程序。任何人都帮助我out.Thanks提前

how to show Pdf file with in the same phonegap app. i tried Inappbrowser,Mupdf,PDFJS all are displaying PDF using other pdf viewer.i would like to open the pdf file with in the same app.Can anyone help me out.Thanks in advance

推荐答案

(对不起,我的穷英语)我不知道你的意思在同一个应用程序,因为 inappbrowser Mupdf pdf.js 都可以。

(Excuse my poor English) I don't know what you mean "in the same app", because inappbrowser, Mupdf and pdf.js can all do that.

在Android平台中,最流行的解决方案是发送 intent ,并通过其他PDF查看器打开,因为用户可以选择收藏(您可以尝试文件打开程序2 )。如果您不喜欢,可以在您的应用中创建一个用于显示pdf的活动,就像 MuPDF Viewer 。如果你想在Cordova / Phonegap webview打开pdf文件,你需要mozilla的 PDF.js ,这是一个纯js lib在HTML5画布上渲染pdf文件,但它比使用原生解决方案慢得多(即使您使用 Crosswalk ),所以我不建议。

In Android platform, most popular solution is send intent and open via other pdf viewers because users can choose there favorite(you can try File Opener 2). If you don't like that, you can build an Activity for displaying pdf in your app, just like MuPDF Viewer. If you want open pdf file in Cordova/Phonegap webview, you need mozilla's PDF.js, that's a pure-js lib for rendering pdf file on HTML5 canvas, but it pretty slower than using native solution (even you build with Crosswalk), so I dont suggest that.

在iOS平台上更容易。 iOS的 UIWebView 可以本地打开pdf文件,所以你需要的是使用 inAppBrowser Plugin 。如果您想要更多功能,可以使用许多插件(例如 Cordova PDFReader IOS

It's much easier in iOS platforms. iOS's UIWebView can open pdf files natively, so all you need is using inAppBrowser Plugin. If you want more features, there're many plugins (like Cordova PDFReader IOS) you can choose.

希望能帮助你。

这篇关于如何在phonegap中的同一个应用程序中显示PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆