title: DYMO label JavaScript printing framework
body: <p>My project involves printing patient labels on a Dymo 400 Turbo.  I have installed the latest framework, DYMO.Label.Framework.latest.js, and am trying to use one approach I have found on the web to print the label.  My problem is that the XML was designed for an address label and not a longer patient label.  When I send to the printer it advances past the next label, wasting one.  Plus I want to print the ID not the address or zip code in the bar code.  Anyone have any ideas?</p>
  
  <p>This is my XML:</p>
  
  <pre><code> '&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;RoundRectangle X="0" Y="0" Width="1581" Height="5040" Rx="270" Ry="270" /&gt;\
                          &lt;/DrawCommands&gt;\
                          &lt;ObjectInfo&gt;\
                              &lt;AddressObject&gt;\
                                  &lt;Name&gt;Address&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;&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;HorizontalAlignment&gt;Left&lt;/HorizontalAlignment&gt;\
                                  &lt;VerticalAlignment&gt;Middle&lt;/VerticalAlignment&gt;\
                                  &lt;TextFitMode&gt;ShrinkToFit&lt;/TextFitMode&gt;\
                                  &lt;UseFullFontHeight&gt;True&lt;/UseFullFontHeight&gt;\
                                  &lt;Verticalized&gt;False&lt;/Verticalized&gt;\
                                  &lt;StyledText&gt;\
                                      &lt;Element&gt;\
                                          &lt;Attributes&gt;\
                                              &lt;Font Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" /&gt;\
                                              &lt;ForeColor Alpha="255" Red="0" Green="0" Blue="0" /&gt;\
                                          &lt;/Attributes&gt;\
                                      &lt;/Element&gt;\
                                  &lt;/StyledText&gt;\
                                  &lt;LineFonts&gt;\
                                      &lt;Font Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" /&gt;\
                                      &lt;Font Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" /&gt;\
                                      &lt;Font Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" /&gt;\
                                  &lt;/LineFonts&gt;\
                              &lt;/AddressObject&gt;\
                              &lt;Bounds X="332" Y="150" Width="4455" Height="1260" /&gt;\
                          &lt;/ObjectInfo&gt;\
                      &lt;/DieCutLabel&gt;'
  </code></pre>
  
  <p>I load up the label with this:</p>
  
  <pre><code> var label = dymo.label.framework.openLabelXml(labelXml);
      var labelToPrint = getLabelToPrint();
      if (!label) {
          $("#lblError").text("There is no information entered to print");
          $("#MessageDialog").dialog({ title: "No Information" });
          $("#MessageDialog").dialog("open");
          return;
      }
      if (label.getAddressObjectCount() &gt; 0) {
          var add = label.getAddressText(0);
          label.setAddressText(0, labelToPrint);
      }
      // set data using LabelSet and text markup
      var labelSet = new dymo.label.framework.LabelSetBuilder();
  
      var textMarkup = '';
      var fontSize = 18; // sets font size of first line
  
  
      if (labelToPrint == '') {
          $("#lblError").text("There is no information entered to print");
          $("#MessageDialog").dialog({ title: "No Information" });
          $("#MessageDialog").dialog("open");
          return false;
      }
      else {
          var lines = labelToPrint.split('\n');
          var boldLinesCount = lines.length &lt;= 3 ? 1 : 2;
          for (var x = 0; x &lt; lines.length; x++) {
              textMarkup += lines[x] + '\n';
          }
          //textMarkup += lines[0] + '\n';
          //textMarkup += lines[1] + '\n';
          //textMarkup += lines[2];
          label.setAddressText(0, textMarkup);
          //label.setObjectText("Barcode", lines[0]);
          label.setObjectText("Address", textMarkup);
          var record = labelSet.addRecord();
          record.setTextMarkup('Text', textMarkup); // set label text 
      }
  </code></pre>