1

I have a web page to print an address label that used to work fine on old DYMO SDK that now prints lines from the textbox in a different order using DYMO Connect SDK. For example below in an aspx textbox Line 1 Line 2 Line 3 Line 4

prints as follows: Line 3 (blank line) Line 1 Line 2 and Line 4 together

Below is the javascript that I am using to print.

    function prtLabel() {
    var textTextArea = document.getElementById('txtLabelText');
    try {
        // open label
        dymo.label.framework.init();

        var labelXml = '<?xml version="1.0" encoding="utf-8"?>\
                    <DieCutLabel Version="8.0" Units="twips">\
                        <PaperOrientation>Landscape</PaperOrientation>\
                        <Id>Address</Id>\
                        <PaperName>30330 Return Address</PaperName>\
                         <DrawCommands>\
                            <RoundRectangle X="0" Y="0" Width="1581" Height="5040" Rx="270" Ry="270" />\
                        </DrawCommands>\
                        <ObjectInfo>\
                            <AddressObject>\
                                <Name>Address</Name>\
                                <ForeColor Alpha="255" Red="0" Green="0" Blue="0" />\
                                <BackColor Alpha="0" Red="255" Green="255" Blue="255" />\
                                <LinkedObjectName></LinkedObjectName>\
                                <Rotation>Rotation0</Rotation>\
                                <IsMirrored>False</IsMirrored>\
                                <IsVariable>True</IsVariable>\
                                <HorizontalAlignment>Left</HorizontalAlignment>\
                                <VerticalAlignment>Middle</VerticalAlignment>\
                                <TextFitMode>ShrinkToFit</TextFitMode>\
                                <UseFullFontHeight>True</UseFullFontHeight>\
                                <Verticalized>False</Verticalized>\
                                <StyledText>\
                                    <Element>\
                                        <String>DYMO\n3 Glenlake Parkway\nAtlanta, GA 30328</String>\
                                        <Attributes>\
                                            <Font Family="Arial" Size="10" Bold="False" Italic="False" Underline="False" Strikeout="False" />\
                                            <ForeColor Alpha="255" Red="0" Green="0" Blue="0" />\
                                        </Attributes>\
                                    </Element>\
                                </StyledText>\
                                <ShowBarcodeFor9DigitZipOnly>False</ShowBarcodeFor9DigitZipOnly>\
                                <BarcodePosition>BelowAddress</BarcodePosition>\
                                <LineFonts>\
                                    <Font Family="Arial" Size="10" Bold="False" Italic="False" Underline="False" Strikeout="False" />\
                                    <Font Family="Arial" Size="10" Bold="False" Italic="False" Underline="False" Strikeout="False" />\
                                    <Font Family="Arial" Size="10" Bold="False" Italic="False" Underline="False" Strikeout="False" />\
                                    <Font Family="Arial" Size="10" Bold="False" Italic="False" Underline="False" Strikeout="False" />\
                                </LineFonts>\
                            </AddressObject>\
                            <Bounds X="332" Y="150" Width="5760" Height="1260" />\
                        </ObjectInfo>\
                    </DieCutLabel>';
        var label = dymo.label.framework.openLabelXml(labelXml);

        // set label text
        label.setObjectText("Address", textTextArea.value);

        // select printer to print on
        // for simplicity sake just use the first LabelWriter printer
        var printers = dymo.label.framework.getPrinters();

        if (printers.length === 0) {
            throw "No DYMO printers are installed. Install DYMO printers.";
        }

        var printerName = "";
        for (var i = 0; i < printers.length; ++i) {
            var printer = printers[i];
            if (printer.printerType === "LabelWriterPrinter") {
                printerName = printer.name;
                break;
            }
        }

        if (printerName == "")
            throw "No LabelWriter printers found. Install LabelWriter printer";

        // finally print the label
        label.print(printerName);

        //close the window
        closeprtwin();
    }
    catch (e) {
        alert(e.message || e);
        closewin();
    }

}

function closeprtwin() {
    window.open('', '_self', '');
    window.close();
}
davidBD
  • 13
  • 3

1 Answers1

1

What's the version you're using?

Have you tried the attribute of "Shrink to fit"?

You can try to edit on the DYMO Connect then transfer to the XML file, then print it to make sure everything is okay.

Will
  • 325
  • 2
  • 9