Skip navigation
Currently Being Moderated

Free barcode generator?

Jan 30, 2008 12:45 PM

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


 
Replies
  • Currently Being Moderated
    Jan 30, 2008 1:09 PM   in reply to Newsgroup_User
     
    |
    Mark as:
  • Currently Being Moderated
    Jan 31, 2008 5:46 AM   in reply to Newsgroup_User
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 1, 2008 9:53 AM   in reply to Newsgroup_User
    You may be able to get away with Code 39 font at http://www.barcodesinc.com/free-barcode-font/
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2012 10:38 AM   in reply to Newsgroup_User

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2012 11:49 AM   in reply to Newsgroup_User

    Newsgroup_User wrote:

     

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

    Barbecue.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 20, 2012 4:32 AM   in reply to Newsgroup_User

    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">

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 20, 2012 8:56 AM   in reply to BKBK

    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", ""));

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 23, 2013 12:01 PM   in reply to BKBK

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 23, 2013 2:02 PM   in reply to JaumeCM

    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">

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2013 1:52 AM   in reply to BKBK

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2013 6:44 AM   in reply to JaumeCM

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2013 3:29 AM   in reply to Tim Cunningham-ACP

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

    Now I still need to solve my barcode size problems.

    Thanks.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2013 3:34 AM   in reply to BKBK

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2013 9:46 AM   in reply to JaumeCM

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

    Thnaks.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2013 10:50 AM   in reply to JaumeCM

    Very cool.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 20, 2013 7:57 PM   in reply to JaumeCM
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)