Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support generating svg path only #23

Open
julia-vetcove opened this issue Jan 10, 2022 · 0 comments · May be fixed by #29
Open

support generating svg path only #23

julia-vetcove opened this issue Jan 10, 2022 · 0 comments · May be fixed by #29

Comments

@julia-vetcove
Copy link

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>
);
@leMaik leMaik linked a pull request Jun 19, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant