com.collabitsoftware.opendoc
v1.0.4
Published
Open a document in an external program
Downloads
6
Maintainers
Readme
title: OpenDoc description: Launch a document in an external app
OpenDoc
This plugin allows a file contained in a JavaScript byte array or ArrayBuffer to be opened in an external app after prompting the user.
Opendoc.open("filename.pdf", pdf_data);
Installation
corodva plugin add com.collabitsoftware.opendoc
Supported Platforms
- Android
- iOS
Quick example
var req = new XMLHttpRequest();
req.open('GET','https://mydomain/myfile.pdf');
req.responseType='arraybuffer';
req.onload=function() {if (req.status==200) {
let byteArray = new Uint8Array(req.response);
Opendoc.open("myfile.pdf", byteArray);
}
};
req.send();
Parameters
filename (the filename including extension presented to the external app)
data (a byte array or ArrayBuffer)
mime_type (optional as type is auto-detected based on file extension, used on Android only)
success function (passed a json result string)
{
'type':'application/pdf',
'size':'123'
}
(type returned on Android only)
- failure function (never called)
Further Example
Opendoc.open(
"document.pdf",
documentData,
"application/pdf",
(result) => console.log(result)
)