• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Free barcode generator?

LEGEND ,
Jan 30, 2008 Jan 30, 2008

Copy link to clipboard

Copied

Does anyone know of a free or 'cheap' barcode generator that will work with
CF?


Views

11.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 30, 2008 Jan 30, 2008

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 31, 2008 Jan 31, 2008

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 31, 2008 Jan 31, 2008

Copy link to clipboard

Copied

Looks like that is all about making charts? Where is something about
generating barcodes?

"natg504" <webforumsuser@macromedia.com> wrote in message
news:fnsjfp$sv$1@forums.macromedia.com...
> http://www.fusioncharts.com/free/


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 01, 2008 Feb 01, 2008

Copy link to clipboard

Copied

You may be able to get away with Code 39 font at http://www.barcodesinc.com/free-barcode-font/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 12, 2012 Apr 12, 2012

Copy link to clipboard

Copied

also im found Code 128 fully functional barcode generator http://www.mbcestore.com.mx/generador/codigo-de-barras/, just linked to my webservice/CFapp and im request string and return image with barcode very usefull

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2012 Apr 12, 2012

Copy link to clipboard

Copied

Newsgroup_User wrote:

Does anyone know of a free or 'cheap' barcode generator that will work with CF?

Barbecue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 20, 2012 Apr 20, 2012

Copy link to clipboard

Copied

Newsgroup_User wrote:

Does anyone know of a free or 'cheap' barcode generator that will work with CF?

Hello one and all,

ColdFusion can go even one better. You can use the iText library, which currently ships with ColdFusion, to generate barcodes!

Here is a proof of concept:

<cfscript>

codeEAN = createobject("java","com.lowagie.text.pdf.BarcodeEAN");

codeEAN.setCodeType(codeEAN.EAN13);

codeEAN.setCode("4902555131719");

color =  createobject("java","java.awt.Color");

image = codeEAN.createAwtImage(color.black, color.white);

bufferedImage = createObject("java", "java.awt.image.BufferedImage");

bufferedImageType = bufferedImage.TYPE_BYTE_GRAY;

bufferedImage = bufferedImage.init(image.getWidth(JavaCast("null", "")),image.getHeight(JavaCast("null", "")), bufferedImageType);

graphics2D = bufferedImage.createGraphics();

graphics2D.drawImage(image,0,0,JavaCast("null", ""));

barcodeImage = imageNew(bufferedImage);

</cfscript>

<cfimage action="writeToBrowser" source="#barcodeImage#" format="jpg">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Apr 20, 2012 Apr 20, 2012

Copy link to clipboard

Copied

Nice job!  One shortcut you could add is grabbing the graphics object from the CF image instead of creating a new bufferedImage (slight savings). That is a trick I have used in the past:

ie     ...

        width  = image.getWidth(JavaCast("null", ""));

        height = image.getHeight(JavaCast("null", ""));

        cfImage = imageNew("", width, height);

        graphics = ImageGetBufferedImage(cfImage).getGraphics();

        graphics.drawImage(image,0,0,JavaCast("null", ""));

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 23, 2013 Mar 23, 2013

Copy link to clipboard

Copied

Hi BKBK,

Since I found your post I'm looking for documentation on the iText Coldfusion's library sintax. I'll try to generate Code128C barcodes but not found the exact sintax based on your code.

Thanks in advance.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 23, 2013 Mar 23, 2013

Copy link to clipboard

Copied

See the iText API for Barcode.

An example:

<cfscript>

code128= createobject("java","com.lowagie.text.pdf.Barcode128");

code128.setCodeType(code128.CODE128);

/* Set the code to generate */

code128.setCode("0123456789");

color =  createobject("java","java.awt.Color");

image = code128.createAwtImage(color.black, color.white);

bufferedImage = createObject("java", "java.awt.image.BufferedImage");

bufferedImageType = bufferedImage.TYPE_BYTE_GRAY;

bufferedImage = bufferedImage.init(image.getWidth(JavaCast("null", "")),image.getHeight(JavaCast("null", "")), bufferedImageType);

graphics2D = bufferedImage.createGraphics();

graphics2D.drawImage(image,0,0,JavaCast("null", ""));

barcodeImage = imageNew(bufferedImage);

</cfscript>

<!--- Output the code as an image --->

<cfimage action="writeToBrowser" source="#barcodeImage#" format="jpg">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 25, 2013 Mar 25, 2013

Copy link to clipboard

Copied

Great! It works like a charm!

However I don't understand how to apply the API specifications you point me to, to the ColdFusion script.

I try to set the height and the width of the barcode but haven't seen where and how.

If I could take advantage of your knoledge one more time... 😉

Thanks in advance.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 25, 2013 Mar 25, 2013

Copy link to clipboard

Copied

If you ever need QR codes you can use my project on riaforge http://qrtoad.riaforge.org/ It could do barcodes too.. just been too lazy to add it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 27, 2013 Mar 27, 2013

Copy link to clipboard

Copied

It looks great! If I never need QR i will use it.

Now I still need to solve my barcode size problems.

Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 27, 2013 Mar 27, 2013

Copy link to clipboard

Copied

I had a look at the API and I can't see how to set the barcode width. I can set its height with "code128.setBarHeight(x);" but none of the parameters I tried (setX, setN...) seems to affect the overall size of the barcode and, as it gets rendered, it's unusable because the bars are too close to be read once printed.

I don't know where to look further.

If I use Coldfusion's ability to resize the resulting image, the result is too fuzzy because the bars become blured and the barcode reader can't read them properly.

I'm stuck!

Any suggestion will be much appreciated.

Thanks in advance.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 27, 2013 Mar 27, 2013

Copy link to clipboard

Copied

Solved with Barbecue http://barbecue.sourceforge.net   !!

Thnaks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 27, 2013 Mar 27, 2013

Copy link to clipboard

Copied

Very cool.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 20, 2013 Jun 20, 2013

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 08, 2022 Jun 08, 2022

Copy link to clipboard

Copied

<cfimage action="writeToBrowser" source="#barcodeImage#" format="jpg" width="400" height="100">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 09, 2022 Nov 09, 2022

Copy link to clipboard

Copied

I copied the code and it does create a barcode, awesome.  How do you set a varabile for the barcode?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 11, 2022 Nov 11, 2022

Copy link to clipboard

Copied

LATEST
quote

I copied the code and it does create a barcode, awesome.  How do you set a varabile for the barcode?


By @philr3814055

 

A variable has already been set for it. 🙂 The name of the variable is barcodeImage. 

 

For example, if you wished to save the barcode as a Jpeg file, you could do something like this at the end:

 

<!--- Saves barcode to current directory --->
<cfimage action="write" destination="#expandpath('myBarcode.jpg')#" source="#barcodeImage#" 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation