# Labels In general, we recommend designing the label using Dymo Connect first, and using [update_data](#dymo_sdk.LabelObject.update_data) to set label objects. Our package does not give more "fine grained" control of label objects. For example, you cannot reorient or reposition label objects directly through the SDK (If you need to do this programatically, you can try and edit the XML elements directly, rather than using [LabelObject](#dymo_sdk.LabelObject)s). ## DymoLabel You can construct a label object by using [DymoLabel](#dymo_sdk.DymoLabel) and providing it a .label/.dymo file or by providing it an xml path. You can also construct an empty label and load one later by using [load_label_from_file](#dymo_sdk.DymoLabel.load_label_from_file) or [load_label_from_xml](#dymo_sdk.DymoLabel.load_label_from_xml). You can also get a base64 string representing a preview of the label by using [get_preview_label](#dymo_sdk.DymoLabel.get_preview_label). ```{warning} If you receive the error: DYMO.CrossPlatform.Common.DYMOSerializationException: The labelname X is not available, it may be a custom label. and you are using an official DYMO label, you may want to try sleeping for a small amount of time after importing the package. After importing it may take the SDK a little bit of time to detect custom label types. ``` ## Label Objects Dymo Labels consist of various [LabelObject](#dymo_sdk.LabelObject)s which represent the various objects that can be drawn on a label. These should not be constructed, and instead discovered by [using get_label_objects](#dymo_sdk.DymoLabel.get_label_objects) on a loaded label.Label Objects can be of type: * LabelObjectType.TEXT * LabelObjectType.ADDRESS * LabelObjectType.COUNTER * LabelObjectType.BARCODE * LabelObjectType.QRIMAGE * LabelObjectType.SHAPE * LabelObjectType.NONE For all objects except SHAPE and NONE, you can set the data by using [update_data](#dymo_sdk.LabelObject.update_data). If the LabelObject is an IMAGE, you should provide it a base64 string. You can also use [update_image_data_from_file](#dymo_sdk.LabelObject.update_image_data_from_file) to set the image using a file instead. COUNTER objects will increment by a certain amount if multiple copies are printed at once. For example, if you print 5 copies, the first label will display 1, then 2, then 3, etc. Note that if you print one copy multiple times, the counter will display 1 for each of these. That is ``` python dsdk.print_label(label, "Printer Name", 5) ``` will increment the counter while ``` python for i in range(0, 4): dsdk.print_label(label, "Printer Name", 1) ``` will not.