function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Praneetha MurakondaPraneetha Murakonda 

How to split BarCode in visualforce page ?

Hi all,
I'm displaying barcode in vf page using the link https://www.barcodesinc.com/generator_files/image.php?code=T00001111 TS&style=500&type=C128B&width=200&height=50&xres=1&font=3. I'm getting barcoded image as below without any spaces between T0000-1111 TS. 

User-added image

Please let me know if there is any way to split it in to two and display in the same line.

Thanks!

NagendraNagendra (Salesforce Developers) 
Hi Praneetha,

You can use Javascript Barcode Libraries and execute Javascript in your VF Page to accomplish this.
 
There are lots of different Javascript Libraries available, so you'll have to google to find the right library for your barcode type.
 
For Example, for Barcode 39 you can do the following:
 
1. Upload the Javascript Library "Code39.js" from this tutorial website:  
2. Create a VF Page. Execute the Javascript in the JS Library which will generate your Data. Here is an example:
<apex:page standardController="Position__c">
    <apex:includeScript value="{!$Resource.BarcodeScript}"/>
    <apex:detail relatedList="false"></apex:detail>
    <br/>
    <br/>
    <div id="inputdata">{!Position__c.Name}</div>
    <div id="externalbox" style="width:5in"></div>
    <script type="text/javascript">
    /* <![CDATA[ */
      function get_object(id) {
      alert('Executed');
       var object = null;
       if (document.layers) {
        object = document.layers[id];
       } else if (document.all) {
        object = document.all[id];
       } else if (document.getElementById) {
        object = document.getElementById(id);
       }
       return object;
      }
      get_object("inputdata").innerHTML=DrawCode39Barcode(get_object("inputdata").innerHTML,1);
     /* ]]> */
    </script>
</apex:page> 
3. You can see the Barcode is generated on the VF Page.

Thanks,
Nagendra.