Skip to content

Commit

Permalink
build: ignore default case
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Jun 9, 2023
1 parent bfbaebb commit a195373
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 199 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ npm i pdfeasy
```

```ts
import { PDFEasy } from 'pdfeasy'

const pdfeasy = new PDFEasy()
import pdfeasy from 'pdfeasy'

pdfeasy.new()

Expand Down Expand Up @@ -226,7 +224,7 @@ pdfeasy.addFonts([
])
```

> **Attention!** Client-Side version not support relative/absolute font paths at this time.
> **Attention!** Server-Side version not support relative/absolute font paths at this time.
## Resources

Expand Down
4 changes: 1 addition & 3 deletions demo/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PDFEasy, Utils } from 'pdfeasy'
import pdfeasy, { Utils } from 'pdfeasy'
import './style.css'

const app = document.querySelector<HTMLDivElement>('#app')!
Expand All @@ -7,8 +7,6 @@ app.innerHTML = `
<iframe id="pdf">
`

const pdfeasy = new PDFEasy()

pdfeasy.new({
document: {
margins: {
Expand Down
122 changes: 61 additions & 61 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
{
"name": "nuxt-pdfeasy",
"sideEffects": false,
"author": {
"email": "[email protected]",
"name": "Novout",
"url": "https://github.com/Novout"
},
"version": "1.2.1",
"repository": "https://github.com/betterwrite/nuxt-pdfeasy",
"description": "A PDF document generator to your Nuxt application.",
"engines": {
"node": ">=14.16"
},
"bugs": {
"url": "https://github.com/betterwrite/nuxt-pdfeasy/issues"
},
"keywords": [
"pdfkit",
"pdf",
"typescript",
"javascript",
"printing",
"nuxt3"
],
"license": "MIT",
"type": "module",
"exports": {
".": {
"import": "./dist/module.mjs",
"require": "./dist/module.cjs"
}
},
"main": "./dist/module.cjs",
"types": "./dist/types.d.ts",
"files": [
"dist",
"package.json"
],
"scripts": {
"build:prod": "pnpm run set",
"build": "pnpm run set",
"prepack": "pnpm run set",
"set": "nuxi prepare && nuxt-module-build && nuxi prepare playground",
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground"
},
"dependencies": {
"@nuxt/kit": "^3.5.3",
"pdfeasy": "^1.2.1"
},
"devDependencies": {
"@nuxt/module-builder": "^0.4.0",
"@nuxt/schema": "^3.5.3",
"@nuxtjs/eslint-config-typescript": "^12.0.0",
"@types/node": "^18.11.9",
"eslint": "^8.42.0",
"nuxt": "^3.5.3"
}
}
{
"name": "nuxt-pdfeasy",
"sideEffects": false,
"author": {
"email": "[email protected]",
"name": "Novout",
"url": "https://github.com/Novout"
},
"version": "1.2.1",
"repository": "https://github.com/betterwrite/nuxt-pdfeasy",
"description": "A PDF document generator to your Nuxt application.",
"engines": {
"node": ">=14.16"
},
"bugs": {
"url": "https://github.com/betterwrite/nuxt-pdfeasy/issues"
},
"keywords": [
"pdfkit",
"pdf",
"typescript",
"javascript",
"printing",
"nuxt3"
],
"license": "MIT",
"type": "module",
"exports": {
".": {
"import": "./dist/module.mjs",
"require": "./dist/module.cjs"
}
},
"main": "./dist/module.cjs",
"types": "./dist/types.d.ts",
"files": [
"dist",
"package.json"
],
"scripts": {
"build:prod": "pnpm run set",
"build": "pnpm run set",
"prepack": "pnpm run set",
"set": "nuxi prepare && nuxt-module-build && nuxi prepare playground",
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground"
},
"dependencies": {
"@nuxt/kit": "^3.5.3",
"pdfeasy": "^1.2.1"
},
"devDependencies": {
"@nuxt/module-builder": "^0.4.0",
"@nuxt/schema": "^3.5.3",
"@nuxtjs/eslint-config-typescript": "^12.0.0",
"@types/node": "^18.11.9",
"eslint": "^8.42.0",
"nuxt": "^3.5.3"
}
}
92 changes: 46 additions & 46 deletions packages/nuxt/playground/app.vue
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
<template>
<iframe id="pdf" />
</template>

<script setup>
import { useNuxtApp } from '#app';
const { $pdf } = useNuxtApp()
$pdf.new({
plugins: [
{
page: [
// simple counter footer
({ Text }, context, current, total) => {
// render in every page
Text(`${current}/${total}`, { fontSize: 20 }, {
x: context.width / 2,
y: context.height - context.margins.bottom
})
},
// simple header
({ Text }, context, current, total) => {
// render in every page
Text('A Simple Header', {}, {
x: context.width / 2,
y: context.margins.top - 20
})
}
]
}
]
})
$pdf.add([
{ raw: 'Hello NUXT!', text: { fontSize: 22 }},
])
$pdf.run().then(blob => {
const iframe = document.querySelector('#pdf')
iframe.src = blob
}).catch((err) => {
console.error(err)
})
</script>
<template>
<iframe id="pdf" />
</template>

<script setup>
import { useNuxtApp } from '#app';
const { $pdf } = useNuxtApp()
$pdf.new({
plugins: [
{
page: [
// simple counter footer
({ Text }, context, current, total) => {
// render in every page
Text(`${current}/${total}`, { fontSize: 20 }, {
x: context.width / 2,
y: context.height - context.margins.bottom
})
},
// simple header
({ Text }, context, current, total) => {
// render in every page
Text('A Simple Header', {}, {
x: context.width / 2,
y: context.margins.top - 20
})
}
]
}
]
})
$pdf.add([
{ raw: 'Hello NUXT!', text: { fontSize: 22 }},
])
$pdf.run().then(blob => {
const iframe = document.querySelector('#pdf')
iframe.src = blob
}).catch((err) => {
console.error(err)
})
</script>
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineNuxtPlugin } from '#app'
import { PDFEasy } from 'pdfeasy/dist/client.esm.js'
import { PDFEasy } from 'pdfeasy'

export default defineNuxtPlugin(({ provide }) => {
provide('pdf', new PDFEasy())
Expand Down
Loading

0 comments on commit a195373

Please sign in to comment.