joedfuse
asked on
Coldfusion Code128 barcode problem
Ok so I have to say right off the bat, I don't know much about barcoding. I did manage to get the code working to generate and size the barcode.
My problem is that the barcode width seems to change based on the number of characters in the code. I didn't think this was a problem initially but as I started testing on our equipment I found a pretty big problem.
The barcodes with 4 digits (7512 from my test) scanned perfect with the following code. Barcodes with 5 digits (12206 from my test) will not scan. If you look at the ID's they are in the exact same position on the card. Same distance from the bottom and top. It looks like when i use the 5 digit number its scaling from the middle out. The heights of the barcodes stay the same just the width changes equally on both sides.
Here is the code i use to generate the barcode and I'm wondering is there any way to keep the barcode sizes exactly the same so they will both snap the same. Is there a property i can set for this? Is my code wrong? Anything?
Thanks for your help
My problem is that the barcode width seems to change based on the number of characters in the code. I didn't think this was a problem initially but as I started testing on our equipment I found a pretty big problem.
The barcodes with 4 digits (7512 from my test) scanned perfect with the following code. Barcodes with 5 digits (12206 from my test) will not scan. If you look at the ID's they are in the exact same position on the card. Same distance from the bottom and top. It looks like when i use the 5 digit number its scaling from the middle out. The heights of the barcodes stay the same just the width changes equally on both sides.
Here is the code i use to generate the barcode and I'm wondering is there any way to keep the barcode sizes exactly the same so they will both snap the same. Is there a property i can set for this? Is my code wrong? Anything?
<cfscript>
Barcode = createObject("java", "net.sourceforge.barbecue.linear.code128.Code128Barcode").init(#Participant_ID__c#);
BarcodeImageHandler = createObject("java", "net.sourceforge.barbecue.BarcodeImageHandler");
Barcode.setDrawingText(false);
Barcode.setBarHeight(30);
Barcode.setBarWidth(2);
</cfscript>
<!--- extract the buffered image of the bar code --->
<cfset Handler = createObject("java", "net.sourceforge.barbecue.BarcodeImageHandler")>
<cfset BuffImg = Handler.getImage( Barcode ) />
<!--- use it create a CF image object --->
<cfset CFImageObject = ImageNew(buffImg) />
<!--- do whatever you want with the image object --->
<cfimage source="#CFImageObject#" action="write" overwrite="Yes" destination="C:\inetpub\wwwroot\barcodes\#Participant_ID__c#.jpg">
Thanks for your help
ASKER
Nah, i dont want to buy a tag. Im sure I can figure out something with mine. I mean like I said mine works i just dont understand why the barcode changes sizes due to number of digits
Thanks
Thanks
It looks like when i use the 5 digit number its scaling from the middle out.
Can you test using 6,7,8, and 9 digits? Is there an error on odd versus even digits?
ASKER
I am not receiving any errors. Just width changing depending on the number length. Very strange. No change in height
Could you somehow provide a screenshot of the good and bad barcodes? That might help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I came to similar conclusion and decided it was worth upgrading our hardware since we only need to replace a few scanners.
Yes, it's just the way the encoding works. You can't set explicit dimensions because forcing a bar code fit inside those dimensions might make it invalid according to the specs. It's why the library doesn't offer explicit setWidth/setHeight methods ;-) Since the BBQ library is well established, sounds like the equipment is more likely to be the culprit here.
ASKER
Here is a question i was wondering .... Does the space around the barcode affect scanning? I am noticing even with the new equip it doesn't really like the wide barcode that is closer to other text than the narrow ones.
Thanks
Thanks
@joedfuse - I haven't come across anything that explicitly mentions space tolerances for CODE 128 barcodes, but anything that skews tolerance level can impact your scanning.
The following FedEx document has some good information on UCC/EAN CODE 128 “SSCC-18” specifications
http://images.fedex.com/us/solutions/ppe/FedEx_Ground_Label_Layout_Specification.pdf
This article mentions error tolerance failure in a barcode's quiet zone. A quiet zone is the blank margin on either side of a bar code that's used to tell the barcode reader where a barcode's symbology starts and stops.
http://www.barcode-test.com/barcode-advice/barcode-error-tolerance/
The following FedEx document has some good information on UCC/EAN CODE 128 “SSCC-18” specifications
http://images.fedex.com/us/solutions/ppe/FedEx_Ground_Label_Layout_Specification.pdf
This article mentions error tolerance failure in a barcode's quiet zone. A quiet zone is the blank margin on either side of a bar code that's used to tell the barcode reader where a barcode's symbology starts and stops.
http://www.barcode-test.com/barcode-advice/barcode-error-tolerance/
>> barcode's quiet zone
That's also something you can check. IIRC, quiet zone is enabled by default. Check the dimensions compared to barwidth/height set in code.
That's also something you can check. IIRC, quiet zone is enabled by default. Check the dimensions compared to barwidth/height set in code.
It appears to handle also handle Code128 Character sets as well.