Hi,
I generated a QR Code with the pe:qrCode tag.
How can I implement a download function for the generated code now?
I would like to download the code by clicking a button.
I can't find a solution for this.
Hope s.o can help me with this.
Thanks.
Download QRCode
I hope you can do this functionality.You can get the canvas URL(with the help of toDataURL) from the QR code component.Then you can convert this URL to PNG file in the server side.Once you got the png file then you can apply the fileDownload component to download the image.
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/
___________________
Sudheer Jonna
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/
___________________
Sudheer Jonna
- cloudwalker78
- Posts: 4
- Joined: 07 Oct 2011, 10:53
Thanks, that solution worked !sudheer wrote:I hope you can do this functionality.You can get the canvas URL(with the help of toDataURL) from the QR code component.Then you can convert this URL to PNG file in the server side.Once you got the png file then you can apply the fileDownload component to download the image.
Now I get the canvas URL with javascript toDataURL() as base64 data:image and send that to the server.
Ther server decodes the base64 string and generates the png InputStream and StreamedContent needed for the filedownload component.
Works perfectly. Thanks.
Primefaces 5.0RC1, Mojarra 2.2.4, JBoss 7.1
Glad to hear it workscloudwalker78 wrote:Thanks, that solution worked !sudheer wrote:I hope you can do this functionality.You can get the canvas URL(with the help of toDataURL) from the QR code component.Then you can convert this URL to PNG file in the server side.Once you got the png file then you can apply the fileDownload component to download the image.
Now I get the canvas URL with javascript toDataURL() as base64 data:image and send that to the server.
Ther server decodes the base64 string and generates the png InputStream and StreamedContent needed for the filedownload component.
Works perfectly. Thanks.
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/
___________________
Sudheer Jonna
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/
___________________
Sudheer Jonna
sudheer wrote:I hope you can do this functionality.You can get the canvas URL(with the help of toDataURL) from the QR code component.Then you can convert this URL to PNG file in the server side.Once you got the png file then you can apply the fileDownload component to download the image.
can anyone post an example of this?
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests