Open dparrella opened 7 years ago
Hi Dan
On my Android device with the demo code PDF is opening, please try the following code:
HTML:
<div ng-click="openPDF('http://www.theoomf.com/docs/oomf_privacy_policy.pdf')">
http://www.theoomf.com/docs/oomf_privacy_policy.pdf
</div>
JS:
$scope.openPDF = function (pdfURL) {
DocumentHandler.previewFileFromUrlOrPath(
function () {
console.log('success');
},
function (error) {
if (error == 53) {
console.log('No app that handles this file type.');
}else if (error == 2){
console.log('Invalid link');
}
},
pdfURL,
""
);
};
BR, Sashko
I'm trying to open a PDF and getting "JSON error" passed back to the error function. Not sure why this would happen. I checked the response headers and the content type is application/pdf.
I/chromium(29878): [INFO:CONSOLE(1685)] "Failed to open http://www.theoomf.com/docs/oomf_privacy_policy.pdf with error JSON error", source: file:///android_asset/www/js/oomf-app.98d867481b6592d8.js (1685)