Skip to content

verifactu-sdk API


verifactu-sdk API / renderQrSvg

Function: renderQrSvg() ​

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

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

Render the QR URL as an SVG string.

The returned string starts with <svg and can be embedded directly into HTML or saved as a .svg file. The QR uses the same error-correction level (M) and margin defaults as the PNG renderer.

Parameters ​

url ​

string

URL produced by buildQrUrl.

opts? ​

RenderQrOptions

Optional rendering tweaks; see RenderQrOptions.

Returns ​

Promise<string>

A complete SVG document as a string.

Throws ​

If the URL cannot be encoded at level M.

Example ​

ts
const url = buildQrUrl({ ... });
const svg = await renderQrSvg(url);
await Bun.write('invoice-qr.svg', svg);

Released under the MIT license.