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

QRCode does not show when printed with NgxPrint #57

Open
fadugyamfi opened this issue Apr 22, 2022 · 1 comment
Open

QRCode does not show when printed with NgxPrint #57

fadugyamfi opened this issue Apr 22, 2022 · 1 comment

Comments

@fadugyamfi
Copy link

Similar to the issue reported here https://stackoverflow.com/questions/62400691/using-ngx-print-to-print-ngx-qrcode, the QRCode generated by this library is not visible when attempting to print a page.

The recommended solution per the stackoverflow article was to use toDataURL() and render and image instead of the canvas.

If there is a way to make it work with canvas it would be ideal, but if not, is it possible to update this library to provide the option to render out as an image instead?

@fadugyamfi fadugyamfi changed the title QRCode does not show when printed NgxPrint QRCode does not show when printed with NgxPrint Apr 22, 2022
@mnahkies
Copy link
Owner

Sorry for such a delayed response.

If I print the demo page via the normal browser print function it appears to work fine, and I can see there is an open issue with ngx-print indicating that it does not support canvas selemxmn/ngx-print#105

I think the best solution would be to add support for canvas to the ngx-print library, as this feels like a generally useful enhancement to it that extends beyond the QR Code use case.

I'm open to the idea of supporting rendering to an image here as well, though I'm not 100% sure on the best way to achieve this, as the current implementation is a directive selecting a canvas element, eg:

@Directive({
  // eslint-disable-next-line @angular-eslint/directive-selector
  selector: `canvas[qrCode]`,
})
export class QrCodeDirective implements OnChanges {
...

Would need to have a think about how to do this cleanly, and I'm pretty stretched for time recently.

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

2 participants