if (this.datas.pdfName.substr(0, 4) == 'http') {
pdf = this.datas.pdfName;
} else {
- pdf = 'data/' + this.datas.pdfName;
+ pdf = this.relativeToAbsolute('data/' + this.datas.pdfName);
}
var e = pdf.split('/');
pdfName = e.pop();
/*if (this.gal && !OFFLINEAPP) {
- this.displayLoader();
- this.gal.downloadAndCall('extras', function () {
- $this._openFile(pdf, $("#print"), 'pdf', pdfName);
- });
- } else {*/
- this._openFile(pdf, $("#print"), 'pdf', pdfName);
+ this.displayLoader();
+ this.gal.downloadAndCall('extras', function () {
+ $this._openFile(pdf, $("#print"), 'pdf', pdfName);
+ });
+ } else {*/
+ this._openFile(pdf, $("#print"), 'pdf', pdfName);
//}
},
_openFile: function (url, e, type, localname) {
if (this.datas.phonegap == 'android') {
if (types_android[type] != undefined) {
+ fb('open pdf file');
this.displayLoader();
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, function (fileSystem) {
+ fb('got local file system');
+ fb('try to resolve url');
window.resolveLocalFileSystemURL(url, function (entry) {
+ fb('resolved from file');
window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (dirEntry) {
+ fb('resolved to dir');
entry.copyTo(dirEntry, 'document.pdf', function (copyEntry) {
+ fb('copied file');
window.plugins.webintent.startActivity({
action: window.plugins.webintent.ACTION_VIEW,
type: types_android[type],
}
return false;
},
+
+ relativeToAbsolute: function (relative) {
+ var a = document.createElement('a');
+ a.href = relative;
+ return a.cloneNode(false).href;
+ },
+
highlightSearchTerms: function (pageNr) {
return;
},