Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bifot/doc2pdf

Convert DOC to PDF.
https://github.com/bifot/doc2pdf

Last synced: about 2 months ago
JSON representation

Convert DOC to PDF.

Awesome Lists containing this project

README

        

# doc2pdf

Convert DOC to PDF.

## Install

```sh
$ apt-get install unoconv -y
$ npm i doc2pdf -S
```

## Usage

```js
const path = require('path');
const fs = require('fs');
const doc2pdf = require('doc2pdf');

// read buffer from .docx file
// sync operation is for demonstration only
// use async operation in production mode
const buffer = fs.readFileSync('./file.docx');

// create pdf from buffer
doc2pdf(buffer).then((pdf) => {
console.log(pdf); //
});

// create pdf from file
doc2pdf('./file.docx').then((pdf) => {
console.log(pdf); //
});
```

## License

MIT.