Skip to content

verifactu-sdk API


verifactu-sdk API / renderQrDataUrl

Function: renderQrDataUrl()

renderQrDataUrl(url, opts?): Promise<string>

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

Render the QR URL as a data:image/png;base64,... URL.

Useful when the QR needs to be inlined into an HTML/PDF template without touching the filesystem.

Parameters

url

string

URL produced by buildQrUrl.

opts?

RenderQrOptions

Optional rendering tweaks; see RenderQrOptions.

Returns

Promise<string>

A data: URI with the PNG bytes base64-encoded.

Throws

If the URL cannot be encoded at level M.

Example

ts
const url = buildQrUrl({ ... });
const dataUrl = await renderQrDataUrl(url);
// → "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."

Released under the MIT license.