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

Can not get svg download to work #365

Open
urban-hostel opened this issue Jul 1, 2024 · 0 comments
Open

Can not get svg download to work #365

urban-hostel opened this issue Jul 1, 2024 · 0 comments

Comments

@urban-hostel
Copy link

I have the issue that I woul like to download the svg fiel but I cant get the code to work

downloadQRCodeAsSVG(event: Event): void {
event.preventDefault();
const qrData = this.qrCodeForm.get('qrCodeResult.customUrl')?.value || '';

if (!qrData) {
  return;
}

QRCode.toString(qrData, { type: 'svg', errorCorrectionLevel: 'medium' }, (err: Error | null, svgString: string) => {
  if (err) {
    console.error('Error generating QR code:', err);
    return;
  }

  const blob = new Blob([svgString], { type: 'image/svg+xml' });
  const url = URL.createObjectURL(blob);
  const link = document.createElement('a');
  link.href = url;
  link.download = 'qr-code.svg';
  link.click();
  URL.revokeObjectURL(url);
});

}

I get the error

Expected 0 arguments, but got 3.ts(2554)
(property) type: string

But to my understanding the arguments are needed or not?

Thank you for you support in advance!
Mike

@urban-hostel urban-hostel changed the title Can get svg download to work Can not get svg download to work Jul 1, 2024
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

No branches or pull requests

1 participant