Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/molgenis/vue-pdfium
Vue -> HTML -> Puppeteer PDF rendering service
https://github.com/molgenis/vue-pdfium
pdf-generation puppeteer vue
Last synced: 13 days ago
JSON representation
Vue -> HTML -> Puppeteer PDF rendering service
- Host: GitHub
- URL: https://github.com/molgenis/vue-pdfium
- Owner: molgenis
- Created: 2020-02-24T13:15:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T15:37:01.000Z (almost 2 years ago)
- Last Synced: 2024-10-30T07:43:19.306Z (16 days ago)
- Topics: pdf-generation, puppeteer, vue
- Language: JavaScript
- Homepage:
- Size: 2.36 MB
- Stars: 1
- Watchers: 13
- Forks: 1
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# vue-pdfium
## Install
### Manual
> Node.js 13 or later is required (native ESM).
```bash
[email protected]:molgenis/vue-pdfium.git
cd vue-pdfium
yarn
cp .pdfrc.example .pdfrc
node src/service.js
```### Docker
```bash
[email protected]:molgenis/vue-pdfium.git
cd vue-pdfium
docker build . -t vue-pdfium
docker container run -p 3000:3000 vue-pdfium
docker run -it -p 3000:3000 vue-pdfium bash
```## Usage
POST the component name to render and its state to `/vuepdf`:
```javascript
import axios from 'axios'
// We could have used URL.createObjectURL manually, but
// this library takes care of IE/Safari edge cases as well.
import fileDownload from 'js-file-download'const res = await axios({
method: 'POST',
url: '/vuepdf',
responseType: 'blob',
data: {
component: 'orders',
state
}
})fileDownload(res.data, 'mypdf.pdf', 'application/pdf')
```### Development
```bash
# Set `dev` to true, which autoreloads components on every request.
vim .pdfrc
# Fill state.json with the results of JSON.stringify(data).
# This allows you to develop with static state and GET requests.
cp state.json.example state.json
nodemon src/service.js
```During development, open `/vuepdf-dev` in a Chrom(e/ium) browser and use
the [Livereload extension](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei)
to watch the rendered PDF in the browser while you update your component & styling.