Intermec PC43d IDL Smart Printing Resource Kit Developer Guide - Page 20
How to Use XML Serialization for Stored Label Formats
![]() |
View all Intermec PC43d manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 20 highlights
How to Use XML Serialization for Stored Label Formats Because the Smart Printing API provides access to directly read or modify the list of objects attached to a label, you can serialize your label formats. The Smart Printing Resource Kit provides a sample application illustrating how to serialize label formats. The sample is located at: c:\Intermec\SmartPrintingRK\Examples\Code\XmlSerialization.cs Populate an Imported Label Format with Variable Data There is no built-in method to set variable data fields in the Drawing objects, as XmlSerialization is a generic feature. Intermec recommends that you use an iterator to go through all the objects in the Drawing.DrawingObjects list and search and replace data in the Data property. If the XML format is being generated by a C# application, you may choose to set the property Name for each object, which allows you to identify an object in the DrawingObjects list by a textual identifier of your choice. Sample Code: Export Label Objects in a Drawing private static void ExportXml(Drawing drawing, string filename) { // Serialize the label format (objects) to XML XmlSerializer xmlSerializer = new XmlSerializer(typeof(List)); TextWriter textWriter = new StreamWriter(filename); xmlSerializer.Serialize(textWriter, drawing.DrawingObjects); textWriter.Close(); } Sample Code: Import Label Objects to a Drawing private static void ImportXml(Drawing drawing, string filename) { // Deserialize/import label format from XML XmlSerializer xmlDeserializer = new XmlSerializer(typeof(List)); TextReader textReader = new StreamReader(filename); drawing.DrawingObjects = (List)xmlDeserializer.Deserialize(textReader); textReader.Close(); } 14 IDL Smart Printing Resource Kit Developer Guide
![](/manual_guide/products/intermec-pm23c-idl-smart-printing-resource-kit-developer-guide-aa8b7d1/20.png)