cordova open pdf - fileOpener2

纵然是瞬间 提交于 2020-01-17 05:37:07

问题


I want to open a PDF file with fileOpener2

my config.xml looks like this:

<feature name="FileOpener2">
    <param name="android-package"
        value="io.github.pwlin.cordova.plugins.fileopener2.FileOpener2" />
</feature>
<feature name="File Opener2">
    <param name="id" value="cordova-plugin-file-opener2" />
</feature>

My HTML code:

<SCRIPT language="JavaScript">

function callPDF() {
cordova.plugins.fileOpener2.open('/sdcard/Download/bericht74.pdf', 'application/pdf');
}

</SCRIPT>
</head>
    <body>
 <a href="#" onClick="callPDF()">
<strong>open pdf</strong></a>

And Eclipse tells me:

10-19 10:16:02.111: I/chromium(17201): [INFO:CONSOLE(18)] "Uncaught ReferenceError: cordova is not defined", source: file:///android_asset/www/index.html (18)

How can I call the fileOpener2 plugin correctly?

来源:https://stackoverflow.com/questions/33212042/cordova-open-pdf-fileopener2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!