- You are here:
- Home
- CodeXchange
- All
- PowerBuilder
- QR Code Generator
QR Code Generator
- Bruce Armstrong
- Code Author
- Away
Less
More
- Posts: 55
3 years 8 months ago - 10 months 1 week ago #341
by Bruce Armstrong
This message has attachments files.
Bruce Armstrong created the code: QR Code Generator
This code sample uses the open source QRCoder .net assembly (
github.com/codebude/QRCoder
). I created a wrapper assembly for that using SnapDevelop, and then a demo project in PowerBuilder 2019 R3 showing how it's used.
Update 07/04/2023: Updated to include sample built with PowerBuilder/SnapDevelop 2022
Update 07/04/2023: Updated to include sample built with PowerBuilder/SnapDevelop 2022
This message has attachments files.
Please log in or register to see it.
Last Edit: 10 months 1 week ago by Bruce Armstrong. Reason: Updated for PowerBuilder 2022
Please Log in or Create an account to join the conversation.
- Fabrizio Viscardi
- Offline
Less
More
- Posts: 3
9 months 8 hours ago - 8 months 4 weeks ago #519
by Fabrizio Viscardi
Fabrizio Viscardi replied the code: QR Code Generator
Hello Gil,
to check your problem I focused my attention on 2019R3 version of QrCodedemo because I have a computer without IDE with 2019R3 Runtime but not any with the 2022R3 version (every PC have IDE installed).
I have created 32 and 64 bits qrcode.exe and I have installed them in such computer with Powerbuilder 2019R3 Runtime (without IDE) + Net Core Runtime 2 + Net Core Runtime 3 + Net Core Framework 4.8 + Windows desktop Runtime 6.
Both exe worked perfectly.
In the folder of destination PC you need only: qrcode64.exe , qrcode64.xml, qrcodedemo.pbd, qrCodeGenerator.dll, qrCoder.dll
But to complete my answer I have added :
" ls_version = lnv_assembly.GetDotNetCoreVersion( )
messagebox ("of_createondemand", ls_version ) " in <<of_createondemand>> function, just to see the version of .Net used.
At runtime (in the P.C. above mentionned):
- running "qrcode32.exe" the version is ".NET Core Runtime (x86) vers. 3.1.9"
- running "qrcode64.exe" the version is "Windows Desktop Runtime (x64) vers. 6.0.11"
I am sorry but I haven't any PC with Pb 2022 R3 runtime installed, without IDE.
to check your problem I focused my attention on 2019R3 version of QrCodedemo because I have a computer without IDE with 2019R3 Runtime but not any with the 2022R3 version (every PC have IDE installed).
I have created 32 and 64 bits qrcode.exe and I have installed them in such computer with Powerbuilder 2019R3 Runtime (without IDE) + Net Core Runtime 2 + Net Core Runtime 3 + Net Core Framework 4.8 + Windows desktop Runtime 6.
Both exe worked perfectly.
In the folder of destination PC you need only: qrcode64.exe , qrcode64.xml, qrcodedemo.pbd, qrCodeGenerator.dll, qrCoder.dll
But to complete my answer I have added :
" ls_version = lnv_assembly.GetDotNetCoreVersion( )
messagebox ("of_createondemand", ls_version ) " in <<of_createondemand>> function, just to see the version of .Net used.
At runtime (in the P.C. above mentionned):
- running "qrcode32.exe" the version is ".NET Core Runtime (x86) vers. 3.1.9"
- running "qrcode64.exe" the version is "Windows Desktop Runtime (x64) vers. 6.0.11"
I am sorry but I haven't any PC with Pb 2022 R3 runtime installed, without IDE.
Last Edit: 8 months 4 weeks ago by Fabrizio Viscardi.
Please Log in or Create an account to join the conversation.
- Marcelo Gil
- Offline
Less
More
- Posts: 8
9 months 17 hours ago #518
by Marcelo Gil
Marcelo Gil replied the code: QR Code Generator
Hello Bruce! I need your help please
I downloaded the QR code generator project and from the PB IDE it works fine generating the QR code. When I deploy the exe to the PC where the PB IDE is not installed, it fails to create the wrapper object that calls the ino_QrCoder.getQrAsBlob method Error: "Object instance does not exist"
On this PC I installed .net 6 runtime and .net framework 4.8 without solving the case. Also copy all the project dlls and the entire BIN folder. What could be wrong?
I downloaded the QR code generator project and from the PB IDE it works fine generating the QR code. When I deploy the exe to the PC where the PB IDE is not installed, it fails to create the wrapper object that calls the ino_QrCoder.getQrAsBlob method Error: "Object instance does not exist"
On this PC I installed .net 6 runtime and .net framework 4.8 without solving the case. Also copy all the project dlls and the entire BIN folder. What could be wrong?
Please Log in or Create an account to join the conversation.
- Bruce Armstrong
- Code Author
- Away
Less
More
- Posts: 55
9 months 6 days ago #516
by Bruce Armstrong
Bruce Armstrong replied the code: QR Code Generator
>>Can this wrapper be imported
Yes
>>and does it work in version P2022 R3?
Yes
Yes
>>and does it work in version P2022 R3?
Yes
Please Log in or Create an account to join the conversation.
- Marcelo Gil
- Offline
Less
More
- Posts: 8
9 months 1 week ago #515
by Marcelo Gil
Marcelo Gil replied the code: QR Code Generator
Hello Bruce! Can this wrapper be imported and does it work in version P2022 R3?
Please Log in or Create an account to join the conversation.
- Bruce Armstrong
- Code Author
- Away
Less
More
- Posts: 55
9 months 3 weeks ago #513
by Bruce Armstrong
Bruce Armstrong replied the code: QR Code Generator
>>But with yours it seems impossible to set the size (with & height), the margin,
For that what I was thinking you could do is put the image in picture in a datawindow. You could then adjust the margins around the picture and also resize the picture. The main issue is that the SetPicture method that I'm using for the PowerBuilder picture control isn't available for a picture object in a datawindow. What you would need to do is save the blob out to a temporary file and then point the picture control in the datawindow to that file.
>>the error level specific for QR code.
Right now I hard code the value for the error level. What you could do is make it a parameter for the method and pass in the value you want.
QRCodeData qRCodeData = qRCodeGenerator.CreateQrCode(qrText, QRCodeGenerator.ECCLevel.Q);
The valid values are L, M, Q or H. github.com/codebude/QRCoder/wiki/How-to-use-QRCoder
I put making those changes (or something similar) on my to do list. But you're likely to get to it yourself quicker than I will if you're comfortable making the changes.
For that what I was thinking you could do is put the image in picture in a datawindow. You could then adjust the margins around the picture and also resize the picture. The main issue is that the SetPicture method that I'm using for the PowerBuilder picture control isn't available for a picture object in a datawindow. What you would need to do is save the blob out to a temporary file and then point the picture control in the datawindow to that file.
>>the error level specific for QR code.
Right now I hard code the value for the error level. What you could do is make it a parameter for the method and pass in the value you want.
QRCodeData qRCodeData = qRCodeGenerator.CreateQrCode(qrText, QRCodeGenerator.ECCLevel.Q);
The valid values are L, M, Q or H. github.com/codebude/QRCoder/wiki/How-to-use-QRCoder
I put making those changes (or something similar) on my to do list. But you're likely to get to it yourself quicker than I will if you're comfortable making the changes.
Please Log in or Create an account to join the conversation.
- Fabrizio Viscardi
- Offline
Less
More
- Posts: 3
9 months 4 weeks ago #512
by Fabrizio Viscardi
Fabrizio Viscardi replied the code: QR Code Generator
Hello Bruce,
thanks for your QR Code Generator. I have compiled, 64 bits, and it works fine, creating correct code also for € (eur) symbol, impossible to have in many other qr code generators.
But with yours it seems impossible to set the size (with & height), the margin, the error level specific for QR code.
Maybe is possible to change the margin? Is it possible to know the Error Level established in the .dll library ?
Thank you very much
Fabrizio Viscardi (Italy)
thanks for your QR Code Generator. I have compiled, 64 bits, and it works fine, creating correct code also for € (eur) symbol, impossible to have in many other qr code generators.
But with yours it seems impossible to set the size (with & height), the margin, the error level specific for QR code.
Maybe is possible to change the margin? Is it possible to know the Error Level established in the .dll library ?
Thank you very much
Fabrizio Viscardi (Italy)
Please Log in or Create an account to join the conversation.
- Bruce Armstrong
- Code Author
- Away
Less
More
- Posts: 55
1 year 4 months ago #460
by Bruce Armstrong
Bruce Armstrong replied the code: QR Code Generator
Remove the second line in the open script. Apparently I am referencing a method there that existed at the time I wrote the demo, but no longer exists in more recent versions of PowerBuilder. In particular, the line you want to remove is:
inv_generator.of_seterrorhandler( this, 'assemblyerror')
inv_generator.of_seterrorhandler( this, 'assemblyerror')
Please Log in or Create an account to join the conversation.
- Bruce Armstrong
- Code Author
- Away
Less
More
- Posts: 55
2 years 11 months ago #386
by Bruce Armstrong
Bruce Armstrong replied the code: QR Code Generator
Hard to tell you what is wrong without a specific error message. For what it's worth though if you try to import a .Net Core library and you've selected .Net Framework as the Framework Type you'll get an error like the attached.
Attachments:
Please Log in or Create an account to join the conversation.
- alberto cardenas
- Offline
Less
More
- Posts: 1
3 years 3 weeks ago #384
by alberto cardenas
alberto cardenas replied the code: QR Code Generator
Hi Bruce,
Thank you the code.
I download the code I try to run in PW 2019 and it marks an error in nvo_qrgenerator it tells me that dotnetobject is not there, I do not know if I am missing something to do, thank you very much in advance
Thank you the code.
I download the code I try to run in PW 2019 and it marks an error in nvo_qrgenerator it tells me that dotnetobject is not there, I do not know if I am missing something to do, thank you very much in advance
Please Log in or Create an account to join the conversation.
Moderators: Appeon Administrator