-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Description
hi there! great library. using it in react pdf, which requires us to use its own Svg and Path components. it would be useful to have an option to generate just the path of an svg without anything surrounding it. for reference, currently this is my workaround:
const generateQrCodePath = (content: string, size: number) => {
const htmlStr = new QRCode({ content, join: true, width: size, height: size }).svg({container: 'none'});
const parsableHtml = new DOMParser().parseFromString(htmlStr, 'text/html');
return parsableHtml.querySelector('html > body > rect > path')?.getAttribute('d') ?? '';
};
import QRCode from 'qrcode-svg';
...
// in react pdf
return (
<Svg>
<Path d={generateQrCodePath(content, size)} fill='black' />
</Svg>
);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels