I have a .NET console application setup from the example found here: https://techdocs.zebra.com/link-os/2-14/pc_net/content/html/8026e23d-26d4-5bd2-9f3e-a29cda0e523b
In ZebraDesigner for Developers I created a label with 2 variable text fields. I can store the ZPL on the printer and pass XML parameters to it from my .NET console application, but I get a runtime error shown in the following output:
Both destinationDevice connection string and outputDataStream arguments are specified:
Starting XML print...
Converting XML data to CSV...done.
Reading CSV data...
CSV Data contains 3 lines...
This line contains 1 items...<Title>
This line contains 1 items...<Assembly Tool 1>
This line contains 1 items...<Assembly Tool 2>
...end of CSV Data
Done acquiring template
Is not single line w/variables
Getting first line of data...
...extracted first line of data
System.ArgumentNullException: Value cannot be null. (Parameter 'key')
at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
at Zebra.Sdk.Printer.Internal.CsvPrinterHelper.ExtractFdsByColumnHeading(FieldDescriptionData[] originalFds, String[] columns, Int32[] quantityColumn)
at Zebra.Sdk.Printer.CsvPrinter.Print(String destinationDevice, Stream sourceDataStream, String templateFilename, String defaultQuantityString, Stream outputDataStream, Boolean verbose)
at Zebra.Sdk.Printer.XmlPrinter.Print(String destinationDevice, Stream sourceDataStream, String templateFilename, String defaultQuantityString, Stream outputDataStream, Boolean verbose)
at ZebraSDK.Program.XmlPrintingExample() in C:\Users\aevans\source\repos\ZebraSDK\Program.cs:line 83
If I save the ZPL from ZebraDesigner to my hard drive, I am able to make a small modification to the ZPL to prevent the runtime error. Here is an example of the ZPL generated in the designer for a Text field with a source variable of XML1:
^FT84,466^A0N,240,451^FH\^CI28^FN1^FDXML1^FS^CI27
If I simply remove ^FD and put quotes around XML1 it works as expected without a runtime error:
^FT84,466^A0N,240,451^FH\^CI28^FN1"XML1"^FS^CI27
I am fairly new to Zebra label development. I am attempting to understand why I am unable to use ZebraDesigner for developers to generate ZPL without making modifications. The example I am providing is a simple one, but my end goal is to print RFID labels from a template by passing parameters to it from a .NET console application. I think I can find a way forward by continuing to modify ZPL from the designer or write ZPL from scratch, but I am also wondering if I am doing something wrong in my setup?
I don't seem to be able to select my specific printer when I use ZebraDesigner for developers and my only two options are generic printers. My best guess at the moment is that I would get better results if I had an option to select my specific printer when creating a label?
Any help or guidance is appreciated. Thank you.
0 Replies