This commit is contained in:
@@ -37,3 +37,16 @@ export async function renderQrPng(token: string): Promise<string> {
|
||||
width: 256,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Same QR, but as a raw PNG buffer for embedding into pdf-lib documents.
|
||||
* We bump width up so the vector→raster downscale at print time stays crisp;
|
||||
* 512 px at 35 mm = ~370 dpi which beats any office printer we'll see.
|
||||
*/
|
||||
export async function renderQrPngBuffer(token: string, width = 512): Promise<Buffer> {
|
||||
return QRCode.toBuffer(scanUrlForToken(token), {
|
||||
errorCorrectionLevel: "M",
|
||||
margin: 1,
|
||||
width,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user