在HTML和CSS中创建的PhoneGap应用程序中打开PDF [英] Open PDF in the PhoneGap App that is made in HTML and CSS

查看:121
本文介绍了在HTML和CSS中创建的PhoneGap应用程序中打开PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题,我的iPad应用程序在手机差距。问题是,我必须在我的应用程序通过链接打开PDF文档,当我单击打开PDF的链接,它显示我的PDF文档没有后退链接。



因此,当我通过链接在我的应用程序打开PDF文档,它需要我到一个死胡同,我没有办法回到我的应用程序的主页。



我的问题是,如果我打开一个PDF,可以带我回到我的主页,我如何可以有一个顶栏? iPad的任何内部元素可能是?



非常感谢。

解决方案

尝试使用In App Browser外挂程式。



如果您使用的是Phonegap / Cordova版本(2.8.0,2.9.0等)



http://docs.phonegap.com/en/2.9.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser



它将允许您在覆盖应用程序的新窗口中打开PDF。它有一个完成按钮,用户可以使用它来关闭它,并在完成后返回到您的应用程序。



您将使用应用内浏览器打开PDF ,使用这样的:

  window.open('http://whitelisted-url.com/pdftoopen.pdf', '_空白'); 

_blank 选项会触发应用内浏览器插件。如果你使用 _system ,而是可能在iBooks中打开它(只是猜测 - 不是100%确定是否会使用iBooks)。 / p>

I have a strange problem with my iPad App in Phone Gap. The problem is that I have to open PDF document in my app through links and when I click the link which opens the PDF, it shows me the PDF document with no back link.

Hence, when I open the PDF document in my app through a link, it takes me to a dead end and there is no way I can go back to the main page of my app.

My question is that how can I have a Top-Bar, when I open a PDF which could take me back to my home page? Any internal element for the iPad may be?

Thanks a lot.

解决方案

Try using the In App Browser plugin.

If you're using a later Phonegap / Cordova version (2.8.0, 2.9.0 etc) it should come with it - nothing else to install.

http://docs.phonegap.com/en/2.9.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser

It will allow you to open the PDF in the a new 'window' that overlays your app. It has a 'Done' button that users can use to close it and return to your app when they are finished.

You would open the PDF using the In-App Browser, using something like this:

window.open('http://whitelisted-url.com/pdftoopen.pdf', '_blank');

I.e. the _blank option triggers the In-App Browser plugin. If you were to use _system instead it might open it in iBooks (just guessing there - not 100% sure if it would use iBooks).

这篇关于在HTML和CSS中创建的PhoneGap应用程序中打开PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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