Barcode Generator

Share your advanced PureBasic knowledge/code with the community.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Barcode Generator

Post by JHPJHP »

JHPJHP wrote:Either a generic message or "HTTP 400 Bad Request" error will show in the display area; I'll be replacing these with more uniform messages.
Updated:
- status and error messages
- code enhancements and bug fixes
- cosmetic changes

NB*: There may be additional messages that will be added in future updates.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Barcode Generator

Post by JHPJHP »

JHPJHP wrote:With the number of available barcodes, a database of options and text samples will be added at a later date.
Updated:
- added a database of barcode options and text samples to assist with applying the correct settings
- increased the Scaling option to 8
- applied the Scaling option to both Generating and Saving of barcodes

--------------------------------------------------------------

Updated:
- fixed a bug in the Barcode dropdown
- added additional message and error handling
- applied an optimization to the include file barcode.pbi
- applied some minor cosmetic changes

At one point the range for Scale X / Y was set between 1 - 20, but I recently lowered this to 1 - 8 due to Service Temporarily Unavailable messages when set to large. The error message would persist for a few minutes even at the lowest setting, but would eventually clear and accept requests again.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Barcode Generator

Post by JHPJHP »

Updated:
- added an OSX version
-- Barcode_OSX.pb, barcode_OSX.pbi

------------------------------------------------

Updated:
- fixed a bug in the OSX example

NB*: Update also includes minor changes to the Windows version.
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Barcode Generator

Post by RSBasic »

Nice, thank you. Image
Image
Image
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Barcode Generator

Post by wilbert »

#PB_MessageRequester_Warning is unknown on PB 5.42 for OSX.
If I remove that, I can run the app but I keep getting "ERROR: Service Unavailable" when I try to preview a barcode. :?
Windows (x64)
Raspberry Pi OS (Arm64)
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Barcode Generator

Post by JHPJHP »

Hi RSBasic,

Thank you for your comments.

-----------------------------------------------

Hi wilbert,

Thank you for testing the OSX version.

Please download the latest update to see if it solves the problem.
- you may need to remove #PB_MessageRequester_Warning

-----------------------------------------------

Updated:
- increased Scale X / Y max value to 20
- switched from HTTP/1.1 to HTTP/1.0
- moved the ButtonGadget scripts from a BindEvent to the main loop
- various other changes not worth mentioning

Scaling a barcode too large will either return a Time Out or Service Unavailable message.

NB*: Different barcodes may have a different Scale X/ Y threshold; what will work for one barcode may fail with another.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Barcode Generator

Post by wilbert »

JHPJHP wrote:Please download the latest update to see if it solves the problem.
It's generating the barcodes now :)
Windows (x64)
Raspberry Pi OS (Arm64)
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Barcode Generator

Post by JHPJHP »

Hi wilbert,

Thank you for the confirmation.

I've added a small OSX update to remove the border around the barcode (WebGadget) DropDown:

Code: Select all

CocoaMessage(0, CocoaMessage(0, GadgetID(#WebGadget1), "enclosingScrollView"), "setBorderType:", #NSNoBorder)
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Barcode Generator

Post by wilbert »

JHPJHP wrote:I've added a small OSX update to remove the border around the barcode (WebGadget) DropDown:

Code: Select all

CocoaMessage(0, CocoaMessage(0, GadgetID(#WebGadget1), "enclosingScrollView"), "setBorderType:", #NSNoBorder)
Seems to work fine :)
Windows (x64)
Raspberry Pi OS (Arm64)
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Barcode Generator

Post by JHPJHP »

Hi wilbert,

Thank you for testing the code.

-----------------------------------------------------------------------

Updated:
- added a Linux version to the first post (tested in Ubuntu 17.04 :: 64 bit)
- applied some minor bug fixes to all packages

NB*: If you haven't already done so, you will need to install the Linux packages located in Setup/install_files.sh.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Barcode Generator

Post by JHPJHP »

Updated:
- API URL has changed

Additional information can be found here.

----------------------------------------------------------

Updated (Windows):
- image sizes configured to use the built-in PureBasic DPI compiler option
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Barcode Generator

Post by JHPJHP »

Updated:
- added database script
- couple minor improvements
- fixed a few issues

Database Script
Script can be found in the database folder to download the barcode list, replacing the database file.

After some testing I noticed two barcodes that did not work; Data Matrix Rectangular Extension and Royal Mail Mailmark.

I compared the GET string from Barcode Generator with the online generator (bwip-js), and they were identical.

NB*: All three packages were updated; Windows, Linux, and OSX.

Image
Locked