にコルドバドキュメントビューアプラグイン を使用してみてくださいタイプは、インストールcomponents.Toネイティブビューアを使用することにより、プラグインは
cordova plugin add https://github.com/sitewaerts/cordova-plugin-document-viewer.git --save
--saveフラグ自動的にプロジェクトディレクトリでこのコマンドを実行して、あなたのconfig.xmlファイルにプラグインを保存します。 プラグインとそのメソッドは、devicereadyイベントが発生する前に使用できません。
SitewaertsDocumentViewer.canViewDocument(
url, contentType, options, onPossible, onMissingApp, onImpossible,
onError);
onPossible
function(){
window.console.log('document can be shown');
//e.g. track document usage
}
onMissingApp
function(appId, installer)
{
if(confirm("Do you want to install the free PDF Viewer App "
+ appId + " for Android?"))
{
installer();
}
}
onImpossible
function(){
window.console.log('document cannot be shown');
//e.g. track document usage
}
のonError
function(error){
window.console.log(error);
alert("Sorry! Cannot show document.");
}
オープンドキュメントファイル
SitewaertsDocumentViewer.viewDocument(
url, mimeType, options, onShow, onClose, onMissingApp, onError);
onShow
function(){
window.console.log('document shown');
//e.g. track document usage
}
OnCloseの
function(){
window.console.log('document closed');
//e.g. remove temp files
}
onMissingApp
function(id, installer)
{
if(confirm("Do you want to install the free PDF Viewer App "
+ appId + " for Android?"))
{
installer();
}
}
のonError
function(error){
window.console.log(error);
alert("Sorry! Cannot view document.");
}