TypeScript API / @laikacms/server/oauth2 / generateQRCodeSVG
Function: generateQRCodeSVG()
ts
function generateQRCodeSVG(text, options?): string;Generates an SVG string representation of a QR code for the given text.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | The text to encode in the QR code |
options | QRCodeSVGOptions | Optional configuration for the QR code generation |
Returns
string
An SVG string that can be embedded in HTML or saved to a file
Example
typescript
const svg = generateQRCodeSVG('https://example.com');
// Returns an SVG string with default options
const customSvg = generateQRCodeSVG('Hello World', {
errorCorrection: 'H',
border: 2,
darkColor: '#1a1a1a',
lightColor: '#f5f5f5'
});