Getting Started with ZXP Series 3
Card Printer Development
ZXP3 SDK C#
A Zebra Technologies Application Note
2
Overview
This document describes the end to end process of designing, packaging, deploying and
running a C# application using the ZXP Series 3 and Series 1 SDK.
The sample code used in this Application Note is from the sample code article Connect and
Print Zebra Card SDK for ZXP Series 1 and Series 3 Printers C#.
Target Audience
The information in this Application Note document assumes you have reasonable technical
competence covering Microsoft Visual Studio, core programming concepts and rationales.
Feedback
We value your feedback. Please rate the article and then add your comments/suggestions in
the text field that appears.
For information on joining the ISV Program, contact a Program Manager in your area.
System Requirements
The following items are required to create the ZXP3 SDK application.
ZXP Series 3 and Series 1 SDK
The following components are required and included in the ZXP Series 3 and Series 1 SDK
package: Printer SDK and Graphics SDK.
Download the ZXP Series 3 and Series 1 SDK, Fill out and submit the required form.
Note: Download the 32-bit or 64-bit SDK installer, depending on your computer or project
requirements.
The “Install the ZXP Series 3 and Series 1 SDK” section of this document contains
instructions on how to install the SDK.
ZXP Series 1 or Series 3 Printer
In order to run a ZXP Series 3 and Series 1 SDK application, a Zebra ZXP Series 3 or Series
1 printer must be accessible from the computer.
Using the ZXP Series 3 and Series 1 SDK
This section includes information on how to:
Install the ZXP Series 3 and Series 1 SDK
Create an Application Using the ZXP Series 3 and Series 1 SDK
Design the Form Layout
A Zebra Technologies Application Note
3
Add the Code
Run the Application
Install the ZXP Series 3 and Series 1 SDK
You must install the ZXP Series 3 and Series 1 SDK to your system before you can develop
the sample application.
Follow these steps to install the ZXP Series 3 and Series 1 SDK:
1. Run the ZXP Series 3 and Series 1 SDK Installer.
The ZBRSDK Setup Wizard appears.
2. Click Next.
3. Use the installer’s defaults to advance through the installation wizard.
Create an Application Using the ZXP Series 3 and Series 1 SDK
The following steps guide you on how to create an application that uses the ZXP Series 3 and
Series 1 SDK. The application feeds in a PVC card from the Input Hopper, prints text and
graphics to the card, and then sends the card to the Output Hopper.
1. Launch Microsoft Visual Studio 2008.
2. To create a C# Windows Form project, click File -> New -> Project.
A Zebra Technologies Application Note
4
The New Project dialog appears. In the “Project types” pane, expand Visual C# and
select Windows Forms Application.
A Zebra Technologies Application Note
5
3. Do the following:
Type ZXP1ZXP3GettingStarted in the Name text field
Select a location for your project
Click OK
Your project automatically opens in the IDE. The Form Designer is opened by default.
Note: The ZXP Series 3 and Series 1 SDK can work with either 32-bit or 64-bit
machines.
4. Right-click the ZXP1ZXP3GettingStarted project in the Solution Explorer and select
Properties.
The ZXP1ZXP3GettingStarted project’s properties window appears.
5. Select Build on the left.
A Zebra Technologies Application Note
6
6. Set the Platform target to either x86 or x64, depending on which version of the SDK you
are using and Save.
7. Close the Properties window to return to the Form Designer.
Design the Form Layout
This section contains instructions for specifying the:
Form and form properties
Form Events (combo box, common controls, text box, labels for the objects, messaging,
and interface buttons)
Defining the Form and Form Properties
1. To rename the form in the Solution Explorer, right-click Form1.cs and select Rename.
2. Type frmMain.cs and press Enter.
3. Click Yes when prompted to rename all references of “Form1”.
4. Right-click anywhere on the form in the Form Designer and select Properties.
The Properties table appears in the bottom right panel.
A Zebra Technologies Application Note
7
5. Replace “Form1” with ZXP1 ZXP3 Application for the value of the Text property.
This changes the text on the title bar of the form.
6. For the value of the Size property, replace “300, 300” with 350, 300.
Defining the Form Events
1. In the Properties window, use the lightning bolt icon to set the Load event to
frmMain_Load.
A Zebra Technologies Application Note
8
2. Now define the additional form objects and events.
Defining Additional Form Objects and Events
1. Do the following:
Expand the Toolbox on the left.
Expand Common Controls and drag a ComboBox into the top right portion of the
form.
2. Right-click the combo box and select Properties.
3. Type the value of the “(Name)” property to cboPrinterSelection.
4. Use the lightning bolt icon to change the combo box’s SelectedIndexChanged event to
cboPrinterSelection_SelectedIndexChanged.
A Zebra Technologies Application Note
9
5. Use a text box to enter text that you want to appear on the card, by dragging a TextBox
from the Toolbox and place it directly under the combo box on the form.
6. Right-click the TextBox and select Properties.
7. Set the value of its “(Name)” property to txtCardTextFront.
A Zebra Technologies Application Note
10
8. Now, add Labels to the combo box and text box.
Drag a Label from the Toolbox and place it to the left of the combo box.
Right-click the label and select Properties. Change the value of the Text property to
Printer.
Drag another Label from the Toolbox and place it to the left of the text box.
Right-click the label and select Properties. Change the value of the Text property to
Card Text.
A Zebra Technologies Application Note
11
9. Add another label to output the status messages.
Drag another Label from the Toolbox and place it directly under the Card Text Label.
Right-click the label and select Properties. Clear the value of the Text property so
that is blank and set the value of the “(Name)” property to lblPrintStatus.
10. Add a Button to print the card.
Drag a Button from the Toolbox and place it in the bottom right portion of the form.
A Zebra Technologies Application Note
12
Right-click the Button and select Properties.
Change the value of the Text property to Print.
Change the value of the “(Name)” property to btnPrint.
Use the lightning bolt icon to set the Button’s click event to btnPrint_Click.
A Zebra Technologies Application Note
13
Add the Code
Now, you need to add the code.
1. Right-click anywhere in the Form Designer and select View Code.
The frmMain.cs opens.
2. Create the files ZBRGraphics.cs and ZBRPrinter.cs.
3. Replace the existing code in frmMain.cs, ZBRGraphics.cs and ZBRPrinter.cs with source
code from Connect and Print Zebra Card SDK for ZXP Series 1 and Series 3 Printers
C#.
4. Copy the ZBRGraphics.dll and ZBRPrinter.dll SDK files to the folder where the
application’s .exe is located.
This code has a few main functions:
Populates the printer selection combo box with available printers.
Connects to the printer before printing and disconnects from the printer after printing.
Draws shapes and text to the graphics buffer and begins printing when the Print
button is clicked.
Note: The source code in this Application Note is extracted from Connect and Print Zebra
Card SDK for ZXP Series 1 and Series 3 Printers C#.
Run the Application
1. Press F5 to start the application.
2. Select your ZXP Series 1 or Series 3 device from the printer selection combo box.
A Zebra Technologies Application Note
14
3. Type “Hello Zebra!” into the Card Text field.
4. Click Print.
When printing begins, a message “Performing Print Job” appears.
5. After printing is complete, a “Print Job: Success” message appears.
If you have a dual-sided printer, the resulting shapes appear with the text printed on
the front and back of your card.
If you have a single-sided printer, only the shapes and text appear on the front of your
card.
Front
Back
A Zebra Technologies Application Note
15
Document Control
Version
Date
Description
April, 2011
Initial release
November, 2015
Added support for the ZXP Series 1 and
Series 3 Printers for the updated SDK
Disclaimer
All links and information provided within this document are correct at time of writing.
Created for Zebra Global ISV Program by Zebra Development Services.