Provides access to the magnetic card reader, for printers equipped with one.

Namespace:  ZSDK_API.Printer
Assembly:  ZSDK_API (in ZSDK_API.dll) Version: 1.1.123.0

Syntax

C#
public interface MagCardReader
Visual Basic (Declaration)
Public Interface MagCardReader

Remarks

Only Mobile Zebra printers are available with built-in readers.

Examples

Read from a Magnetic Card.
CopyC#
using ZSDK_API.Comm;
using ZSDK_API.ApiException;
using ZSDK_API.Printer;

try {
    TcpPrinterConnection zebraPrinterConnection = new TcpPrinterConnection("192.168.1.100", TcpPrinterConnection.DEFAULT_CPCL_TCP_PORT);
    zebraPrinterConnection.Open();
    ZebraPrinter printer = ZebraPrinterFactory.GetInstance(zebraPrinterConnection);
    MagCardReader mcr = printer.GetMagCardReader();
    if (mcr != null) {
        String[] trackData = mcr.Read(10 * 1000);
        Console.WriteLine("Track1: " + trackData[0]);
        Console.WriteLine("Track2: " + trackData[1]);
        Console.WriteLine("Track3: " + trackData[2]);
    }
    zebraPrinterConnection.Close();
} catch (ZebraPrinterConnectionException e) {
    Console.Write(e.Message);
} catch (ZebraPrinterLanguageUnknownException e) {
    Console.Write(e.Message);
}
CopyVB.NET
Imports ZSDK_API.Printer
Imports ZSDK_API.ApiException
Imports ZSDK_API.Comm

Try
    Dim zebraPrinterConnection As New TcpPrinterConnection("192.168.1.100", TcpPrinterConnection.DEFAULT_CPCL_TCP_PORT)
    zebraPrinterConnection.Open()
    Dim printer As ZebraPrinter = ZebraPrinterFactory.GetInstance(zebraPrinterConnection)
    Dim mcr As MagCardReader = printer.GetMagCardReader()
    If mcr IsNot Nothing Then
        Dim trackData As [String]() = mcr.Read(10 * 1000)
        Console.WriteLine("Track1: " & trackData(0))
        Console.WriteLine("Track2: " & trackData(1))
        Console.WriteLine("Track3: " & trackData(2))
    End If
    zebraPrinterConnection.Close()
Catch e As ZebraPrinterConnectionException
    Console.Write(e.Message)
Catch e As ZebraPrinterLanguageUnknownException
    Console.Write(e.Message)
End Try

See Also