ファイルプラグインを使用してPDFファイルを保存しましたが、InAppBrowserまたはFile Openerプラグインで開くことができません。私はAndroid用のVisual Studio Emulator KitKatを使用しています。InAppBrowserプラグインとファイルオープナープラグインを使用したCordovaファイルプラグイン
InAppBrowser Pluginのコードは次のとおりです。 fileEntry.toURL()
メソッドは "file:///data/data/com.ionicframework.ionicblankapp/cache/Sample.pdf"を返します。
ただし、InAppBrowserでは常に空白のページが表示されます。ファイルオープナープラグインの
window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (dirEntry) {
dirEntry.getFile(fileName, { create: true, exclusive: false },
function (fileEntry) {
fileEntry.createWriter(
function (fileWriter) {
fileWriter.onwriteend = function (e) {
var ref = cordova.InAppBrowser.open(fileEntry.toURL(), '_blank');
};
fileWriter.write(fileBlob);
});
});
});
、私は「9」のエラー状態とは見られないこのメッセージ
活動取得:いいえ活動はテント{行為= android.intent.action.VIEWを処理しないことが判明しDAT =ファイル:以下///data/data/com.ionicframework.ionicblankapp/cache/Sample.pdfの標準=アプリケーション/ PDF FLG = 0x4000000}」
はファイルオープナープラグインのためのコードである
。window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (dirEntry) {
dirEntry.getFile(fileName, { create: true, exclusive: false },
function (fileEntry) {
fileEntry.createWriter(
function (fileWriter) {
fileWriter.onwriteend = function (e) {
cordova.plugins.fileOpener2.open(fileEntry.toURL(), 'application/pdf', {
success: function() {
//success
},
error: function (e) {
alert(e);
});
};
fileWriter.write(fileBlob);
});
});
});
現在、私は何が欠けているのか分かりません。どんな助けもありがとう。
にこのライン
を変更してみてくださいを参照してください:https://github.com/simonprickett/pdfjscordova – daserge