# com.collabitsoftware.opendoc

> Open a document in an external program

Latest version **1.0.4** (published 2021-03-10) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install com.collabitsoftware.opendoc
pnpm add com.collabitsoftware.opendoc
yarn add com.collabitsoftware.opendoc
bun add com.collabitsoftware.opendoc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-03-10 |
| First published | 2021-02-24 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 20.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Collabit Software Ltd |
| Maintainers | collabitsoftware |
| Keywords | ecosystem:cordova, cordova-android, cordova-ios |

## Links

- npm: https://www.npmjs.com/package/com.collabitsoftware.opendoc
- npm.io page: https://npm.io/package/com.collabitsoftware.opendoc

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2021-03-10
- 1.0.3 — 2021-02-24
- 1.0.0 — 2021-02-24

## README

---
title: OpenDoc
description: Launch a document in an external app
---
<!--
# Copyright 2021 Collabit Software Ltd
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE.
-->

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

---
_Source: https://npm.io/package/com.collabitsoftware.opendoc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
