Skip to content

Core Options

import { PdfEngine } from 'nebula-pdf-engine';
const engine = new PdfEngine({
fonts: [
{ name: 'Inter', data: fontBuffer, weight: 400, style: 'normal' },
],
devicePixelRatio: 2,
assetCache: 'memory', // or 'none'
});
Option Type Description
fonts FontConfig[] Required. At least one font buffer
devicePixelRatio number Optional. PNG scale factor (default 2)
assetCache 'memory' | 'none' Optional. Image cache strategy
imageOptions ImageOptions Optional. Sharp quality / max dimensions
Field Description
name Family name used in styles (fontFamily)
data Buffer or ArrayBuffer of a TTF/OTF file
weight 100900 (default 400)
style 'normal' | 'italic'
const pdf: Buffer = await engine.generate(element, {
title: 'Q1 Statement',
author: 'Billing',
subject: 'Customer statement',
});
Option Description
title PDF metadata title
author PDF metadata author
subject PDF metadata subject

element should be a <Page> or a fragment/wrapper containing one or more <Page>s.