Skip to content

Commit aa13677

Browse files
committed
chore: readme
1 parent b0b978b commit aa13677

3 files changed

Lines changed: 71 additions & 18 deletions

File tree

README.md

Lines changed: 62 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,22 @@ Client/Server Side PDF-Generator based in PDFKit
2020
- **✅ Write in Typescript and Builded with [ESBuild](https://github.com/evanw/esbuild)**
2121
- **✅ Browser STDLib**
2222
- **✅ Custom Fonts && Purge Unused Fonts**
23+
- **[Nuxt](./packages/nuxt) & [Vue](./packages/vue) Support**
2324
- **✅ Plugins Ready!**
2425

25-
## Installation
26+
## Setup
2627

2728
```shell
2829
npm i pdfeasy
2930
```
3031

31-
## Simple Example
32-
3332
```ts
34-
import pdfeasy, { Utils } from 'pdfeasy'
35-
// import pdfeasy, { Utils } from 'pdfeasy/dist/client.cjs.js'
36-
// import pdfeasy, { Utils } from 'pdfeasy/dist/node.esm.js'
37-
// import pdfeasy, { Utils } from 'pdfeasy/dist/node.cjs.js'
33+
import pdfeasy from 'pdfeasy'
3834

3935
pdfeasy.new()
4036

4137
pdfeasy.add([
42-
{ raw: 'Simple text!' },
38+
{ raw: 'PDFEasy!' },
4339
])
4440

4541
pdfeasy.run({
@@ -49,23 +45,73 @@ pdfeasy.run({
4945
const iframe = document.querySelector('#pdf') as HTMLIFrameElement
5046

5147
iframe.src = blob
52-
}).catch((err: any) => {
53-
console.error(err)
48+
}).catch((err) => {
49+
// ...
5450
})
5551
```
5652

53+
### [Vue](./packages/vue)
54+
55+
```shell
56+
npm i vue-pdfeasy
57+
```
58+
59+
```ts
60+
import { PDFPlugin } from 'vue3-pdfeasy';
61+
62+
const app = createApp(App);
63+
app.use(PDFPlugin);
64+
app.mount('#app');
65+
66+
// ...
67+
68+
<script setup>
69+
import { usePDF } from 'vue3-pdfeasy';
70+
71+
const pdf = usePDF()
72+
73+
// ...
74+
</script>
75+
```
76+
77+
### [Nuxt](./packages/nuxt)
78+
79+
```bash
80+
npm i nuxt-pdfeasy
81+
```
82+
83+
```js
84+
// nuxt.config.ts
85+
modules: [
86+
'nuxt-pdfeasy'
87+
]
88+
```
89+
90+
```ts
91+
<script setup>
92+
import { useNuxtApp } from '#app';
93+
94+
const { $pdf } = useNuxtApp()
95+
// ...
96+
</script>
97+
```
98+
5799
## Content
58100

59101
```ts
60102
pdfeasy.add([
61103
...Utils.content(), // Utils for debug
62-
{ raw: 'Hello PDFEasy!', text: { font: 'Roboto' }}, // text with custom font,
63-
{ raw: 'https://i.imgur.com/path.png', image: {}}, // external image
104+
{ raw: 'Hello PDFEasy!', text: { font: 'Roboto' } }, // text with custom font,
105+
{ raw: 'https://i.imgur.com/path.png', image: {} }, // external image
64106
{ stack: [ // stack for paragraph's
65-
{ raw: 'A ', text: {}},
66-
{ raw: 'Simple', text: { bold: true, italic: true }},
67-
{ raw: ' Stack!', text: {}},
107+
{ raw: 'A ', text: {} },
108+
{ raw: 'Simple', text: { bold: true, italic: true } },
109+
{ raw: ' Stack!', text: {} },
68110
]},
111+
{ pageBreak: {} }, // page break
112+
{ lineBreak: {} }, // line break
113+
{ raw: 'A checkbox!', checkbox: {} }, // checkbox
114+
{ raw: 'A list!', list: { style: 'circle' } }, // list
69115
])
70116
```
71117

@@ -166,7 +212,7 @@ pdfeasy.addFonts([
166212
167213
## Resources
168214

169-
See [source demo](./packages/pdfeasy/demo) for more explanations
215+
See [source demo](./demo) for more explanations
170216

171217
See [examples](./packages/pdfeasy/examples/) for .pdf results.
172218

packages/nuxt/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
## Setup
66

77
```bash
8-
yarn add nuxt-pdfeasy
9-
// OR
108
npm i nuxt-pdfeasy
119
```
1210

packages/vue/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ A PDFEasy plugin for Vue 3.x
99
## Example
1010

1111
```ts
12+
//...
13+
import { PDFPlugin } from 'vue-pdfeasy';
14+
//...
15+
const app = createApp(App);
16+
app.use(PDFPlugin);
17+
app.mount('#app');
18+
19+
// ...
20+
1221
<template>
1322
<iframe id="pdf" />
1423
</template>

0 commit comments

Comments
 (0)