Zebra Zebra Virtual PrintWare PrintManager Virtual Printware Suite Programmer's Reference Manual

PrintManager™
P1057447-002
Virtual PrintWare Suite™
Programmer’s Reference Manual
Copyright Notice
© 2015 ZIH Corp.
This document contains information proprietary to Zebra Technologies Corporation. This document and the information contained within is Copyrighted by Zebra Technologies Corporation and may not be duplicated in full or in part by any person without written approval from Zebra.
While every effort has been made to keep the information contained within current and accurate as of the date of publication, no guarantee is given that the document
is error-free or that it is accurate with regard to any specication. Zebra Technologies
Corporation reserves the right to make changes, for the purpose of product improvement, at any time.
Trademarks
Zebra is a registered trademark and Virtual PrintWare is a trademark of Zebra Technologies Corporation. Windows is a registered trademark of Microsoft Corporation in the United States and other countries. All other trademarks or registered trademarks are marks of their respective holders.
Contents
Introduction .....................................................................................................................1
Purpose ..................................................................................................................................................1
PrintManager Overview .........................................................................................................................2
PrintManager Data ................................................................................................................................. 3
Print Job Processing .............................................................................................................................. 4
Template-Based Printing ........................................................................................................................ 5
Sample Template ...................................................................................................................................6
Sample Data Document ..................................................................................................................6
SDK-Based Printing ............................................................................................................................... 7
PrintManager Programming Interface ..........................................................................9
Introduction ............................................................................................................................................9
Template Printing ................................................................................................................................10
Template Document ............................................................................................................................. 11
Tag Descriptions ............................................................................................................................ 12
Job Document ...................................................................................................................................... 18
Sample Job Document ..................................................................................................................18
Data Document .................................................................................................................................... 19
XML Data Document ....................................................................................................................19
CSV Data Document ....................................................................................................................20
ZXP Card Interface ..............................................................................................................................22
ZXP Card Interface Command Syntax ..........................................................................................22
Store Command ...........................................................................................................................23
Delete Command ..........................................................................................................................25
Submit Command ......................................................................................................................... 26
Request Command ........................................................................................................................28
P1057447-002 PrintManager Programmer's Reference Manual i
Sending Document to PrintManager .................................................................................................... 32
Open a TCP/IP Connection ...........................................................................................................32
Send a Document .......................................................................................................................... 32
Receive PrintManager’s Response ............................................................................................... 33
Parse the Received Response ...................................................................................................... 34
Close a TCP/IP Connection ........................................................................................................... 35
Sending ZMotif-Based Jobs to PrintManager ......................................................................................36
Open a TCP/IP Connection ...........................................................................................................36
Build a print job .............................................................................................................................. 36
Send a print job .............................................................................................................................37
Receive PrintManager’s Response ............................................................................................... 37
Close a TCP/IP Connection ........................................................................................................... 37
Worldwide Support ....................................................................................................... 39
ii PrintManager Programmer's Reference Manual P1057447-002
Purpose
1
Introduction
The purpose of this manual is to dene and describe the PrintManager application
programming interface (API). The PrintManager API supports two methodologies for interfacing to an application: Message-based printing and SDK-based printing; both methods require communication via TCP/IP or via drag-and-drop from a hot-drop folder.
P1057447-002 PrintManager Programmer's Reference Manual 1
Introduction
PrintManager Overview
PrintManager Overview
PrintManager is a service that runs on Microsoft Windows operating systems. PrintManager can process ZMotif-based and message-based jobs—this includes template- and job-based which both support XML and CSV. PrintManager creates print jobs from the received data, directing the jobs to the appropriate printers. PrintManager supports the ZXP Series 3, ZXP Series 7, and ZXP Series 8 Card Printers.
PrintManager stores templates and images to be used for template-based printing. Templates are XML documents, and images are binary data which may be one of many formats including bitmap and jpeg. The variable data for a template-based print
job is packaged as a data document in XML or CSV le format. The ZMotif SDK is used to build print jobs from templates, image les, and data documents.
PrintManager can also receive ZMotif-based jobs directly. The ZMotif SDK can be used to build and send a print job to PrintManager.
ZMotif Job
XML Doc
Data Document
CSV Doc
Print Manager
PrintManager consists of three modules: Queue, Store, and Job. Queue Modules are virtual printers that receive data streams, parse the data, and send the data to the Store Module. The Store Module saves the data for future processing. The Job Module gets data via the Store Module, analyzes the data, creates print jobs, determines the appropriate printer, and tracks job status.
Queue Module
Queue Module
Queue Module
Store
Module
Job Module
PRINT MANAGER
2 PrintManager Programmer's Reference Manual P1057447-002
PrintManager Data
PrintManager Data consists of job-specic data received by PrintManager for
purposes of performing template- and job-based printing using the message interface
described in this manual. The job-specic data must be formatted as a document using the XML or CSV le formats. The data document is delivered to PrintManager
via TCP/IP from any host capable of streaming data documents via TCP/IP such as Linux, UNIX, and Microsoft Windows
The XML document shown below is an example of an XML-formatted data document used for a template-based print job.
<?xml version=’1.0’ encoding=’utf-16’?> <data template=’CuppaJoe’> <Name>Test Job</Name> </data>
The CSV document shown below is an example of a CSV-formatted data document used for a template-based print job.
template,Name CuppaJoe,Test Job
Introduction
PrintManager Data
P1057447-002 PrintManager Programmer's Reference Manual 3
Introduction
Print Job Processing
Print Job Processing
Print Job Processing refers to the tasks required to complete a print job. The tasks associated with the completion of a print job include receiving data documents when
template-based job messaging is in use, receiving job xml les when job-based
messaging is in use, and receiving ZMotif-based jobs when the ZMotif SDK is in use.
4 PrintManager Programmer's Reference Manual P1057447-002
Template-Based Printing
Template-Based Printing is a process that combines a template document and its required images (if appropriate) with a data document to create a ZMotif-based print job.
PrintManager uses the ZMotif SDK to build a print job from a template, its required image(s), and a data document.
Template documents specify the card layout by dening the required parameters.
These parameters include combinations of the following elements: font types, the number of sides to print (single or double), graphics, text, barcode, lines, rectangles, ellipses, and magnetic encoding (if supported). Some of these parameters become placeholders for data—the data document contains the data required by these placeholders.
Before a template and its required image(s) can be used by PrintManager to build a ZMotif-based print job, the template and image(s) must be stored where
PrintManager can locate them. The template interface specication includes
commands which enable templates and images to be programmatically stored by PrintManager.
Introduction
Template-Based Printing
ZMotif is a print job language that contains job characteristics and binary images. Software tools for Microsoft Windows developers that generate ZMotif are the ZXP Series printer drivers, and ZMotif Software Developer Kits (SDKs).
PRINT MANAGER
Stored Images
XML Doc
Data Document
CSV Doc
Data Binding
Stored Template
Create Print Job
P1057447-002 PrintManager Programmer's Reference Manual 5
Introduction
Sample Template
Sample Template
The following xml document is an example of a Template that would be stored in the PrintManager for use with data documents for print jobs.
<?xml version=”1.0” encoding=”utf-16”?> <template name=”text_job”> <fonts> <font id=”1” name=”arial” size=”12” bold=”yes” /> </fonts> <sides> <side name=”front”> <print_types> <print_type type=”color”> <graphic eld=” logo” type=”bmp” x=”100” y=”100” height=”150” width=”150” />
<text eld=”Firstname” font_id=”1” x=”100” y=”300” /> <text eld=”Lastname” font_id=”1” x=”100” y=”500” />
</print_type> </print_types> </side> </sides> </ template >
Sample Data Document
Data documents specify data to be bound with a template at job creation—they can be XML or CSV formatted documents.
The following XML document is an example of an xml-formatted data document used by the sample template on the previous page; its contents would be merged with the sample template’s contents to create a print job.
XML Data Document <data template=”text_job”> (template to be used with the data) <logo>zebra_logo</ logo > (data for print job) <Firstname>John</ Firstname > (data for print job) <Lastname>Doe</ Lastname > (data for print job) </data>
The following CSV document is an example of a CSV-formatted data document used by the sample template on the previous page; its contents would be merged with the sample template’s contents to create a print job.
CSV Data Document template,logo,Firstname,Lastname text_job,zebra_logo,John,Doe
CSV Data Docuement Items (not part of the CSV document) Template, placeholder in template
logo, placeholder in template Firstname, place holder in template Lastname placeholder in template text_job, template to be used with the data
zebra_logo, image le required by template
John, data for print job Doe, data for print job
6 PrintManager Programmer's Reference Manual P1057447-002
SDK-Based Printing
SDK-based printing is a process that makes use of Zebra’s ZMotif SDKs for building print jobs and sending them to PrintManager.
An application would use various methods in the SDK to build a print job. Once built, the job is then sent to PrintManager by making use of other methods available in the SDK. Unlike template-based printing, SDK-based printing delivers pre-built jobs to the PrintManager; therefore, it is not required to build the job. Instead, PrintManager simply forwards the job to an appropriate printer.
Introduction
SDK-Based Printing
P1057447-002 PrintManager Programmer's Reference Manual 7
8 PrintManager Programmer's Reference Manual P1057447-002
PrintManager Programming
Interface
Introduction
This chapter describes the methods for interfacing an application to PrintManager: template-based printing and SDK-based. The chapter focuses on ZXP Card Interface
which is the message-based specication for template-based jobs; it also provides
an introduction to the SKD-based approach.
2
Template-based printing makes use of template documents and data documents
to build print jobs. A template document describes a card’s layout by dening fonts,
sides, graphics, text, barcodes, QR codes, lines, rectangles, ellipses and magnetic
encoding. The template also species data and image binding. A data document denes the information unique to a card such as a customer’s name, an employee’s identication number, and date of expiration.
SDK-based printing makes use of the ZMotif Printer and Graphics SDKs to build print jobs. Using the SDK approach, each job is built through the use of methods provided by the SDK as if all aspects of the job were unique, even if common background images, titles, etc are part of each card produced.
P1057447-002 PrintManager Programmer's Reference Manual 9
PrintManager Programming Interface
Template Printing
Template Printing
The ZXP Card interface provides a standardized process for sending and receiving data to/from the PrintManager. Data documents can be comma-separated values (CSV), XML documents or binary data. Data is sent within an interface command payload; the payload can be: templates, images, job data, or functional commands. Responses will be XML formatted documents or binary data.
There are four ZXP Card interface commands supported by PrintManager: Store, Submit, Delete and Request. The Store command downloads templates and images on the PrintManager. The Delete command removes templates and images from the PrintManager. The Submit command sends data or functional commands to be
processed by the PrintManager. The request command is used to request specic
information from PrintManager including job status, list of available queues, and a
queue’s conguration.
10 PrintManager Programmer's Reference Manual P1057447-002
Template Document
This section identies all of the possible components of the template document. A
template document is used to describe those parts of a card layout that are common
to all cards to be printed. The template also species data and image binding, and
must be stored by PrintManager prior to its use.
A template document describes card layout by dening fonts, sides, graphics, text,
barcodes, lines, rectangles, ellipses, and magnetic encoding. The template also
species data and image binding and is sent in store commands.
<?xml version=”1.0” encoding=”utf-8” ?> <template> <fonts> <font /> </fonts> <sides> <side> <print_types> <print_type> <graphic /> <text /> <barcode /> <line /> <ellipse /> <rectangle /> </print_type> </print_types> </side> </sides> <magdata> <track /> </magdata> </template>
PrintManager Programming Interface
Template Document
P1057447-002 PrintManager Programmer's Reference Manual 11
PrintManager Programming Interface
Template Document
Tag Descriptions
Template
<template name=”” version=”” card_type=”” card_thickness=”” delete=”” destination=”” >
name name of the template
version template version number
card_type identies the card type
card_thickness thickness of card in mm; default is 30
delete “no” = job data will be kept until the next job is received; (default)
destination “eject” = normal exit path for printer without laminator (default)
“yes” = job will be deleted at the end of processing
“reject” = card goes into the reject tray
“hold” = card goes to the home position
“feeder” = card returns to the input location
“lam_top” = card goes to laminator for top side lamination
“lam_bottom” = card goes to laminator for bottom side lamination
“lam_both” = card goes to laminator for top and bottom side lamination
“lam_any” = card goes to laminator without regard for laminate availability. It will be laminated top, bottom, both or neither (if no laminate is installed, the card simply passes through the laminator)
“lam_none” = card passes through laminator without lamination
Font
<font id=”” name=”” size=”” bold=”” italic=”” underline=”” />
all fonts used by a template are predened
id font index; used by a text tag
name font name; default is Arial
size font point size; default is 10
bold “yes” or “no”; default is “no”
italic “yes” or “no”; default is “no”
underline “yes“ or “no” default is “no”
Side
<side name=”” orientation=”” rotation=”” sharpness=”” k_mode=””>
name “front” or “back” default is “front”
orientation “landscape” or “portrait” default is “landscape”
rotation 0 or 180; default is 0
sharpness “off”, “low”, “normal”, “high”; default is “off”
k_mode “text”, “barcode”, mixed”, “picture”; default is “mixed”
12 PrintManager Programmer's Reference Manual P1057447-002
PrintManager Programming Interface
Template Document
Print Type
<print_type type=”” ll=”” preheat=””>
type “color”, “monochrome”, “overlay”, “inhibit”, “helper”; default is color
ll background ll color (RGB) for the ll layer; default is none
preheat valid range -50 to 50 for color, mono front, or mono back only
Graphics
<graphic order_id=”” eld=”” format=”” opacity=”” height=”” width=”” x=”” y=”” rotation=”” delete=””
/>
order_id processing order, 1 thru x with 1 being the bottom layer
eld reference name for data binding
format “bmp”, “jpeg”; default is “bmp”
opacity
height height of the image in pixels
width width of the image in pixels
x bottom left x axis in pixels
y bottom left y axis in pixels
rotation 0, 90, 180, 270; default is 0
delete “yes” or “no” delete image after processing; default=”yes”
<graphic>reference</graphic> reference species the name of a stored image
P1057447-002 PrintManager Programmer's Reference Manual 13
PrintManager Programming Interface
Template Document
Text
<text order_id=”” eld=”” font_id=”” x=”” y=”” color=”” angle=”” height=”” width=”” alignment=””
v_alignment=”” shrink=””/>
order_id processing order, 1 thru x with 1 being the bottom layer
eld reference name for data binding
font_id font reference
x x axis location in pixels
y y axis location in pixels
color RGB text color
red “FF0000”
green “00FF00”
blue “0000FF”
angle angle of rotation; referenced point is the lower left x, y coordinates
width width of the text box; optional
height height of the text box; optional
alignment horizontal alignment within the text box; only valid if height and width
“left”, “right”, “center”; default is “left”
v_alignment vertical alignment within the text box; only valid if height and width
“top”, “bottom”, “center”; default is “left”
shrink “yes” or “no”; “yes” indicates if the text is to t within the width
have been dened
have been dened
specication
<text>data</text> data species the text data to print
14 PrintManager Programmer's Reference Manual P1057447-002
PrintManager Programming Interface
Template Document
Barcode
<barcode order_id=”” eld=”” font_id=”” x=”” y=”” rotation=”” code=”” multiplier=”” ratio=”” height=”” width=””
bar_height=”” quiet_zone_width=”” add_checksum=”” display_checksum=”” fore_color=”” bar_color=”” back_color=”” show_text=”” encode_type=”” error_correction_level=”” code_version=”” module_size=”” encoding_name=”” />
order_id processing order, 1 thru x with 1 being the bottom layer
eld reference name for data binding
font_id font used to display barcode text
x lower left x axis location
y lower right y axis location
rotation angle of rotation; referenced point is the lower left x, y coordinates
code “code39”, “code128”, “code128A”, “code128B”, “code128C”, “interleaved2of5”,
multiplier
ratio ratio between the wide bar or space and the narrow bar or space
width width of the bounding box that the barcode will be printed in
height height of the bounding box that the barcode will be printed in
bar_height height of the barcode
quiet_zone_width area around bar code that serves to isolate it from surrounding text and
add_checksum enable checksum: default is “no”
display_checksum display checksum: default is “no”
fore_color text color of printed code value: default is black
bar_color barcode color: default is black
back_color background color; default is transparent
show_text indicates if text is to be shown under the barcode; “yes” or “no”
encode_type “auto”, “numeric”, “alpha numeric”, “kanji”, “byte”: default is “auto”
error_correction_level “l” for high symbol quality and/or the need for the smallest possible symbol
code_version species the QR code version to use on symbology
module_size
encoding_name “asmo-708” “big5” “cp1025” “cp866” “cp875” “csISO2022JP” “DOS-720”
“industrial2of5”, “qrcode”: default is “code39”
graphics
“m” standard, offers a good compromise between small size and increased reliability
“q” high reliability level, suitable for more critical or poor print quality
“h” offers the maximum achievable reliability
default is “m”
“auto”, “v01” thru “v40”; increments are in steps of 4; default is “auto”
“v01” = 21 x 21
“v40” = 177 x 177”
“DOS862” “EUC-CN” “euc-jp” euc-kr” “GB18030” gb2312” “hz-gb-2312” “IBM00858” “IBM00924” “IBM01047” “IBM01140” “IBM01141” “IBM01142” “IBM01143” “IBM01144” “IBM01145” “IBM01146” “IBM01147” “IBM01148” “IBM01149” “IBM037” IBM1026” “IBM273” “IBM277” “IBM278” “IBM280” “IBM284” “IBM285” “IBM290” “IBM297” “IBM420” “IBM423” “IBM424” “IBM437” “IBM500” “ibm737” “ibm775” “ibm850” “ibm852” “ibm855” “ibm857” “us-ascii” “utf-7” “utf-8” “utf-16” “utf-32” “utf-32BE” “iso-8859-1” “iso-8859-2” “iso-8859-3” “iso-8859-4” “iso-8859-5” “iso-8859-6” “iso-8859-7” “iso-8859-8” “iso-8859-8-i” “iso-8859-9” “iso-8859-13” “iso-8859-15”
<barcode>data</barcode> data species the barcode to print
P1057447-002 PrintManager Programmer's Reference Manual 15
PrintManager Programming Interface
Template Document
Line
<line order_id=”” x1=”” y1=”” x2=”” y2=”” thickness=”” color=”” />
order_id processing order, 1 thru x with 1 being the bottom layer
x1 start x axis location
y1 start y axis location
x2 end x axis location
y2 end y axis location
thickness line thickness in pixels
color RGB text color
Ellipse
<ellipse order_id=”” x=”” y=”” height=”” width=”” thickness=”” color=”” ll_color=”” />
order_id processing order, 1 thru x with 1 being the bottom layer
x bottom left corner x location
y bottom left corner y location
width width in number of pixels
height height in number of pixels
thickness line thickness in number of pixels
color line color in RGB
ll_color ll color in RGB; if attribute does not exist indicates no ll or
red “FF0000”
green “00FF00”
blue “0000FF”
transparent
Rectangle
<rectangle order_id=”” x=”” y=”” height=”” width=”” thickness=”” color=”” ll_color=”” radius=”” />
order_id processing order, 1 thru x with 1 being the bottom layer
x bottom left corner x location
y bottom left corner y location
width width in number of pixels
height height in number of pixels
thickness line thickness in number of pixels
color line color in RGB
ll_color ll color in RGB; if attribute does not exist indicates no ll or
transparent
radius for rounded corners; numeric value: default is 0
16 PrintManager Programmer's Reference Manual P1057447-002
PrintManager Programming Interface
Template Document
Mag Data
<magdata format=”” coercivity=”” verify=””>
format “iso”, “aamva”, “jis”, “vingcard”, “ballys”, “custom”, “binary”; default is
“iso”
coercivity “high” or “low”; default is “high”
verify “yes” or “no”; default is “no”
Tracks
<track eld=”” number=”” format=”” />
eld reference name for data binding
number track number to encode
format “ascii” or “hex”
P1057447-002 PrintManager Programmer's Reference Manual 17
PrintManager Programming Interface
Job Document
Job Document
A job document is used to provide all required information to create a specic print
job. Unlike a data document for a template-based job, a job document does not reference a template. Instead, it includes the information that would be contained in
both the data and template documents to dene a job; thus, it uses many of the same xml tag descriptors to dene a print job. This section identies all of the possible
components of the job document.
<?xml version=”1.0” encoding=”utf-8” ?> <job name=”” hold=””> <fonts> <font /> </fonts> <sides> <side> <print_types> <print_type> <graphic /> <text /> <barcode /> <line /> <ellipse /> <rectangle /> </print_type> </print_types> </side> </sides> <magdata > <track /> </magdata> </job>
Sample Job Document
The following xml document is an example of a job document that would be sent to the PrintManager as a print job.
<?xml version=”1.0” encoding=”utf-8”?> <job name=”PrintSingleSide”> <fonts> <font id=”1” name=”arial” size=”12” bold=”yes” /> </fonts> <sides> <side name=”front”> <print_types> <print_type type=”color”> <graphic type=”bmp” x=”100” y=”100” height=”150” width=”150”> logo.bmp</graphic> <text font_id=”1” x=”100” y=”300” > John </Text> <text font_id=”1” x=”100” y=”500”/> Smith </Text> </print_type> </print_types> </side> </sides> </ job >
18 PrintManager Programmer's Reference Manual P1057447-002
Data Document
A data document is required for all template-based printing. The data document
species the template to be used and the information unique to a specic card to be
printed such as customer name, customer address, customer photo, membership number, etc.
A data document can be built using the XML or CSV le formats. The sample code
demonstrated in this section is written in the C# language; however, it is not a requirement to use C# when building data documents.
XML Data Document
This section demonstrates how to build a data document using the XML le format.
Header
Each data document requires a header to identify the start of the document.
string dataDoc = string.empty; dataDoc = “<?xml version=’1.0’ encoding=’utf-16’?>” + “\r\n”;
PrintManager Programming Interface
Data Document
Start of Data Section
The start of the data section of each data document is dened by the beginning data tag. Within the data tag the name of the template to be used is identied.
docData += “<data template=’” + GolfMembership + “’”; docData += “>”; docData += “\r\n”;
Field Information
The eld information represents the data that is unique to each card. It can consist of text, image, and barcode data. The eld name must appear within opening and closing xml tags while the data for the eld must appear between the tags as shown
below.
docData += “<” + “FirstName” + “>”; docData += “John”; docData += “</” + “FirstName” + “>”; docData += “\r\n”;
docData += “<” + “LastName” + “>”; docData += “Doe”; docData += “</” + “LastName” + “>”; docData += “\r\n”;
docData += “<” + “MembershipNumber” + “>”; docData += “123456789”; docData += “</” + “MembershipNumber” + “>”; docData += “\r\n”;
docData += “<” + “ExpirationDate” + “>”; docData += “12/31/2015”; docData += “</” + “ExpirationDate” + “>”; docData += “\r\n”;
P1057447-002 PrintManager Programmer's Reference Manual 19
PrintManager Programming Interface
Data Document
End of Data Section
The end of the data section of the data document is dened by the ending data tag.
Once the ending data tag has been added, the data document is complete.
docData += “</data>”;
Completed Data Document
The completed data document described in the previous four sections is shown here.
<?xml version=”1.0” encoding=”utf-16”?> <data template”GolfMembership”> <FirstName>John</FirstName> <LastName>Doe</LastName> <MembershipNumber>123456789</MembershipNumber> <ExpirationDate>12/31/2015</ExpirationDate> </data >
CSV Data Document
This section demonstrates how to build a data document using the CSV le format.
Header
Each data document requires a header to identify the start of the document.
string dataDoc = “template”;
Start of Data Section
The start of the data section of each data document is dened by a comma ‘,’.
docData += “,”;
Field Name Information
The eld information represents the data that is unique to each card. It can consist of text, image, and barcode data. The rst eld name must appear immediately following the comma identifying the start of the data section. Each subsequent eld name must be preceded by a comma. The last eld name must be terminated with a carriage return-line eld.
docData += “FirstName”; docData += “,” + “LastName”; docData += “,” + “MembershipNumber”; docData += “,” + “ExpirationDate”; docData += “\r\n”;
Field Data Information
The data for the rst eld must appear immediately after the carriage return-line feed of the eld name information. Each subsequent data eld must be preceded by a comma. Unlike the name elds, the last data eld does not require a carriage return-
line feed.
docData += “GolfMembership”; docData += “,” + “John”; docData += “,” + “Doe”; docData += “,” + “123456789”; docData += “,” + “12/31/2015”;
20 PrintManager Programmer's Reference Manual P1057447-002
PrintManager Programming Interface
Data Document
End of Data Section
There is no designation to dene the end of data section. The nal data eld value denes the end the of the data section.
Completed Data Document
The completed data document described in the previous ve sections is shown here.
template,FirstName,LastName,MembershipNumber,ExpirationDate\r\ nGolfMembership,John,Doe,123456789,12/31/2015
P1057447-002 PrintManager Programmer's Reference Manual 21
PrintManager Programming Interface
ZXP Card Interface
ZXP Card Interface
ZXP Card interface provides a standardized process for sending and receiving data to/from the PrintManager. Data can be comma-separated values (CSV), XML documents or binary data. Data is sent in an interface command payload consisting of templates, images, job data or functional commands to the PrintManager. Responses returned from PrintManager will consist of XML formatted documents or binary data.
There are four interface commands supported by PrintManager: Store, Submit, Delete and Request. The Store command downloads templates and images to the PrintManager. The Delete command removes templates and images previously stored on the . The Submit command sends data or functional commands to the PrintManager. The Request command requests information from the PrintManager.
The interface commands are built and sent to the PrintManager through the use of a data document using the xml format described in the data document section of this manual.
ZXP Card Interface Command Syntax
The syntax for the interface commands is as follows:
zxpf:command:sub-command:name:size:type:payload; zxpf = header for the command
command = operation to be performed: store, delete, submit, or request
sub-command = the category the command will act upon: template, image, job, data, or information
name = name of the data being stored, deleted, submitted, or requested
The following elds are optional based upon the command and sub-command:
size = size of the payload in bytes being stored or submitted
type = format of the payload: xml, bmp, jpeg, gif, png
payload = ACII text, or byte array of data: template, data document, job document, or image
Each eld of the command is delimited by a ‘:’ character.
The command is terminated by the ‘;’ character.
22 PrintManager Programmer's Reference Manual P1057447-002
Store Command
The Store command downloads templates and images to the PrintManager.
syntax: zxpf:store:category:name:size:type:payload;
zxpf = header for the command
store = operation to be performed
category = template or image
name = name of the template or image le being stored
size = size of the template or image le being stored
type = depends upon the category; templates are xml; images can be bmp, jpeg, gif, or png
payload = template document or image data
PrintManager Programming Interface
ZXP Card Interface
Response to Store command
If store command succeeds:
<?xml version=”1.0” encoding=”utf-8” ?> <zxpf_resp> <error_code>0</error_code> <detail>No error</detail> </zxpf_resp>
If store command fails:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>error code here</error_code> <detail>description of error code here</detail> </zxpf_resp>
Example Store commands
Store a template on PrintManager:
zxpf:store:template:GolfTemplateOneOne.xml:2622:xml:<?xml version=”1.0” encoding=”utf-16” standalone=”yes”?> <template name=”GolfTemplateOneOne” card_type=”1” card_thickness=”30” delete=”false”> <!-- Note: card_thickness is hard-coded to 30 as it is not currently used --> <fonts> <font id=”1” name=”Arial” size=”13” bold=”yes” italic=”yes” underline=”no”/> <font id=”2” name=”Arial” size=”12” bold=”yes” italic=”yes” underline=”no”/> <font id=”3” name=”Arial” size=”12” bold=”no” italic=”no” underline=”yes”/> </fonts> <sides> <side name=”front” orientation=”landscape”> <print_types> <print_type type=”color”> <graphic order_id=”1” format=”bmp” opacity=”100” height=”646” width=”1030” x=”0” y=”0” rotation=”0” delete=”false”>GolfTemplateOneOne_img_1</graphic>
<text order_id=”2” eld=”DateOfMembership” font_id=”1” x=”24” y=”19” color=”0x0” angle=”0”
P1057447-002 PrintManager Programmer's Reference Manual 23
PrintManager Programming Interface
ZXP Card Interface
height=”62” width=”641” alignment=”left” v_alignment=”top” shrink=”no”/> <graphic order_id=”3” format=”bmp” opacity=”100” height=”164” width=”195” x=”768” y=”379” rotation=”0” delete=”false”>GolfTemplateOneOne_img_2</graphic> <text order_id=”4” font_id=”2” x=”598” y=”137” color=”0xC20000” angle=”0” height=”75” width=”401” alignment=”center” v_alignment=”top” shrink=”yes”>Visitor Badge</text>
<ellipse order_id=”6” x=”51” y=”155” height=”110” width=”147” ll_color=”0x3A8FA3”/>
<ellipse order_id=”7” x=”51” y=”155” height=”110” width=”147” thickness=”6” color=”0x0”/> <rectangle order_id=”8” x=”705” y=”256” height=”60” width=”253” angle=”0”
ll_color=”0x324BE1”/>
<rectangle order_id=”9” x=”705” y=”256” height=”60” width=”253” thickness=”6” angle=”0” color=”0x0”/>
<rectangle order_id=”10” ll_color=”0xAFCC99” width=”54” height=”174” x=”548” y=”465”
angle=”90”/> </print_type> <print_type type=”mono”>
<text order_id=”5” eld=”MemberName” font_id=”3” x=”27” y=”456” color=”0x0” angle=”0”
height=”52” width=”326” alignment=”left” v_alignment=”top” shrink=”no”/> <barcode order_id=”11” height=”54” width=”174” x=”548” y=”465” rotation=”90” show_text=”no” truncated=”no” code=”PDF417”>1234567890</barcode> </print_type> <print_type type=”overlay”> <rectangle order_id=”12” x=”0” y=”0” height=”646” width=”1030” thickness=”1” color=”0x0”
ll_color=”0x0”/>
</print_type> </print_types> </side> <side name=”back” orientation=”landscape”> <print_types> <print_type type=”overlay”> <rectangle order_id=”13” x=”0” y=”0” height=”646” width=”1030” thickness=”1” color=”0x0”
ll_color=”0x0”/>
</print_type> </print_types> </side> </sides> </template> ;
Response if the store command above succeeds:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>0</error_code> <detail>No Error</detail> </zxpf_resp>
Example of a response if the store command above fails:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>6005</error_code> <detail>Invalid Template Data, print_type Overlay is not valid for ZXP 8 Queue with ribbon YCMK</detail> </zxpf_resp>
Store an image on PrintManager:
zxpf:store:image:GolfTemplateOneOne_img_1:1966134:bmp:
Note • The actual bitmap to be stored would need to be appended to the command
following the ‘:’ after bmp. It would be appended as a byte array, after the entire
command had been converted to its equivalent bytes and stored in a byte array.
24 PrintManager Programmer's Reference Manual P1057447-002
Response if the store command above succeeds:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>0</error_code> <detail>No Error</detail> </zxpf_resp>
Example of a response if the store command above fails:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>6005</error_code> <detail>Parameter is not valid</detail> </zxpf_resp>
Delete Command
The Delete command removes templates and images previously stored on the PrintManager.
syntax: zxpf:delete:category:name;
PrintManager Programming Interface
ZXP Card Interface
zxpf = header for the command
delete = operation to be performed
category = template or image
name = name of the template or image le to be deleted
Response to Delete command
If delete command succeeds:
<?xml version=”1.0” encoding=”utf-8” ?> <zxpf_resp> <error_code>0</error_code> <detail>No error</detail> </zxpf_resp>
If delete command fails:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>error code here</error_code> <detail>description of error code here</detail> </zxpf_resp>
Example Delete commands
Delete an image from PrintManager:
zxpf:delete:image:GolfTemplateOneOne_img_1;
Delete a template from PrintManager:
zxpf:delete:template:GolfTemplateOneOne;
P1057447-002 PrintManager Programmer's Reference Manual 25
PrintManager Programming Interface
ZXP Card Interface
Response if the delete commands above succeed:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>0</error_code> <detail>No Error</detail> </zxpf_resp>
Example of a response if the delete commands above fail:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>6005</error_code> <detail>Parameter is not valid</detail> </zxpf_resp>
Submit Command
The Submit command sends data, job or functional commands to the PrintManager.
syntax: zxpf:submit:category:size:type:payload
zxpf = header for the command
submit = operation to be performed
category = data or job
size = size of the data, job or functional command to be submitted
type = depends upon the category; data can be csv or xml; job is xml
payload = data or job to be submitted
Response to Submit command
If submit command succeeds:
<?xml version=”1.0” encoding=”utf-8” ?> <zxpf_resp> <error_code>0</error_code> <detail>No error</detail </zxpf_resp>
If submit command fails:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>error code here</error_code> <detail>description of error code here</detail> </zxpf_resp>
26 PrintManager Programmer's Reference Manual P1057447-002
PrintManager Programming Interface
ZXP Card Interface
Example Submit command
Submit a data document to PrintManager for template-based printing
zxpf:submit:data:236:xml:<?xml version=’1.0’ encoding=’utf-16’?>\r\n <data template=’PAOne19’>\r\n<Name>HANNAH LUM</Name>\r\n <MemberNumber>8120 1130 2237 0158</MemberNumber>\r\n <Location>ANCHORVALE CC</Location>\r\n <ExpirationDate>EXP 12 DEC 2014</ExpirationDate>\r\n</data> ;
Submit a job document to PrintManager for printing
zxpf:submit:job:1113:xml:<?xml version=\”1.0\” encoding=\”utf-16\” standalone=\”yes\”?>\r\n <template name=\”CuppaJoe\” card_type=\”1\” card_thickness=\”30\” delete=\”false\”>\r\n\t <fonts>\r\n\t\t <font id=\”1\” name=\”Arial\” size=\”11\” bold=\”false\” italic=\”true\” underline=\”false\”/>\r\n\t\t <font id=\”2\” name=\”Arial\” size=\”10\” bold=\”false\” italic=\”false\” underline=\”false\”/>\r\n\t </fonts>\r\n\t <sides>\r\n\t\t <side name=\”front\” orientation=\”landscape\”>\r\n\t\t\t <print_types>\r\n\t\t\t\t <print_type type=\”color\”>\r\n\t\t\t\t\t <graphic format=\”bmp\” width=\”1016\” height=\”632\” x=\”5\” y=\”6\ “delete=\”false\”>CuppaJoe_img_1.bmp</graphic>\r\n\t\t\t\t </print_type>\r\n\t\t\t\t <print_type type=\”mono\”>\r\n\t\t\t\t\t <text font_id=\”1\” width=\”431\” height=\”52\” x=\”299\” y=\”15\”color=\”0x0\”>Cuppa Joe Rewards</text>\r\n\t\t\t\t\t
<text eld=\”Name\” font_id=\”2\” width=\”326\” height=\”47\” x=\”686\” y=\”580\”
color=\”0x0\”/>\r\n\t\t\t\t </print_type>\r\n\t\t\t </print_types>\r\n\t\t </side>\r\n\t\t <side name=\”back\” orientation=\”landscape\”>\r\n\t\t\t <print_types>\r\n\t\t\t\t<print_type type=\”mono\”>\r\n\t\t\t\t\t <graphic format=\”bmp\” width=\”1003\” height=\”630\” x=\”7\” y=\”8\” delete=\”false\”> CuppaJoe_img_2.bmp</graphic>\r\n\t\t\t\t </print_type>\r\n\t\t\t </print_types>\r\n\t\t </side>\r\n\t </sides>\r\n </template>\r\n\r\n ;
Response if the submit commands above succeed: (job id is returned)
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <job_ids> <job_id>15</job_id> <=Job Number returned for data or job document submitted </job_ids> </zxpf_resp>
P1057447-002 PrintManager Programmer's Reference Manual 27
PrintManager Programming Interface
ZXP Card Interface
Example of a response if the submit commands above fail:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>1002</error_code> <detail> Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. </ detail> </zxpf_resp>
Request Command
The Request command requests information from the PrintManager.
Request command syntax: zxpf:request:category:name;
zxpf:request:category:name:size:type:payload;
zxpf = header for the command
request = operation to be performed
category = image list, template list, queue list, or job status
name = name of the data being requested
size = size of the payload in bytes
type = depends upon the category; data can be csv or xml; job is xml
payload = data or job to be submitted
Response to Submit command
If request command succeeds:
<?xml version=”1.0” encoding=”utf-8” ?> <zxpf_resp> <error_code>0</error_code> <detail>No error</detail> </zxpf_resp>
If request command fails:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>error code here</error_code> <detail>description of error code here</detail> </zxpf_resp>
Example Request command
Request the list of images currently stored on PrintManager
zxpf:request:image:list;
28 PrintManager Programmer's Reference Manual P1057447-002
PrintManager Programming Interface
ZXP Card Interface
Response if the request command above succeeds: (list of image le
names is returned)
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <images> <image>Badge</image> <image>CalabriaGardens</image> <image>Golf</image> </images> </zxpf_resp>
Request the list of templates currently stored on PrintManager
zxpf:request:template:list;
Response if the request command above succeeds: (list of template le
names is returned)
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <templates> <template>CuppaJoe</template> <template>LifeGuard</template> <template>SkiPass</template> <template>VisitorBadge</template> </templates> </zxpf_resp>
Request the list of queues currently congured in PrintManager
zxpf:request:information:queues;
Response if the request command above succeeds: (list of queues and
their congurations returned)
<?xml version=”1.0” encoding=”utf-8”?>\r\n <zxpf_resp>r\n <queues>\r\n <queue>\r\n <name>=ZXP8_Queue</ name >\r\n <url>/ZPS/ZXP8_Queue</ url >\r\n <port>9100</port>\r\n <sequence>RoundRobin</sequence>\r\n <model>ZXP Series 8</model>\r\n <ribbon>YMCK</ribbon>\r\n
<lm>Standard</lm>\r\n
<laminate_top></laminate_top>\r\n <laminate_bottom></laminate_bottom>\r\n <sides>2</sides>\r\n <mag>false</mag>\r\n <contact>false</contact>\r\n <contactless>false</contactless>\r\n </queue>\r\n <queue>\r\n <name>ZXP3 Queue</ name >\r\n <url>/ZPS/ZXP3 Queue</url >\r\n <port>9101</port>\r\n <sequence>RoundRobin</sequence>\r\n <model> ZXP Series 3</model>\r\n <ribbon> YMCKO</ribbon>\r\n <sides>2</sides>\r\n <mag>false</mag>\r\n <contact>false</contact>\r\n <contactless>false</contactless>\r\n
P1057447-002 PrintManager Programmer's Reference Manual 29
PrintManager Programming Interface
ZXP Card Interface
</queue>\r\n <queue>\r\n <name>ZXP7 Queue</ name >\r\n <url>ZPS/ ZXP7 Queue</url>\r\n <port>9102</port>\r\n <sequence>RoundRobin</sequence>\r\n <model> ZXP Series 7</model>\r\n <ribbon>YMCK</ribbon>\r\n
<lm></lm>\r\n
<laminate_top></laminate_top>\r\n <laminate_bottom></laminate_bottom>\r\n <sides>2</sides>\r\n <mag>false</mag>\r\n <contact>false</contact>\r\n <contactless>false</contactless>\r\n </queue>\r\n </queues>\r\n </zxpf_resp>
Example of a response if the request command above fail:
<?xml version=”1.0” encoding=”utf-8”?> <zxpf_resp> <error_code>1002</error_code> <detail> Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. </detail> </zxpf_resp>
Request job status from PrintManager: request information on pending
jobs for a specic date
zxpf:request:status:193:xml:<?xml version=’1.0’ encoding=’utf-8’ ?> <zxpf_req> <jobs> <job_status host_ip_addr=’yes’ start_date=’9/28/2012 12:07:08 PM’ end_date=’9/28/2012 12:07:08PM’>pending</job_status> </jobs> </zxpf_req>”
Response if the request command above succeeds: (list of action ids for pending jobs is returned)
<?xml version=\”1.0\” encoding=\”utf-8\”?>\r\n <zxpf_resp>\r\n <jobs>\r\n <job>\r\n <action_id>141</action_id>\r\n <queue>ZXP8 Queue</queue>\r\n <received_date>9/28/2012 12:07:05 PM </received_date>\r\n </job>\r\n </jobs>\r\n </zxpf_resp>
30 PrintManager Programmer's Reference Manual P1057447-002
PrintManager Programming Interface
ZXP Card Interface
Request job status from PrintManager: request information on a specif­ic job
zxpf:request:status:142:xml:<?xml version=”1.0” encoding=”utf-8”?> <zxpf_req > <jobs>
<job_status action_id=’1596’host_ip_addr = ‘yes’>pending</ job_status >
</ jobs> </zxpf_req >
Response if the request command above succeeds: (current status of the job is returned)
Note • In the example below, the status returned is in_progress which indicates the job is currently being printed.
<?xml version=”1.0” encoding=”utf-8”?>r\n <zxpf_resp>\r\n <jobs>\r\n < job>\r\n <action_id>1596</ action_id>\r\n <queue>ZXP8 Queue</ queue>\r\n <printing_status>in_progress</ printing_status>\r\n <printer_ip_addr>10.1.22.56</ printer_ip_addr>\r\n <error_code>0</ error_code >\r\n <received_date>10/4/2012 1:29:48 PM</ received_date>\r\n <start_date>10/4/2012 1:29:56 PM</ start_date>\r\n <complete_date></ complete_date>\r\n <delete_date></ delete_date>\r\n </ job>\r\n </ jobs>\r\n </zxpf_resp>
Note • In the example below, the status returned is done_ok which indicates the job printed successfully.
<?xml version=”1.0” encoding=”utf-8”?>r\n<zxpf_resp>\r\n <jobs>\r\n < job>\r\n <action_id>1596</ action_id>\r\n <queue>ZXP8 Queue</ queue>\r\n <printing_status>done_ok</ printing_status>\r\n <printer_ip_addr>10.1.22.56</ printer_ip_addr>\r\n <error_code>0</ error_code >\r\n <received_date>10/4/2012 1:29:48 PM</ received_date>\r\n <start_date>10/4/2012 1:29:56 PM</ start_date>\r\n <complete_date>10/4/2012 1:34:26 PM </ complete_date>\r\n <delete_date></ delete_date>\r\n </ job>\r\n </ jobs>\r\n </zxpf_resp>
P1057447-002 PrintManager Programmer's Reference Manual 31
PrintManager Programming Interface
Sending Document to PrintManager
Sending Document to PrintManager
All documents, template, job, and data, are delivered to PrintManager in the same manner: using TCP/IP. The process of sending documents to PrintManager involves: opening a TCP/IP connection between the host PC and the PC running PrintManager, sending the documents via this TCP/IP connection, receiving a response from PrintManager, parsing the response to determine whether or not the document was successfully delivered to PrintManager, and closing the TCP/IP connection.
Note • Data documents are sent to PrintManager in the same manner regardless of their format: XML or CSV.
This section demonstrates how to send a document to PrintManager from a host PC running Windows and how to parse PrintManager’s response to determine whether or not the document was delivered successfully. The sample code demonstrated in this section is written in the C# language; however, it is not a requirement to use C#.
Open a TCP/IP Connection
Declare the required variables, instantiate the required objects and open the TCP/IP connection. Note: error handling and other programming code has been intentionally omitted.
Socket s = null; IPAddress address = null; string ipAddress = “10.1.24.29”; int port = 9100;
IPAddress.TryParse(ipAddr, out address);
IPEndPoint endpoint = new IPEndPoint(address, port);
s = new Socket(endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);\
//open connection: s.Connect(endpoint);
Send a Document
Declare the required variables, and send the document to PrintManager. The sample code depicted here builds upon the sample code shown in the previous section. Note: Error handling and other programming code has been intentionally omitted.
byte[ ] buf = null; int size = 0;
//set communincation timeout: s.SendTimeout = 30000;
//convert the data document string to its equivalent bytes: buf = ASCIIEncoding.ASCII.GetBytes(jobDoc);
//send the document: s.Send(buf, 0, buf.Length, SocketFlags.None);
32 PrintManager Programmer's Reference Manual P1057447-002
Receive PrintManager’s Response
Declare the required variables, and receive PrintManager’s response. The sample code depicted here builds upon the sample code shown in the previous sections. Note: error handling and other programming code has been intentionally omitted.
int bytesRead = 0;
// Response data buffer, sized to read rst four bytes (payloadSize)
byte[] respBuffer = new byte[4];
// Offset into respBuffer int offset = 0;
// Number of bytes to read int bytesToRead = respBuffer.Length;
// Initialize socket receive parameters s.ReceiveBufferSize = respBuffer.Length; s.ReceiveTimeout = 30000;
PrintManager Programming Interface
Sending Document to PrintManager
//get reply from PrintManager
// Read rst four bytes to determine payload length
do { bytesRead = s.Receive(respBuffer, offset, bytesToRead, SocketFlags.None); if (bytesRead > 0) { offset += bytesRead; // Increment offset into respBuffer bytesToRead -= bytesToRead; // Subtract number of bytes remaining } } while (bytesToRead > 0);
// Convert four byte response to payload length int payloadSize = BitConverter.ToInt32(respBuffer, 0);
// Clear and resize respBuffer to payloadSize Array.Clear(respBuffer, 0, respBuffer.Length); Array.Resize(ref respBuffer, payloadSize);
// Read the rest of the response data (payloadSize) do { bytesRead = s.Receive(respBuffer, offset, bytesToRead, SocketFlags.None); if (bytesRead > 0) { offset += bytesRead; // Increment offset into respBuffer bytesToRead -= bytesRead; // Subtract number of bytes remaining } } while (bytesToRead > 0);
size = respBuffer.Length;
P1057447-002 PrintManager Programmer's Reference Manual 33
PrintManager Programming Interface
Sending Document to PrintManager
Parse the Received Response
Declare the required variables, and receive PrintManager’s response. The sample code depicted here builds upon the sample code shown in the previous sections. Note: error handling and other programming code has been intentionally omitted.
To determine whether or not the document was received correctly, check for an error condition. In the case of a data document or job document, a check of the
response for a jobID can also be made. The presence of a job id conrms that the
data document or job document has been submitted to a printer as a print job to be processed.
The sample code below demonstrates how to determine if a data document or job document was delivered successfully.
string errorCondition = “zxpf_resp/error_code”;
string errorDescription = “zxpf_resp/detail”; string job_id = “zxpf_resp/job_ids/job_id”;
string errorStr = string.Empty; string errDetail = string.Empty; string JobId = string.Empty;
XmlDocument doc = new XmlDocument();
//convert received bytes into a string string resp = Encoding.ASCII.GetString(respBuffer);
//determine if response indicates an error condition: doc.LoadXml(resp); XmlNode node = doc.SelectSingleNode(errorCondition);
if (node != null && !string.IsNullOrEmpty(node.InnerText)) { //error: document not delivered successfully
//get error code errorStr = node.InnerText;
int errCode; Int32.TryParse(errorStr, out errCode);
//get error description: node = doc.SelectSingleNode(errorDescription); if (node != null && !string.IsNullOrEmpty(node.InnerText)) { errDetail = node.InnerText; //get error description } } else //document delivered successfully { //get job id node = doc.SelectSingleNode(job_id); if (node != null && !string.IsNullOrEmpty(node.InnerText)) { JobId = node.InnerText; //get job ID } }
34 PrintManager Programmer's Reference Manual P1057447-002
Close a TCP/IP Connection
Close the TCP/IP connection and release the allocated memory. The sample code depicted here builds upon the sample code shown in the previous sections. Note: error handling and other programming code has been intentionally omitted.
s.Close(); s = null; buf = null;
PrintManager Programming Interface
Sending Document to PrintManager
P1057447-002 PrintManager Programmer's Reference Manual 35
PrintManager Programming Interface
Sending ZMotif-Based Jobs to PrintManager
Sending ZMotif-Based Jobs to PrintManager
Sending ZMotif-based jobs to PrintManager involves the use of the ZMotif SDK to build the job, open a TCP/IP connection between the host PC and the PC running PrintManager, build the job, send the job via this TCP/IP connection, receive PrintManager’s response, and close the TCP/IP connection.
Unlike template-based printing, the response from PrintManager does not require parsing to determine if a job was successfully delivered. Instead, the response will include a job id if delivered. In the case of a failure, the SDK will throw an exception identifying the cause of the failure. Another difference between template-based printing and ZMotif-based printing is that the ZMotif SDK requires the host PC to be running a version of the Windows operating system.
This section demonstrates how to send a ZMotif-based job to PrintManager using the SDK and how to determine whether or not the job was delivered successfully.
Note: The sample code demonstrated in this section is written in the C# language; however, it is not a requirement to use C#.
The programming code demonstrated here is a basic, high-level view of the ZMotif SDK. Please consult the ZMotif Programmers Reference Manual for details. Complete, sample applications, written in several programming languages, are available upon request from Zebra’s SDK support team at Card_SDK_Questions@ zebra.com.
Open a TCP/IP Connection
Declare the required variables, instantiate the required objects, and open the TCP/IP connection. Note: Error handling and other programming code has been intentionally omitted.
string ipAddress = “10.1.24.29”; int port = 9100; Job job = new Job(); if (!job.IsOpen) { ipAddress += “:”;
ipAddress += port.ToString(); job.Open(iPAddress); }
Build a print job
Building a job includes dening the side of the card to be printed on, whether or not
the printing is to be color or monochrome, and the type of information to be printed on the card. The sample code below demonstrates how a job would be built to print a bitmap image on the front-side of a card, and builds upon the sample code shown in the previous section. Note: Error handling and other programming code has been intentionally omitted.
job.BuildGraphicsLayers(SideEnum.Front, PrintTypeEnum.Color, 0, 0, 0, -1, GraphicTypeEnum.BMP, bmpFront);
36 PrintManager Programmer's Reference Manual P1057447-002
Send a print job
Sending a job requires dening how many copies of the card should be printed and
retrieving a job id from PrintManager. The sample code below demonstrates how to send a job to PrintManager, and builds upon the sample code shown in the previous sections.
Note: If an invalid job is built using the SDK, the SDK will throw an exception upon trying to send the job to PrintManager. Error handling and other programming code has been intentionally omitted.
int copies = 1; int jobID = 0;
job.PrintGraphicsLayers(copies, out jobID);
Receive PrintManager’s Response
Receiving PrintManager’s response is nothing more than checking the jobID
returned to conrm a non-zero value has been received. The sample code below demonstrates conrming PrintManager returned a non-zero job id, and builds upon
the sample code shown in the previous sections.
if (jobID > 0) //valid job id returned: job delivered to PrintManager successfully { //take appropriate action for valid job } else //invalid job id returned: failed to deliver job to PrintManager { //take appropriate action for invalid job } catch (Exception e) { //job built & delivered to PrintManager was invalid //examine exception to determine the problem with job }
PrintManager Programming Interface
Sending ZMotif-Based Jobs to PrintManager
Close a TCP/IP Connection
Close the TCP/IP connection and release the allocated memory. The sample code depicted here builds upon the sample code shown in the previous sections. Note: error handling and other programming code has been intentionally omitted.
job.Close(); do { Thread.Sleep(10); } while (Marshal.FinalReleaseComObject(job) > 0);
job = null;
P1057447-002 PrintManager Programmer's Reference Manual 37
38 PrintManager Programmer's Reference Manual P1057447-002
Appendix C
Worldwide Support
For Technical Support or Repair Services, contact the appropriate facility listed below.
North America and Latin America - Technical Support
T: +1 877 ASK ZEBRA (877 275 9327) +1 847 913 2259 E: ts1@zebra.com
North America and Latin America - Repair Services
Before returning any equipment to Zebra Technologies Corporation for in-warranty or out-of-warranty repair, contact Repair Services for a Repair Order (RO) number. Mark the RO number clearly on the outside of the box. Ship the equipment, freight prepaid, to the address listed below:
Zebra Technologies Repair Services 333 Corporate Woods Parkway Vernon Hills, IL 60061 webform: www.zebra.com/repair T: +1 877 ASK ZEBRA (877 275 9327) E: repair@zebra.com
P1057447-002 PrintManager Programmer's Reference Manual 39
Worldwide Support
Europe, Middle East, and Africa - Technical Support
Language Phone Email
Arabic +971 (0)46058220 zebraCareUAE@zebra.com
Dutch +31 (0)33 450 50 48 ZebraCareBNL@zebra.com
English (UK) +44 (0)1628 556 225 zebraCareUK@zebra.com
(Sweden) +46 (0)8 594 709 88 zebraCareUK@zebra.com
(South Africa) +27 (0)11 201 7712 zebracareSA@zebra.com
French +33 (0) 1 53 48 12 74 zebraCareFR@zebra.com
German +49 (0) 2159 676 870 zebraCareDE@zebra.com
Hebrew +97 236 498 140 ZebraCareIL@zebra.com
Italian +39 0 2 575 06388 ZebraCareIT@zebra.com
Polish +48 223 801 980 zebraCarePL@zebra.com
Russian +7 495 739 5993 ZebraCareRU@zebra.com
Spanish +34 (0) 917 992 896 zebraCareES@zebra.com
Turkish +90 212 314 1010 zebraCareTR@zebra.com
For further assistance, contact:
Zebra Technologies Card Printer Solutions Dukes Meadow Millboard Road, Bourne End Buckinghamshire SL8 5XF, UK
T: +44 (0) 1628 556 025 F: +44 (0) 1628 556 001 E: cardts@zebra.com
40 PrintManager Programmer's Reference Manual P1057447-002
Europe, Middle East, and Africa - Repair Services
Before returning any equipment to Zebra Technologies Corporation for in-warranty or out-of-warranty repair, contact your supplier for a Return Materials Authorization (RMA) number, or contact one ot the following repair centers for support and instructions:
Type of repair and location Phone Email
Depot Repair in Germany, Austria, Switzerland
Depot Repair in France +33 (0) 1 53 48 12 74 zebracareFR@zebra.com
Depot and On-Site Repair in UK and Ireland
Depot Repair in South Africa +27 (0) 11 201 7777 -
Depot Repair in Middle East +971 (0) 46058220 support_dxb@emitac.ae
For further assistance, contact:
+49 (0) 2159 676 870 zebracareDE@zebra.com
+44 (0) 1628 556 225 zebracareUK@zebra.com
Worldwide Support
For assistance anywhere in the EMEA, contact After Sales Customer Services at:
T: + 44 (0) 177 2 69 3069 E: ukrma@zebra.com
P1057447-002 PrintManager Programmer's Reference Manual 41
Worldwide Support
Asia Pacic - Technical Support
Zebra Technologies Asia Pacic Pte. Ltd.
120 Robinson Road #06-01 Parakou Building Singapore 068913
T: +65 6858 0722 F: +65 6885 0838
E: tsasiapacic@zebra.com
Asia Pacic - Repair Services
Before returning any equipment to Zebra Technologies Corporation for in-warranty or out-of warranty repair, contact Repair Services for a Return Materials Authorization (RMA) number. Repack the equipment in the original packing material, and mark the RMA number clearly on the outside. Ship the equipment, freight prepaid, to either address listed below:
Zebra Technologies Asia Pacic Pte. Ltd.
No.5 Changi North Way Level 3 Singapore 498771 Agility Building T: +65 6546 2670 ext 3203 and 3204 F: +65 6546 5328 E: APACRepair@zebra.com
Zebra Website
http://www.zebra.com km.zebra.com (Knowledge Base)
42 PrintManager Programmer's Reference Manual P1057447-002
Loading...