1.6.0 • Published 2 years ago
pdf-renderer v1.6.0
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()