com.collabitsoftware.opendoc

1.0.4 • Public • Published

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)
)

/com.collabitsoftware.opendoc/

    Package Sidebar

    Install

    npm i com.collabitsoftware.opendoc

    Weekly Downloads

    0

    Version

    1.0.4

    License

    BSD-3-Clause

    Unpacked Size

    21 kB

    Total Files

    9

    Last publish

    Collaborators

    • collabitsoftware