1.4.0 • Published 11 months ago

nuxt-pdfeasy v1.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Nuxt3 PDFEasy Module

Setup

npm i nuxt-pdfeasy
// nuxt.config.ts
modules: [
  'nuxt-pdfeasy'
]

Example

<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>
1.2.0

11 months ago

1.1.1

11 months ago

1.1.0

12 months ago

1.4.0

11 months ago

1.2.2

11 months ago

1.3.0

11 months ago

1.2.1

11 months ago

1.1.2

11 months ago

1.0.1

12 months ago

1.0.0

1 year ago