nuxt-pdfeasy

A PDF document generator to your Nuxt application.
5,338 5
Install
npm install nuxt-pdfeasy
Latest Version:1.4.0
Vue:3
License:MIT
Last Updated:May 14, 2023
Links: GitHub  ·  npm
Maintainer: novout

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>

Related Packages

@leukeleu/eslint-config

Reusable Eslint config for Leukeleu projects

10,175 0
vue-use-state-effect

Fast and small library built on top of the native Vue.js API, providing a safe a...

13,117 38
vue-use-variant

Vue.js CSS class variant resolver. Presented as handy composable.

3,577 36
waelio-utils

Helper Utils often used in websites

8,166 1
@pdf-viewer-yee/pdf-viewer-vue3

一款Vue3框架开发的pdf阅读器组件,如果您使用的是Vue2,可以查看Vue2PDF阅读器组件地...

1,669 1

Version History

Version Released Vue License
1.4.0 ^3.0 MIT
1.3.0 ^3.0 MIT
1.2.2 ^3.0 MIT
1.2.1 ^3.0 MIT
1.2.0 ^3.0 MIT