Skip to content

verifactu-sdk API


verifactu-sdk API / renderQrPng

Function: renderQrPng()

renderQrPng(url, opts?): Promise<Buffer<ArrayBufferLike>>

Defined in: src/qr/render.ts:93

Render the QR URL as a PNG buffer.

The output uses the binary PNG signature 89 50 4E 47 and embeds the QR at the requested physical size (default 35 mm at 300 DPI ≈ 413 px).

Parameters

url

string

URL produced by buildQrUrl.

opts?

RenderQrOptions

Optional rendering tweaks; see RenderQrOptions.

Returns

Promise<Buffer<ArrayBufferLike>>

A Buffer whose bytes form a complete PNG image.

Throws

If the URL is too long to fit into a QR at level M (the underlying qrcode library propagates its own error in that case).

Example

ts
const url = buildQrUrl({ ... });
const png = await renderQrPng(url, { sizeMm: 30 });
await Bun.write('invoice-qr.png', png);

Released under the MIT license.