# @alchemistenag/aws-lambda-libreoffice

> 85 MB LibreOffice to fit inside AWS Lambda compressed with Brotli

Latest version **2.2.2** (published 2020-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @alchemistenag/aws-lambda-libreoffice
pnpm add @alchemistenag/aws-lambda-libreoffice
yarn add @alchemistenag/aws-lambda-libreoffice
bun add @alchemistenag/aws-lambda-libreoffice
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.2 |
| Published | 2020-01-08 |
| First published | 2020-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.x |
| Dependencies | 5 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vlad Holubiev |
| Maintainers | alchemistenag |
| Keywords | aws lambda, libreoffice, serverless, pdf |

## Links

- npm: https://www.npmjs.com/package/@alchemistenag/aws-lambda-libreoffice
- Repository: https://github.com/alchemistenag/aws-lambda-libreoffice
- Homepage: https://github.com/alchemistenag/aws-lambda-libreoffice#readme
- Issues: https://github.com/alchemistenag/aws-lambda-libreoffice/issues
- npm.io page: https://npm.io/package/@alchemistenag/aws-lambda-libreoffice

## Dependencies (5)

- [del](https://npm.io/package/del.md) 4.1.1
- [is-image](https://npm.io/package/is-image.md) 3.0.0
- [is-video](https://npm.io/package/is-video.md) 1.0.1
- [@shelf/is-audio-filepath](https://npm.io/package/@shelf/is-audio-filepath.md) 0.0.3
- [@shelf/aws-lambda-brotli-unpacker](https://npm.io/package/@shelf/aws-lambda-brotli-unpacker.md) 1.0.0

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 2.2.2 (latest) — 2020-01-08
- 2.2.1 — 2020-01-08
- 2.2.0 — 2020-01-08

## README

# aws-lambda-libreoffice ![](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)

# THIS PACKAGES WAS FORKED FROM [shelfio/aws-lambda-libreoffice](https://github.com/shelfio/aws-lambda-libreoffice)

> 85 MB LibreOffice to fit inside AWS Lambda compressed with Brotli

Inspired by [chrome-aws-lambda](https://github.com/alixaxel/chrome-aws-lambda)

:information_source: Compiled LibreOffice version: 6.1.0.0.alpha0

## Install

```
$ yarn add @shelf/aws-lambda-libreoffice
```

**NOTE:** Since version 2.0.0 npm package no longer ships the 85 MB LibreOffice but relies upon [libreoffice-lambda-layer](https://github.com/shelfio/libreoffice-lambda-layer) instead.
Follow the instructions on how to add a lambda layer in [that repo](https://github.com/shelfio/libreoffice-lambda-layer).

## Usage

```js
const {convertTo, canBeConvertedToPDF} = require('@shelf/aws-lambda-libreoffice');

module.exports.handler = async () => {
  // assuming there is a document.docx file inside /tmp dir
  // original file will be deleted afterwards

  if (!canBeConvertedToPDF('document.docx')) {
    return false;
  }

  return convertTo('document.docx', 'pdf'); // returns /tmp/document.pdf
};
```

Or if you want more control:

```js
const {getExecutablePath, defaultArgs} = require('@shelf/aws-lambda-libreoffice');

const loBinary = await getExecutablePath(); // /tmp/instdir/program/soffice

execSync(`${loBinary} ${defaultArgs.join(' ')} --convert-to pdf file.docx --outdir /tmp`);
```

## See Also

- [libreoffice-lambda-layer](https://github.com/shelfio/libreoffice-lambda-layer)
- [serverless-libreoffice](https://github.com/vladgolubev/serverless-libreoffice)
- [aws-lambda-tesseract](https://github.com/shelfio/aws-lambda-tesseract)
- [aws-lambda-brotli-unpacker](https://github.com/shelfio/aws-lambda-brotli-unpacker)
- [chrome-aws-lambda](https://github.com/alixaxel/chrome-aws-lambda)

### Test

Smoke test that it works: `./test.sh`.
Make sure to clone [libreoffice-lambda-layer](https://github.com/shelfio/libreoffice-lambda-layer) repo alongside

## License

MIT © [Shelf](https://shelf.io)

---
_Source: https://npm.io/package/@alchemistenag/aws-lambda-libreoffice · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
