Zebra LinkOS Multiplatform SDK for Xamarin  1.1
Link-OS Portable Class Library Plugin for Xamarin
LinkOS.Plugin.Abstractions.IFormatUtil Interface Reference

Defines functions used for interacting with printer formats. More...

Inheritance diagram for LinkOS.Plugin.Abstractions.IFormatUtil:
LinkOS.Plugin.Abstractions.IZebraPrinter LinkOS.Plugin.ZebraPrinterImplementation

Public Member Functions

IFieldDescription [] GetVariableFields (string formatString)
 Returns a list of descriptors of the variable fields in this format. More...
 
void PrintStoredFormat (string formatPathOnPrinter, Dictionary< int, string > vars)
 Prints a stored format on the printer, filling in the fields specified by the Map. The values of any format variables will be encoded using the default encoding type. See System.Text.Encoding for more information about encoding types. More...
 
void PrintStoredFormat (string formatPathOnPrinter, string[] vars)
 Prints a stored format on the printer, filling in the fields specified by the array. The values of any format variables will be encoded using the default encoding type. See System.Text.Encoding for more information about encoding types. More...
 
byte [] RetrieveFormatFromPrinter (string formatPathOnPrinter)
 Retrieves a format from the printer. On a ZPL printer, only .ZPL files are supported. On a CPCL printer, only .FMT and .LBL files are supported. This function will only pull CPCL files on ZebraLink Mobile printers (RW, MZ, QL+). More...
 

Detailed Description

Defines functions used for interacting with printer formats.

The ZPL print format: FORMAT.ZPL

^XA
^DFE:FORMAT.ZPL
^FS
^FT26,243^A0N,56,55^FH\^FN12"First Name"^FS
^FT26,296^A0N,56,55^FH\^FN11"Last Name"^FS
^FT258,73^A0N,39,38^FH\^FDVisitor^FS
^BY2,4^FT403,376^B7N,4,0,2,2,N^FH^FDSerial Number^FS
^FO5,17^GB601,379,8^FS
^XZ

Create and print a format
See IPrinterStatus for PreCheckPrinterStatus() and PostPrintCheckStatus() code.
See IConnection for CheckPrinterLanguage() code.

using LinkOS.Plugin;
using System.Collections.Generic;
public void SendFile()
{
IConnection connection = ConnectionBuilder.Current.Build("TCP:192.168.1.100:9100");
try
{
connection.Open();
if (!CheckPrinterLanguage(connection))
return;
if (!PreCheckPrinterStatus(connection))
return;
IZebraPrinter printer = ZebraPrinterFactory.Current.GetInstance(connection);
// FORMAT.ZPL has two fields - the first is number 12, the second is number 11
Dictionary<int, string> vars = new Dictionary<int, string>();
vars.Add(11, "John");
vars.Add(12, "Smith");
printer.PrintStoredFormat("E:FORMAT.ZPL", vars);
PostPrintCheckStatus(connection);
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("Exception:" + e.Message);
}
finally
{
if (connection.IsConnected)
connection.Close();
}
}

Member Function Documentation

◆ GetVariableFields()

IFieldDescription [] LinkOS.Plugin.Abstractions.IFormatUtil.GetVariableFields ( string  formatString)

Returns a list of descriptors of the variable fields in this format.

Parameters
formatStringthe contents of the recalled format.
Returns
a list of field data descriptors. In CPCL the nth element of the list will contain the integer n and no name. In ZPL, each element will contain an ^FN number and a variable name if present. If the format contains multiple ^FNs with the same number, only the last one will be in the result. See IFieldDescription for an example of how variable fields look.

Implemented in LinkOS.Plugin.ZebraPrinterImplementation.

◆ PrintStoredFormat() [1/2]

void LinkOS.Plugin.Abstractions.IFormatUtil.PrintStoredFormat ( string  formatPathOnPrinter,
Dictionary< int, string >  vars 
)

Prints a stored format on the printer, filling in the fields specified by the Map. The values of any format variables will be encoded using the default encoding type. See System.Text.Encoding for more information about encoding types.

Parameters
formatPathOnPrinterthe location of the file on the printer (e.g. "E:FORMAT.ZPL").
varsa dictionary which contains the key/value pairs for the stored format. For ZPL formats, the key number should correspond directly to the number of the field in the format. For CPCL formats, the values will be passed in ascending numerical order.

Implemented in LinkOS.Plugin.ZebraPrinterImplementation.

◆ PrintStoredFormat() [2/2]

void LinkOS.Plugin.Abstractions.IFormatUtil.PrintStoredFormat ( string  formatPathOnPrinter,
string []  vars 
)

Prints a stored format on the printer, filling in the fields specified by the array. The values of any format variables will be encoded using the default encoding type. See System.Text.Encoding for more information about encoding types.

Parameters
formatPathOnPrinterthe name of the format on the printer, including the extension (e.g. "E:FORMAT.ZPL").
varsan array of strings representing the data to fill into the format. For ZPL formats, index 0 of the array corresponds to field number 2 (^FN2). For CPCL, the variables are passed in the order that they are found in the format.

Implemented in LinkOS.Plugin.ZebraPrinterImplementation.

◆ RetrieveFormatFromPrinter()

byte [] LinkOS.Plugin.Abstractions.IFormatUtil.RetrieveFormatFromPrinter ( string  formatPathOnPrinter)

Retrieves a format from the printer. On a ZPL printer, only .ZPL files are supported. On a CPCL printer, only .FMT and .LBL files are supported. This function will only pull CPCL files on ZebraLink Mobile printers (RW, MZ, QL+).

Parameters
formatPathOnPrinterthe location of the file on the printer (e.g. "E:FORMAT.ZPL").
Returns
the contents of the format file.

Implemented in LinkOS.Plugin.ZebraPrinterImplementation.


The documentation for this interface was generated from the following file: