我正在尝试打开ionic-v1应用程序中的pdf。
我想保持所有的pdf在服务器上,并解析它将pdf.js文件。
pdf.js将在服务器上(不在移动应用程序中)。pdf.js使用<>.html文件来显示pdf文件。
我想用inappbrowser打开这个服务器的html文件并显示pdf。
这样行得通吗?请帮帮忙。
发布于 2019-03-09 16:03:58
1)安装cordova inappbrowser插件:
cordova plugin add cordova-plugin-inappbrowser2)在inappbrowser中打开pdf:
function openMyPDF(){
let pdfUrl =
encodeURI("https://ionicframework.com/files/Ionic2Migration.pdf");
var ref = cordova.InAppBrowser.open(pdfUrl, "_blank);
}注意:如果URL包含Unicode字符,则使用encodeURI()。encodeURI真的很有用。
发布于 2019-02-20 18:39:31
install plugin
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git
then try this
<a class="item" href="#" onclick="window.open('http://www.orimi.com/pdf-test.pdf', '_system', 'location=yes'); return false;">
Open pdf
</a>https://stackoverflow.com/questions/54783791
复制相似问题