1 Reply Latest reply on Nov 18, 2013 4:21 AM by tribule

    How to generate barcode in coldfusion 10?

    maccarulez

      Hi!

       

      Can someone teach or refer to any link to generate barcode in coldfusion 10?

      I did try in cf8 and it works but not in cf10. Please help

        • 1. Re: How to generate barcode in coldfusion 10?
          tribule Level 2

          Hi, we use jQuery. It's very low overhead. Search for jquery-barcode online.

           

          The code is very simple, for example this code (call it index.cfm) generates a barcode from a parameter passed to the page (URL.code) e.g. index.cfm?code=12345

           

          <cfparam name="URL.code" default="12345">

          <html>

          <head>

          <script type="text/javascript" src="jquery-barcode/jquery-1.3.2.min.js"></script>   

          <script type="text/javascript" src="jquery-barcode/jquery-barcode.js"></script> 

          <script language="JavaScript">

          function bc() {

            $('#bcTarget').barcode('<cfoutput>#Trim(URL.code)#</cfoutput>', 'code128', {barHeight:50, barWidth:1, showHRI:true, fontSize: 11});

          }

          </script>

          </head>

          <body onLoad="bc();">

          <div id="bcTarget" style="font-family: arial; font-weight: bold;"></div>

          </body>

          </html>

           

          Using client-side code takes the pressure off the server a bit. There are CF barcode generators too, but they invariably end up using third party  things like ActiveX and/or JavaScript, so jQuery-barcode is worth a look.