Download Ignition QR Code

I have a system in ignition that generates QR codes. So far I have it where the user can create them or delete them on a screen. However, I also want the user to have the ability to download the QR code to print it out. Is there a way I could go about doing it?

You can script something with system.perspective.download. It would require that you generate the QR as an image or pdf and provide the file data to the function call.

how would I go about converting the QR component into an image?

If you have the reporting module you can create a report that uses the same QR code format as the component and call system.report.execute while passing the QR code text/data as a parameter and hand the return from that call to the download call.

If you don't want to use the reporting module then you would need to find out how to generate an image with a barcode on the fly and pass that data to the download call. There are some java libraries out there for generating barcodes/QR codes, but I don't know if Ignition includes them in its standard library.(you can technically add to this library)

You could also accomplish this with the requestPrint action targeting the Component. Though the Reporting Module solution from ryan.white is definitely the cleaner option, as you wouldn't be relying on the browser's interpretation of your view.

2 Likes

You can invoke the requestPrint method from a component reference directly:

This was exactly what I was looking for. Thank you!