### Get Installed DYMO Printers Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/README.md Retrieves a list of all DYMO printers currently installed on the system. ```javascript dymo.label.framework.getPrinters() //Get list of DYMO printers installed ``` -------------------------------- ### Check DYMO Environment Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Validates that the browser is supported and that the DYMO service is installed and running. Returns an object indicating the environment's readiness and any error details. ```javascript var env = dymo.label.framework.checkEnvironment(); if (!env.isBrowserSupported) { console.error('Browser not supported:', env.errorDetails); } else if (!env.isFrameworkInstalled) { console.error('DYMO framework not installed:', env.errorDetails); } else { console.log('Environment is ready.'); // Safe to proceed with printing } ``` -------------------------------- ### Printer Management Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/README.md Retrieves a list of all installed DYMO printers available on the system. ```APIDOC ## Get Printers ### Description Retrieves a list of all DYMO printers installed on the system. ### Method `dymo.label.framework.getPrinters()` ``` -------------------------------- ### dymo.label.framework.checkEnvironment() Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Validates the browser and DYMO service environment. It checks for browser compatibility and ensures the DYMO service is installed and running, returning an object with environment status details. ```APIDOC ## dymo.label.framework.checkEnvironment() - Validate browser and service environment ### Description Checks that the browser is supported and that the DYMO service is installed and running. Returns an object with `isBrowserSupported`, `isFrameworkInstalled`, and `errorDetails` properties. ### Method `dymo.label.framework.checkEnvironment()` ### Response - **isBrowserSupported** (boolean) - Indicates if the current browser is supported. - **isFrameworkInstalled** (boolean) - Indicates if the DYMO framework is installed and running. - **errorDetails** (string) - Provides details if any environment check fails. ### Code Example ```javascript var env = dymo.label.framework.checkEnvironment(); if (!env.isBrowserSupported) { console.error('Browser not supported:', env.errorDetails); } else if (!env.isFrameworkInstalled) { console.error('DYMO framework not installed:', env.errorDetails); } else { console.log('Environment is ready.'); // Safe to proceed with printing } ``` ``` -------------------------------- ### Get DYMO Label Framework Version Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Retrieves the current version string of the DYMO Label Framework library. Useful for debugging or ensuring compatibility. ```javascript console.log('DYMO Label Framework version:', dymo.label.framework.VERSION); // Expected output: "1.0" ``` -------------------------------- ### Validate Label Instance Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/README.md Validates the current label instance against the installed DYMO service. Use `isDCDLabel` or `isDLSLabel` for specific service validation. ```javascript label.isValidLabel() //Validate if the current content is a valid label based on the current service installed ``` ```javascript label.isDCDLabel() //Validate if the current content is a valid DYMO Connect label based on DYMO Connect service ``` ```javascript label.isDLSLabel() //Validate if the current content is a valid DYMO Label Software label based on DYMO Label Software service ``` -------------------------------- ### getAddressObjectCount Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Gets the number of Address objects on the label. ```APIDOC ## getAddressObjectCount() ### Description Gets the number of Address objects on the label. ### Returns - **number** - The count of Address objects. ``` -------------------------------- ### getAddressObjectCount Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Gets the number of Address objects on the label. ```APIDOC ## getAddressObjectCount ### Description Gets the number of Address objects on the label. ### Method `getAddressObjectCount()` ### Returns * (number) - The count of Address objects. ``` -------------------------------- ### getObjectNames Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Gets an array of object reference names on the label. ```APIDOC ## getObjectNames() ### Description Gets an array of object reference names on the label. Returns an array of strings. ### Returns - **Array** - An array of object names. ``` -------------------------------- ### getObjectNames Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Gets an array of object reference names on the label. ```APIDOC ## getObjectNames ### Description Gets an array of object reference names on the label. ### Method `getObjectNames()` ### Returns * (array) - An array of object names. ``` -------------------------------- ### ILabel.getObjectText Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Gets the current text content of a named object. For Address and Text objects this is plain text; for Barcode objects it is the barcode string; for Image objects it is the base64-encoded PNG stream. ```APIDOC ## `ILabel.getObjectText(objectName)` — Read text from a named label object ### Description Gets the current text content of a named object. For Address and Text objects this is plain text; for Barcode objects it is the barcode string; for Image objects it is the base64-encoded PNG stream. ### Parameters #### Path Parameters - **objectName** (string) - Required - The name of the label object to retrieve text from. ### Request Example ```javascript var label = dymo.label.framework.openLabelXml(labelXml); var names = label.getObjectNames(); names.forEach(function(name) { var value = label.getObjectText(name); console.log(name + ':', value || '(empty)'); }); // Output example: // Name: John Doe // Barcode: 1234567890 // LogoImage: iVBORw0KGgo... (base64 PNG) ``` ### Response #### Success Response (string) - Returns the text content of the specified object. This can be plain text, a barcode string, or a base64-encoded PNG stream for images. ``` -------------------------------- ### dymo.label.framework.init() Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Initializes the DYMO Label Framework and establishes a connection to the locally running DYMO service. This function must be called before any other framework functions. ```APIDOC ## dymo.label.framework.init() - Initialize the framework ### Description Initializes the DYMO Label Framework and establishes the connection to the locally running DYMO service. Must be called before any other framework function. ### Method `dymo.label.framework.init()` ### Code Example ```javascript dymo.label.framework.init(); ``` ``` -------------------------------- ### Build Tape Printer Print Parameters with dymo.label.framework.createTapePrintParamsXml Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Creates XML for Tape printer settings like alignment and cut mode. Requires finding a TapePrinter and then calling dymo.label.framework.printLabel. ```javascript var tapeParams = dymo.label.framework.createTapePrintParamsXml({ copies: 1, jobTitle: 'File Folder Labels', flowDirection: dymo.label.framework.FlowDirection.LeftToRight, alignment: dymo.label.framework.TapeAlignment.Center, cutMode: dymo.label.framework.TapeCutMode.AutoCut }); var tapePrinter = null; var printers = dymo.label.framework.getPrinters(); for (var i = 0; i < printers.length; i++) { if (printers[i].printerType === 'TapePrinter') { tapePrinter = printers[i]; break; } } if (tapePrinter) { dymo.label.framework.printLabel(tapePrinter.name, tapeParams, labelXml, ''); } ``` -------------------------------- ### getObjectText Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Gets the 'text' content of an object. ```APIDOC ## getObjectText(objectName) ### Description Gets the 'text' content of an object. The content depends on the object type. Address and Text objects - Returns the object text without formatting. Barcode object - Returns the barcode string. Image - Returns the base64-encoded string on the image's PNG stream (only if image data is embedded with the label and not linked to a URL or file). Circular Text object - Returns the object text. Other objects - Returns an empty string. ### Parameters #### Path Parameters - **objectName** (string) - Required - The name of the object. ### Returns - **string** - The text content of the object. ``` -------------------------------- ### getObjectText Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Gets the 'text' content of an object. ```APIDOC ## getObjectText ### Description Gets the 'text' content of an object. ### Method `getObjectText(objectName)` ### Parameters * **objectName** (string) - The name of the object. ### Returns * (string) - The text content of the object. ``` -------------------------------- ### Initialization and Environment Check Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/README.md Initializes the DYMO Label Framework and checks if the current environment meets the necessary requirements for operation. ```APIDOC ## Initialize DYMO Label Framework ### Description Initializes the DYMO Label Framework. ### Method `dymo.label.framework.init()` ## Check Environment ### Description Validates if the environment meets the requirements for DYMO Label Framework. ### Method `dymo.label.framework.checkEnvironment()` ``` -------------------------------- ### getAddressText Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Gets the text content of an Address object. ```APIDOC ## getAddressText(addressIndex) ### Description Gets the text content of an Address object. ### Parameters #### Path Parameters - **addressIndex** (number) - Required - The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. ### Returns - **string** - The plain text from the Address object. ``` -------------------------------- ### Initialize DYMO Label Framework Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/README.md Initializes the DYMO Label Framework. This is a prerequisite for using other framework functions. ```javascript dymo.label.framework.init() //Initialize DYMO Label Framework ``` -------------------------------- ### Initialize DYMO Label Framework Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Initializes the DYMO Label Framework and establishes a connection to the locally running DYMO service. This function must be called before any other framework function. ```javascript dymo.label.framework.init(); ``` -------------------------------- ### dymo.label.framework.openLabelFile Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Loads label content synchronously from a full local file path or absolute URL and returns an ILabel instance. Prefer openLabelXml for web applications; use this only when direct file-system access is required. ```APIDOC ## `dymo.label.framework.openLabelFile(fileName)` — Load a label from a file path or URL ### Description Loads label content synchronously from a full local file path or absolute URL and returns an `ILabel` instance. Prefer `openLabelXml` for web applications; use this only when direct file-system access is required. ### Parameters #### Path Parameters - **fileName** (string) - Required - The full local file path or absolute URL of the label file. ### Request Example ```javascript // Windows local file var label = dymo.label.framework.openLabelFile('C:\Users\JohnDoe\Desktop\shipping.label'); // Or from an absolute URL var labelFromUrl = dymo.label.framework.openLabelFile('http://intranet.corp/labels/product.label'); console.log('Loaded label XML snippet:', labelFromUrl.getLabelXml().substring(0, 200)); ``` ### Response #### Success Response (ILabel) - Returns an `ILabel` instance representing the loaded label. ``` -------------------------------- ### getAddressText Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Gets the text content of an Address object. ```APIDOC ## getAddressText ### Description Gets the text content of an Address object. ### Method `getAddressText(addressIndex)` ### Parameters * **addressIndex** (number) - The index of the Address object. ### Returns * (string) - The text content of the Address object. ``` -------------------------------- ### Build Label Render Parameters with dymo.label.framework.createLabelRenderParamsXml Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Creates XML for render parameters to control preview PNG appearance, including colors, shadow, resolution, and flow direction. Used with dymo.label.framework.renderLabel. ```javascript // High-quality render with shadow for right-to-left content var renderParams = dymo.label.framework.createLabelRenderParamsXml({ labelColor: { r: 255, g: 255, b: 224, a: 255 }, // light yellow background shadowColor: { r: 100, g: 100, b: 100, a: 200 }, shadowDepth: 4, flowDirection: dymo.label.framework.FlowDirection.RightToLeft, pngUseDisplayResolution: false // printer resolution for high-quality zoom }); var png = dymo.label.framework.renderLabel(labelXml, renderParams, ''); document.getElementById('preview').src = 'data:image/png;base64,' + png; ``` -------------------------------- ### dymo.label.framework.openLabelXml(labelXml) Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Loads a label template from an XML string. This is the preferred method for loading labels, returning an `ILabel` instance that can be further manipulated and validated. ```APIDOC ## dymo.label.framework.openLabelXml(labelXml) - Load a label from an XML string ### Description The preferred way to load a label. Parses the XML string and returns an `ILabel` instance for further manipulation. Use `XMLHttpRequest` or `fetch` to retrieve the XML from a server. ### Method `dymo.label.framework.openLabelXml(labelXml)` ### Parameters #### Path Parameters - **labelXml** (string) - Required - The XML content of the label template. ### Response - **ILabel** - An object representing the loaded label. - **isValidLabel()** - Returns true if the label is valid for the current DYMO service. - **isDCDLabel()** - Returns true if the label is compatible with DYMO Connect Software. - **isDLSLabel()** - Returns true if the label is compatible with DYMO Label Software. - **getObjectNames()** - Returns an array of names of the objects on the label. ### Request Example ```javascript var xhr = new XMLHttpRequest(); xhr.open('GET', '/labels/address.label', false); // synchronous for simplicity xhr.send(); if (xhr.status === 200) { var label = dymo.label.framework.openLabelXml(xhr.responseText); // Validate for the currently running DYMO service console.log('Valid label:', label.isValidLabel()); console.log('DCD label:', label.isDCDLabel()); console.log('DLS label:', label.isDLSLabel()); // Inspect named objects on the label var objectNames = label.getObjectNames(); console.log('Label objects:', objectNames); // e.g. ["Name", "Address", "City", "Barcode"] } else { console.error('Failed to load label XML'); } ``` ``` -------------------------------- ### getAddressBarcodePosition Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Gets the Intelligent Mail barcode position for an Address object. ```APIDOC ## getAddressBarcodePosition(addressIndex) ### Description Gets the Intelligent Mail barcode position for an Address object. Returns a string with one of the values defined by the [dymo.label.framework.AddressBarcodePosition](../symbols/dymo.label.framework.html#.AddressBarcodePosition) enumeration. ### Parameters #### Path Parameters - **addressIndex** (number) - Required - The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. ### Returns - **AddressBarcodePosition** - The barcode position. ``` -------------------------------- ### Load Label from File Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/README.md Loads a label from a specified file name and returns a label instance. Ensure the file path is correct. ```javascript dymo.label.framework.openLabelFile(fileName) //Load label from file name and return label instance ``` -------------------------------- ### getAddressBarcodePosition Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Gets the Intelligent Mail barcode position for an Address object. ```APIDOC ## getAddressBarcodePosition ### Description Gets the Intelligent Mail barcode position for an Address object. ### Method `getAddressBarcodePosition(addressIndex)` ### Parameters * **addressIndex** (number) - The index of the Address object. ### Returns * (object) - The position of the Intelligent Mail barcode. ``` -------------------------------- ### Render Label Preview Image with dymo.label.framework.renderLabel Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Generates a base64-encoded PNG string for in-browser label preview. Requires label XML, render parameters, and a printer name. ```javascript var label = dymo.label.framework.openLabelXml(labelXml); label.setObjectText('ProductName', 'Widget Pro 3000'); label.setObjectText('Price', '$49.99'); var renderParams = dymo.label.framework.createLabelRenderParamsXml({ labelColor: { r: 255, g: 255, b: 255, a: 255 }, shadowColor: { r: 180, g: 180, b: 180, a: 128 }, shadowDepth: 2, pngUseDisplayResolution: true, flowDirection: dymo.label.framework.FlowDirection.LeftToRight }); var printerName = dymo.label.framework.getPrinters()[0].name; var pngData = dymo.label.framework.renderLabel(label.getLabelXml(), renderParams, printerName); var previewImg = document.getElementById('labelPreview'); previewImg.src = 'data:image/png;base64,' + pngData; // Expected: displays a rasterized preview of the label ``` -------------------------------- ### render Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Creates a label raster image that can be used for label previewing. ```APIDOC ## render ### Description Creates a label raster image that can be used for label previewing. ### Method `render(renderParamsXml, printerName)` ### Parameters * **renderParamsXml** (string) - XML string containing rendering parameters. * **printerName** (string) - The name of the printer. ### Returns * (object) - A raster image object for previewing. ``` -------------------------------- ### render Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Creates a label raster image that can be used for label previewing. ```APIDOC ## render(renderParamsXml, printerName) ### Description Creates a label raster image that can be used for label previewing. ### Parameters #### Path Parameters - **renderParamsXml** (string) - Required - Rendering parameters, such as shadow depth, label color, etc. See [LabelRenderParams.xsd](http://labelwriter.com/software/dls/sdk/LabelRenderParams.xsd). - **printerName** (string) - Required - The name of the printer that the preview is generated for. The preview/output can be different for different printers, especially for tape printers with different print head sizes. If it is not important what printer the label is printed to, an empty string can be passed. In this case, the default printer metrics will be used. The default is LW400 for LabelWriter printers and LW400 DUO Tape for tape printers. ### Returns - **string** - The raster image data. ``` -------------------------------- ### renderLabel Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.html Creates a label raster image for previewing, returned as a base64-encoded PNG stream. ```APIDOC ## renderLabel(labelXml, renderParamsXml, printerName) ### Description Creates a label raster image that can be used for label previewing. Returns a string that is a base64-encoded PNG stream of the label image. This string can be used as data: url for an img element. ### Parameters #### Path Parameters - **labelXml** (string) - Required - Label to preview. - **renderParamsXml** (string) - Required - The rendering parameters, such as shadow depth, label color, etc. See [LabelRenderParams.xsd](http://labelwriter.com/software/dls/sdk/LabelRenderParams.xsd). - **printerName** (string) - Required - The name of the printer that the preview is generated for. If it is not important what printer the label is printed to, an empty string can be passed. In this case, the default printer metrics will be used. ### Returns - **string** - A base64-encoded PNG stream of the label image. ``` -------------------------------- ### Build LabelWriter Print Parameters with dymo.label.framework.createLabelWriterPrintParamsXml Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Creates XML for LabelWriter print settings like copy count, quality, and roll selection. Used with dymo.label.framework.printLabel. ```javascript var printParams = dymo.label.framework.createLabelWriterPrintParamsXml({ copies: 3, jobTitle: 'Inventory Labels', flowDirection: dymo.label.framework.FlowDirection.LeftToRight, printQuality: dymo.label.framework.LabelWriterPrintQuality.Auto, twinTurboRoll: dymo.label.framework.TwinTurboRoll.Auto }); // printParams is an XML string like: // 3Inventory Labels... dymo.label.framework.printLabel( dymo.label.framework.getPrinters()[0].name, printParams, labelXml, '' ); ``` -------------------------------- ### `dymo.label.framework.createLabelRenderParamsXml(params)` — Build label render parameters Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Creates the XML string for `renderParamsXml` to control how the preview PNG is rendered (colors, shadow, resolution, flow direction). ```APIDOC ## `dymo.label.framework.createLabelRenderParamsXml(params)` ### Description Creates the XML string for `renderParamsXml` to control how the preview PNG is rendered (colors, shadow, resolution, flow direction). ### Parameters - **params** (object) - An object containing render parameters. - **labelColor** (object) - The color of the label background. Should have `r`, `g`, `b`, `a` properties (0-255). - **shadowColor** (object) - The color of the shadow. Should have `r`, `g`, `b`, `a` properties (0-255). - **shadowDepth** (number) - The depth of the shadow. - **flowDirection** (dymo.label.framework.FlowDirection) - The flow direction for the label content. - **pngUseDisplayResolution** (boolean) - Whether to use display resolution for the PNG. ### Request Example ```javascript // High-quality render with shadow for right-to-left content var renderParams = dymo.label.framework.createLabelRenderParamsXml({ labelColor: { r: 255, g: 255, b: 224, a: 255 }, // light yellow background shadowColor: { r: 100, g: 100, b: 100, a: 200 }, shadowDepth: 4, flowDirection: dymo.label.framework.FlowDirection.RightToLeft, pngUseDisplayResolution: false // printer resolution for high-quality zoom }); var png = dymo.label.framework.renderLabel(labelXml, renderParams, ''); document.getElementById('preview').src = 'data:image/png;base64,' + png; ``` ### Response - **renderParamsXml** (string) - XML string for label render parameters. ``` -------------------------------- ### Read Text from Named Label Objects Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Gets the current text content of a named object. For Address and Text objects this is plain text; for Barcode objects it is the barcode string; for Image objects it is the base64-encoded PNG stream. ```javascript var label = dymo.label.framework.openLabelXml(labelXml); ``` ```javascript var names = label.getObjectNames(); ``` ```javascript names.forEach(function(name) { var value = label.getObjectText(name); console.log(name + ':', value || '(empty)'); }); ``` -------------------------------- ### Static Print Function for Labels Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt An alternative to `ILabel.print()`. Accepts raw label XML string directly and supports batch printing via `labelSetXml`. Retrieves printer name and creates print parameters. ```javascript var labelXml = document.getElementById('labelXmlTextArea').value; ``` ```javascript var printParams = dymo.label.framework.createLabelWriterPrintParamsXml({ copies: 1, jobTitle: 'Name Badge' }); ``` ```javascript var printerName = dymo.label.framework.getPrinters()[0].name; ``` ```javascript dymo.label.framework.printLabel(printerName, printParams, labelXml, ''); ``` -------------------------------- ### `dymo.label.framework.createTapePrintParamsXml(params)` — Build Tape printer print parameters Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Creates the XML string for `printParamsXml` controlling Tape-printer-specific settings such as alignment and cut mode. ```APIDOC ## `dymo.label.framework.createTapePrintParamsXml(params)` ### Description Creates the XML string for `printParamsXml` controlling Tape-printer-specific settings such as alignment and cut mode. ### Parameters - **params** (object) - An object containing print parameters. - **copies** (number) - Number of copies to print. - **jobTitle** (string) - Title of the print job. - **flowDirection** (dymo.label.framework.FlowDirection) - The flow direction for the label content. - **alignment** (dymo.label.framework.TapeAlignment) - The alignment setting for the tape. - **cutMode** (dymo.label.framework.TapeCutMode) - The cut mode for the tape. ### Request Example ```javascript var tapeParams = dymo.label.framework.createTapePrintParamsXml({ copies: 1, jobTitle: 'File Folder Labels', flowDirection: dymo.label.framework.FlowDirection.LeftToRight, alignment: dymo.label.framework.TapeAlignment.Center, cutMode: dymo.label.framework.TapeCutMode.AutoCut }); var tapePrinter = null; var printers = dymo.label.framework.getPrinters(); for (var i = 0; i < printers.length; i++) { if (printers[i].printerType === 'TapePrinter') { tapePrinter = printers[i]; break; } } if (tapePrinter) { dymo.label.framework.printLabel(tapePrinter.name, tapeParams, labelXml, ''); } ``` ### Response - **tapeParamsXml** (string) - XML string for Tape printer print parameters. ``` -------------------------------- ### print Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Prints the label. ```APIDOC ## print ### Description Prints the label. ### Method `print(printerName, printParamsXml, labelSetXml)` ### Parameters * **printerName** (string) - The name of the printer. * **printParamsXml** (string) - XML string containing print parameters. * **labelSetXml** (string) - XML string representing the label set. ``` -------------------------------- ### print Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.ILabel.html Prints the label. ```APIDOC ## print(printerName, printParamsXml, labelSetXml) ### Description Prints the label. ### Parameters #### Path Parameters - **printerName** (string) - Required - The name of the printer to print to. A list of printers can be obtained using dymo.label.framework.getPrinters. - **printParamsXml** (string) - Required - The print parameters, such as number of copies, print quality, etc. See [PrintParams.xsd](http://labelwriter.com/software/dls/sdk/PrintParams.xsd). - **labelSetXml** (string) - Required - The LabelSet to print. LabelSet is used to print multiple labels with the same layout, but with different data, such as multiple addresses. Use the [dymo.label.framework.LabelSetBuilder](../symbols/dymo.label.framework.LabelSetBuilder.html) class to create a LabelSet or construct XML manualy according to [LabelSet.xsd](http://labelwriter.com/software/dls/sdk/LabelSet.xsd). ``` -------------------------------- ### openLabelFile Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.html Loads label content from a specified file or URL. ```APIDOC ## openLabelFile ### Description Loads label content from a file or URL. ### Method Static method of the dymo.label.framework namespace. ### Parameters - **fileName** (string) - The path or URL to the label file. ``` -------------------------------- ### Include DYMO Connect Framework Script Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Include the framework script in your HTML page before calling any API methods. You can use the version from the GitHub repository or the QA CDN. ```html ``` ```html ``` -------------------------------- ### openLabelFile Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.html Loads label content from a file or URL. It's recommended to use openLabelXml instead for most cases. ```APIDOC ## openLabelFile(fileName) ### Description Loads label content from a file or URL. The full file name or URL should be specified. The content is loaded synchronously. ### Parameters #### Path Parameters - **fileName** (string) - Required - FileName or URL to load label from. ### Returns - **ILabel** - Label object; provides label manipulation methods. ``` -------------------------------- ### checkEnvironment Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.html Verifies if the current browser environment is suitable for the DYMO Label Framework to operate correctly. ```APIDOC ## checkEnvironment ### Description Checks that the browser environment is suitable for the Framework. ### Method Static method of the dymo.label.framework namespace. ### Returns - (object) An object with the following properties: - **isBrowserSupported** {boolean} Indicates whether the browser is supported or not. - **isFrameworkInstalled** {boolean} Indicates whether the Framework is installed or not. - **errorDetails** {string} An empty string if no error is detected; an error message if an error is detected. ``` -------------------------------- ### Load Label from File or URL Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Loads label content synchronously from a local file path or an absolute URL. Prefer `openLabelXml` for web applications; use this only when direct file-system access is required. ```javascript var label = dymo.label.framework.openLabelFile('C:\\Users\\JohnDoe\\Desktop\\shipping.label'); ``` ```javascript var labelFromUrl = dymo.label.framework.openLabelFile('http://intranet.corp/labels/product.label'); ``` ```javascript console.log('Loaded label XML snippet:', labelFromUrl.getLabelXml().substring(0, 200)); ``` -------------------------------- ### PrinterInfo Constructor Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.PrinterInfo.html The PrinterInfo object is returned by dymo.label.framework.getPrinters and contains details about a specific printer. ```APIDOC ## dymo.label.framework.PrinterInfo() ### Description Represents information about a DYMO printer. ### Method Constructor ### Endpoint N/A (Object constructor) ### Parameters None ``` -------------------------------- ### dymo.label.framework.loadImageAsPngBase64 — Load an image as a base64 PNG string Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Loads any supported image format from a URL or local file path and returns it as a base64-encoded PNG string. The result can be passed to `ILabel.setObjectText()` or `ILabelSetRecord.setBase64Image()`. ```APIDOC ## `dymo.label.framework.loadImageAsPngBase64(imageUri)` — Load an image as a base64 PNG string Loads any supported image format from a URL or local file path and returns it as a base64-encoded PNG string. The result can be passed to `ILabel.setObjectText()` or `ILabelSetRecord.setBase64Image()`. ```javascript // Load a local image and embed it on the label var base64Logo = dymo.label.framework.loadImageAsPngBase64('C:\\Logos\\company_logo.png'); var label = dymo.label.framework.openLabelXml(labelXml); label.setObjectText('CompanyLogo', base64Logo); // Or load from a URL var base64Web = dymo.label.framework.loadImageAsPngBase64('https://example.com/badge.png'); label.setObjectText('BadgeImage', base64Web); label.print(dymo.label.framework.getPrinters()[0].name, '', ''); ``` ``` -------------------------------- ### dymo.label.framework.printLabel Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Alternative to ILabel.print(). Accepts the raw label XML string directly and supports batch printing via labelSetXml. ```APIDOC ## `dymo.label.framework.printLabel(printerName, printParamsXml, labelXml, labelSetXml)` — Static print function ### Description Alternative to `ILabel.print()`. Accepts the raw label XML string directly and supports batch printing via `labelSetXml`. ### Parameters #### Path Parameters - **printerName** (string) - Required - The name of the printer to send the label to. - **printParamsXml** (string) - Optional - XML string containing print parameters. Use `dymo.label.framework.createLabelWriterPrintParamsXml` or similar helpers to build this. - **labelXml** (string) - Required - The raw XML string of the label to be printed. - **labelSetXml** (string) - Optional - XML string for label set configurations, used for batch printing. Typically an empty string for single label printing. ### Request Example ```javascript var labelXml = document.getElementById('labelXmlTextArea').value; var printParams = dymo.label.framework.createLabelWriterPrintParamsXml({ copies: 1, jobTitle: 'Name Badge' }); var printerName = dymo.label.framework.getPrinters()[0].name; dymo.label.framework.printLabel(printerName, printParams, labelXml, ''); ``` ### Response #### Success Response (void) - This method does not return a value upon successful submission of the print job. ``` -------------------------------- ### dymo.label.framework.checkEnvironment Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.html Checks if the current browser environment is suitable for the DYMO Label Framework to operate correctly. ```APIDOC ## checkEnvironment() ### Description Checks that the browser environment is suitable for the Framework. ### Method static ### Endpoint dymo.label.framework.checkEnvironment ### Parameters None ### Response None explicitly documented. ``` -------------------------------- ### Render Label Preview Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/README.md Generates a preview image of a label based on its XML content and rendering parameters. Can specify a target printer for accurate rendering. ```javascript dymo.label.framework.renderLabel(labelXml, renderParamsXml, printerName) //Get label preview image of the label ``` -------------------------------- ### `dymo.label.framework.renderLabel(labelXml, renderParamsXml, printerName)` — Generate a label preview image Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Renders the label and returns a base64-encoded PNG string that can be set as the `src` of an `` element for in-browser preview. ```APIDOC ## `dymo.label.framework.renderLabel(labelXml, renderParamsXml, printerName)` ### Description Renders the label and returns a base64-encoded PNG string that can be set as the `src` of an `` element for in-browser preview. ### Parameters - **labelXml** (string) - XML definition of the label. - **renderParamsXml** (string) - XML string for render parameters. - **printerName** (string) - Name of the printer to render for (can be empty). ### Request Example ```javascript var labelXml = '... var renderParams = dymo.label.framework.createLabelRenderParamsXml({ labelColor: { r: 255, g: 255, b: 255, a: 255 }, shadowColor: { r: 180, g: 180, b: 180, a: 128 }, shadowDepth: 2, pngUseDisplayResolution: true, flowDirection: dymo.label.framework.FlowDirection.LeftToRight }); var printerName = dymo.label.framework.getPrinters()[0].name; var pngData = dymo.label.framework.renderLabel(labelXml, renderParams, printerName); var previewImg = document.getElementById('labelPreview'); previewImg.src = 'data:image/png;base64,' + pngData; ``` ### Response - **pngData** (string) - Base64-encoded PNG string of the label preview. ``` -------------------------------- ### Check Environment Requirements Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/README.md Validates if the current environment meets the necessary requirements for the DYMO framework to function correctly. ```javascript dymo.label.framework.checkEnvironment() // Validate if the environment meets the requirements ``` -------------------------------- ### openLabelXml Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.html Loads label content from an XML string. This is the preferred method for loading label files. ```APIDOC ## openLabelXml(labelXml) ### Description Loads label content from an XML stream/string. This is the preferred way to load/open label files. Use XMLHttpRequest() or other standard browser methods to get XML string. ### Parameters #### Path Parameters - **labelXml** (string) - Required - The label definition as an XML string. ### Returns - **ILabel** - Label object. ``` -------------------------------- ### createTapePrintParamsXml Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.html Generates an XML string for print parameters tailored for tape printers, to be used with the printLabel function. ```APIDOC ## createTapePrintParamsXml ### Description Creates an XML string suitable to pass to the [dymo.label.framework.printLabel](../symbols/dymo.label.framework.html#.printLabel) function as printParamsXml parameter. ### Method Static method of the dymo.label.framework namespace. ### Parameters - **params** (object) - An object containing print parameters for tape printers. ``` -------------------------------- ### Batch Print Multiple Labels with LabelSetBuilder Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Constructs a multi-record dataset for printing multiple labels in a single print job. Use when you need to print a series of labels with different data from a collection. ```javascript var label = dymo.label.framework.openLabelXml(labelXml); // Data to print var contacts = [ { Name: 'Alice Johnson', Company: 'TechCorp', Phone: '555-0101' }, { Name: 'Bob Williams', Company: 'DesignHub', Phone: '555-0202' }, { Name: 'Carol Davis', Company: 'StartupXYZ',Phone: '555-0303' } ]; // Build the LabelSet using the builder var labelSetBuilder = new dymo.label.framework.LabelSetBuilder(); contacts.forEach(function(contact) { var record = labelSetBuilder.addRecord(); record.setText('Name', contact.Name) .setText('Company', contact.Company) .setText('Phone', contact.Phone); }); var labelSetXml = labelSetBuilder.toString(); // Alternatively, use the static helper with plain record objects var rawRecords = contacts.map(function(c) { return c; }); var labelSetXmlStatic = dymo.label.framework.LabelSetBuilder.toXml(rawRecords); // Print all three labels in one job var printParams = dymo.label.framework.createLabelWriterPrintParamsXml({ copies: 1 }); var printerName = dymo.label.framework.getPrinters()[0].name; dymo.label.framework.printLabel(printerName, printParams, label.getLabelXml(), labelSetXml); // Expected: 3 labels printed, one per contact record ``` -------------------------------- ### createTapePrintParamsXml Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/doc/JavaScript/symbols/dymo.label.framework.html Generates an XML string for print parameters intended for Tape printers. This XML is used with the `dymo.label.framework.printLabel` function. ```APIDOC ## createTapePrintParamsXml ### Description Creates an XML string suitable to pass to the `dymo.label.framework.printLabel` function as `printParamsXml` parameter. Created print parameters are for printing to Tape printers. ### Method `dymo.label.framework.createTapePrintParamsXml(params)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **params** (object) - Required - A JavaScript object with properties to configure print settings. * **params.copies** (number) - Optional - The number of copies to print. * **params.jobTitle** (string) - Optional - The print job title/description. * **params.flowDirection** (dymo.label.framework.FlowDirection) - Optional - The direction of the label content (left-to-right or right-to-left). * **params.alignment** (dymo.label.framework.TapeAlignment) - Optional - The label alignment on the tape. * **params.cutMode** (dymo.label.framework.TapeCutMode) - Optional - The cut mode (if auto-cut is supported by the printer). ### Request Example ```json { "params": { "copies": 1, "jobTitle": "Address Label", "flowDirection": "RightToLeft", "alignment": "Center", "cutMode": "AutoCut" } } ``` ### Response #### Success Response (200) * **(string)** - An XML string representing the print parameters. ``` -------------------------------- ### Printing a Label Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/README.md Initiates the printing process for a label, with options for specifying the printer, print parameters, and label content. ```APIDOC ## Print Label ### Description Prints a label to a specified DYMO printer with given parameters. ### Method `dymo.label.framework.printLabel(printerName, printParamsXml, labelXml, labelSetXml)` ### Parameters #### Path Parameters - **printerName** (string) - Required - The name of the printer to use. - **printParamsXml** (string) - Required - XML string containing print parameters. - **labelXml** (string) - Required - XML string representing the label content. - **labelSetXml** (string) - Optional - XML string representing a label set, if applicable. ``` -------------------------------- ### Label Preview Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/README.md Generates a preview image of a label based on its XML content and rendering parameters. ```APIDOC ## Render Label for Preview ### Description Generates a preview image of a label. ### Method `dymo.label.framework.renderLabel(labelXml, renderParamsXml, printerName)` ### Parameters #### Path Parameters - **labelXml** (string) - Required - The XML content of the label. - **renderParamsXml** (string) - Required - XML string containing rendering parameters. - **printerName** (string) - Optional - The name of the printer for which to render the preview. ``` -------------------------------- ### dymo.label.framework.getPrinters() Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Lists all available DYMO printers detected by the service. It returns a collection of `PrinterInfo` objects, each containing details about a specific printer. ```APIDOC ## dymo.label.framework.getPrinters() - List available DYMO printers ### Description Returns an array-like collection of `PrinterInfo` objects describing all DYMO printers detected by the service. Items can be accessed by index or by printer name. ### Method `dymo.label.framework.getPrinters()` ### Response - **printers** (Array) - A collection of `PrinterInfo` objects. - **PrinterInfo** object properties: - **name** (string) - The name of the printer. - **modelName** (string) - The model name of the printer. - **printerType** (string) - The type of printer ('LabelWriterPrinter' or 'TapePrinter'). - **isConnected** (boolean) - Indicates if the printer is connected. - **isLocal** (boolean) - Indicates if the printer is local. - **isTwinTurbo** (boolean) - Applicable for 'LabelWriterPrinter', indicates if it's a Twin Turbo model. - **isAutoCutSupported** (boolean) - Applicable for 'TapePrinter', indicates if auto-cut is supported. ### Code Example ```javascript var printers = dymo.label.framework.getPrinters(); if (printers.length === 0) { console.error('No DYMO printers found.'); } else { for (var i = 0; i < printers.length; i++) { var p = printers[i]; console.log('Name:', p.name); console.log('Model:', p.modelName); console.log('Type:', p.printerType); // "LabelWriterPrinter" or "TapePrinter" console.log('Connected:', p.isConnected); console.log('Local:', p.isLocal); if (p.printerType === 'LabelWriterPrinter') { console.log('Twin Turbo:', p.isTwinTurbo); } if (p.printerType === 'TapePrinter') { console.log('Auto-cut:', p.isAutoCutSupported); } } // Access by name directly: var specific = printers['DYMO LabelWriter 450']; console.log('Specific printer model:', specific && specific.modelName); } ``` ``` -------------------------------- ### Load Label from XML Content Source: https://github.com/dymosoftware/dymo-connect-framework/blob/master/README.md Loads a label directly from its XML content and returns a label instance. Useful for dynamically generated labels. ```javascript dymo.label.framework.openLabelXml(labelXml) //Load label from XML content and return label instance ``` -------------------------------- ### Load Label from XML String Source: https://context7.com/dymosoftware/dymo-connect-framework/llms.txt Loads a label definition from an XML string. This is the preferred method for loading labels. After loading, you can validate the label and inspect its named objects. ```javascript var xhr = new XMLHttpRequest(); xhr.open('GET', '/labels/address.label', false); // synchronous for simplicity xhr.send(); if (xhr.status === 200) { var label = dymo.label.framework.openLabelXml(xhr.responseText); // Validate for the currently running DYMO service console.log('Valid label:', label.isValidLabel()); console.log('DCD label:', label.isDCDLabel()); console.log('DLS label:', label.isDLSLabel()); // Inspect named objects on the label var objectNames = label.getObjectNames(); console.log('Label objects:', objectNames); // e.g. ["Name", "Address", "City", "Barcode"] } else { console.error('Failed to load label XML'); } ```