1.6.0 • Published 2 years ago

pdf-renderer v1.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

pdf-renderer

Install

npm install pdf-renderer

Usage

Create Document

import { template } from 'pdf-renderer'

const render = template({
  source: { width: 100, height: 100 },
  schema: [
    {
      title: {
        type: 'text',
        x: 0,
        y: 0,
        width: 50,
        height: 50
      }
    }
  ]
})

const doc = await render({ title: 'Title Of PDF' })

const bytes = await doc.save()

Existing PDF as source

import { template } from 'pdf-renderer'
import fs from 'fs'

const existingPdfBytes = fs.readFileSync('base.pdf')

const render = template({
  source: existingPdfBytes,
  schema: [
    {
      title: {
        type: 'text',
        x: 0,
        y: 0,
        width: 50,
        height: 50
      }
    }
  ]
})

const doc = await render({ title: 'Title Of PDF' })

const bytes = await doc.save()
1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago