2016-08-09 47 views
0

Cordova WP8アプリでPDFファイルを表示するにはどうすればよいですか?私は、PDFファイルを表示するには、InAppBrowser pluginを使用していますが、それは、このエラーを与える:私はCordova WP8アプリにPDFファイルを表示

window.open(<URL-to-PDF>, '_system'); 

URLをブラウザで動作している関数を呼び出しています

Exception thrown: 'System.UriFormatException' in System.ni.dll 

答えて

0

Cordova Document Viewer Pluginあなたが簡単にプラグインのこのfunctioning.Theの目的は異なるドキュメントを表示するにはコルドバベースのモバイルアプリケーションのためのプラットフォームに依存しないのJavaScriptインターフェースを作成することです達成することができます使用することによりhttps://github.com/sitewaerts/cordova-plugin-document-viewer

0

にコルドバドキュメントビューアプラグイン を使用してみてくださいタイプは、インストール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."); 
} 
関連する問題