title: Creating bar code labels with ColdFusion and JavaScript DYMO SDK
body: <p>I am trying to use the DYMO SDK to print bar codes to labels for packages.  I want to be able to create the bar code objects without using the DYMO software.  I am writing this code in ColdFusion.  Right now I have some code to generate the bar code into HTML and display it on the webpage.  However, when I print the label using JavaScript from the DYMO SDK it prints the bar code incorrectly, the value of the barcode is just "unknown".  Anyway, hopefully someone has some experience using this library.  Here is the JavaScript that I am using to print the label:</p>
  
  <pre><code>// prints the label
  printButton.onclick = function () {
      try {
          // open label
          var labelXml = '&lt;?xml version="1.0" encoding="utf-8"?&gt;\
  &lt;DieCutLabel Version="8.0" Units="twips"&gt;\
  &lt;PaperOrientation&gt;Landscape&lt;/PaperOrientation&gt;\
  &lt;Id&gt;Address&lt;/Id&gt;\
  &lt;PaperName&gt;30252 Address&lt;/PaperName&gt;\
  &lt;DrawCommands/&gt;\
  &lt;ObjectInfo&gt;\
  &lt;BarcodeObject&gt;\
  &lt;Name&gt;Barcode&lt;/Name&gt;\
  &lt;ForeColor Alpha="255" Red="0" Green="0" Blue="0" /&gt;\
  &lt;BackColor Alpha="0" Red="255" Green="255" Blue="255" /&gt;\
  &lt;LinkedObjectName&gt;BarcodeText&lt;/LinkedObjectName&gt;\
  &lt;Rotation&gt;Rotation0&lt;/Rotation&gt;\
  &lt;IsMirrored&gt;False&lt;/IsMirrored&gt;\
  &lt;IsVariable&gt;True&lt;/IsVariable&gt;\
  &lt;Text&gt;BARCODE&lt;/Text&gt;\
  &lt;Type&gt;Code39&lt;/Type&gt;\
  &lt;Size&gt;Medium&lt;/Size&gt;\
  &lt;TextPosition&gt;Bottom&lt;/TextPosition&gt;\
  &lt;TextFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" /&gt;\
  &lt;CheckSumFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" /&gt;\
  &lt;TextEmbedding&gt;None&lt;/TextEmbedding&gt;\
  &lt;ECLevel&gt;0&lt;/ECLevel&gt;\
  &lt;HorizontalAlignment&gt;Center&lt;/HorizontalAlignment&gt;\
  &lt;QuietZonesPadding Left="0" Top="0" Right="0" Bottom="0" /&gt;\
  &lt;/BarcodeObject&gt;\
  &lt;Bounds X="332" Y="150" Width="4455" Height="1260" /&gt;\
  &lt;/ObjectInfo&gt;\
  &lt;/DieCutLabel&gt;';
          var label = dymo.label.framework.openLabelXml(labelXml);
  
          // set label text
          label.setObjectText("Barcode", textTextArea.value);
  </code></pre>
  
  <p>This is the code that I am using to generate the barcode:</p>
  
  <pre><code>&lt;cfoutput&gt;
  &lt;!---span style="#Attributes.TextFontTop#"&gt;#Attributes.TextTop#&lt;/span---&gt;
  &lt;div&gt;
  &lt;cfloop index="i" from="1" to="#len(Attributes.InputValue)#"&gt; 
      &lt;span style="border-right:#val(mid(code39[asc(mid(Attributes.InputValue,i,1))],1,1)*(Attributes.BarWidth)+(Attributes.BarWidth/2))#px solid; border-color: black; height: #Attributes.BarHeight#px;margin-bottom:#Attributes.MarginBottom#px;margin-top:#Attributes.MarginTop#px;"&gt;&lt;/span&gt;
      &lt;span style="border-right:#val(mid(code39[asc(mid(Attributes.InputValue,i,1))],6,1)*(Attributes.BarWidth)+(Attributes.BarWidth/2))#px solid; border-color: white; height: #Attributes.BarHeight#px;margin-bottom:#Attributes.MarginBottom#px;margin-top:#Attributes.MarginTop#px;"&gt;&lt;/span&gt;
      &lt;span style="border-right:#val(mid(code39[asc(mid(Attributes.InputValue,i,1))],2,1)*(Attributes.BarWidth)+(Attributes.BarWidth/2))#px solid; border-color: black; height: #Attributes.BarHeight#px;margin-bottom:#Attributes.MarginBottom#px;margin-top:#Attributes.MarginTop#px;"&gt;&lt;/span&gt;
      &lt;span style="border-right:#val(mid(code39[asc(mid(Attributes.InputValue,i,1))],7,1)*(Attributes.BarWidth)+(Attributes.BarWidth/2))#px solid; border-color: white; height: #Attributes.BarHeight#px;margin-bottom:#Attributes.MarginBottom#px;margin-top:#Attributes.MarginTop#px;"&gt;&lt;/span&gt;
      &lt;span style="border-right:#val(mid(code39[asc(mid(Attributes.InputValue,i,1))],3,1)*(Attributes.BarWidth)+(Attributes.BarWidth/2))#px solid; border-color: black; height: #Attributes.BarHeight#px;margin-bottom:#Attributes.MarginBottom#px;margin-top:#Attributes.MarginTop#px;"&gt;&lt;/span&gt;
      &lt;span style="border-right:#val(mid(code39[asc(mid(Attributes.InputValue,i,1))],8,1)*(Attributes.BarWidth)+(Attributes.BarWidth/2))#px solid; border-color: white; height: #Attributes.BarHeight#px;margin-bottom:#Attributes.MarginBottom#px;margin-top:#Attributes.MarginTop#px;"&gt;&lt;/span&gt;
      &lt;span style="border-right:#val(mid(code39[asc(mid(Attributes.InputValue,i,1))],4,1)*(Attributes.BarWidth)+(Attributes.BarWidth/2))#px solid; border-color: black; height: #Attributes.BarHeight#px;margin-bottom:#Attributes.MarginBottom#px;margin-top:#Attributes.MarginTop#px;"&gt;&lt;/span&gt;
      &lt;span style="border-right:#val(mid(code39[asc(mid(Attributes.InputValue,i,1))],9,1)*(Attributes.BarWidth)+(Attributes.BarWidth/2))#px solid; border-color: white; height: #Attributes.BarHeight#px;margin-bottom:#Attributes.MarginBottom#px;margin-top:#Attributes.MarginTop#px;"&gt;&lt;/span&gt;
      &lt;span style="border-right:#val(mid(code39[asc(mid(Attributes.InputValue,i,1))],5,1)*(Attributes.BarWidth)+(Attributes.BarWidth/2))#px solid; border-color: black; height: #Attributes.BarHeight#px;margin-bottom:#Attributes.MarginBottom#px;margin-top:#Attributes.MarginTop#px;"&gt;&lt;/span&gt;
      &lt;span style="border-right:2px solid; border-color: white; height: 50px;margin-bottom:2px;margin-top:2px;"&gt;&lt;/span&gt;   &lt;!--- space between individual codes ---&gt;
  &lt;/cfloop&gt;
  &lt;/div&gt;
  &lt;span style="#Attributes.TextFontBottom#"&gt;#Attributes.TextBottom#&lt;/span&gt;    
  </code></pre>
  
  <p></p>
  
  <p>And this is the test HTML that I am using to display it:</p>
  
  <pre><code>&lt;div id="textTextArea"&gt;
     &lt;CF_barcode39 InputValue="ABCDEFGHIJ" BarWidth="2" BarHeight="50"                                         TextTop="BarWidth=2 BarHeight=50" TextBottom="ABCDEFGHIJ"&gt;
  &lt;/div&gt;
  </code></pre>