Monarch®
Pathfinder®
Ultra® Platinum
6039™ Printer
Microsoft® Visual
Studio® .NET 2003 & 2005
Microsoft® Visual
Basic®
Microsoft® Visual
C#®
Microsoft®, Windows®, Visual Studio®, Visual Basic®, and Visual C#® are trademarks of Microsoft Corporation, Inc. TC6039NETPM Rev. AE 1/08 ©2007 Paxar Americas, Inc. a subsidiary of Avery Dennison Corp. All rights reserved.
Each product and program carries a respective written warranty, the only warranty on which the customer can rely. Paxar reserves the right to make changes in the product and the programs and their availability at any time and without notice. Although Paxar has made every effort to provide complete and accurate information in this manual, Paxar shall not be liable for any omissions or inaccuracies. Any update will be incorporated in a later edition of this manual.
©2007 Paxar Americas, Inc. a subsidiary of Avery Dennison Corp. All rights reserved. No part of this publication may be reproduced, transmitted, stored in a retrieval system, or translated into any language in any form by any means, without the written permission of Paxar Americas, Inc.
Trademarks
Monarch®, Pathfinder®, Ultra®, MPCL, and 6039 are trademarks of Paxar Americas, Inc. Paxar® is a trademark of Paxar Corporation.
Avery Dennison® is a trademark of Avery Dennison Corporation.
UFST, Monotype, the Monotype logo, and CG Triumvirate are trademarks of Monotype Imaging, Inc.
Avery Dennison Printer Systems Division
170 Monarch Lane
Miamisburg, OH 45342
T A B L E O F C O N T E N T S
Introduction ................................................................................................ |
1-1 |
Audience ................................................................................................ |
1-1 |
Using this Manual .................................................................................... |
1-1 |
System Requirements .............................................................................. |
1-2 |
Software Requirements ......................................................................... |
1-2 |
Minimum Hardware Requirements .......................................................... |
1-2 |
SDK Contents ......................................................................................... |
1-3 |
Related Documentation ............................................................................ |
1-3 |
About the Printer ..................................................................................... |
1-4 |
Speaker .............................................................................................. |
1-4 |
Memory ............................................................................................... |
1-4 |
Display................................................................................................ |
1-4 |
Scanner .............................................................................................. |
1-4 |
Keyboard............................................................................................. |
1-5 |
Fonts ..................................................................................................... |
1-6 |
Using Non-Resident Fonts ..................................................................... |
1-6 |
Developing Applications .............................................................................. |
2-1 |
Creating MPCL Packets ........................................................................... |
2-1 |
Writing Applications ................................................................................. |
2-4 |
Building Applications ............................................................................... |
2-4 |
Import Files ......................................................................................... |
2-4 |
Scanner Function Overview ...................................................................... |
2-5 |
Using the Scanner ................................................................................ |
2-5 |
Transferring Files to the Printer ................................................................ |
2-6 |
Programming Notes ................................................................................. |
2-7 |
i
Printing Functions ...................................................................................... |
3-1 |
Stock ..................................................................................................... |
3-2 |
Calibrate............................................................................................. |
3-2 |
nStockType ......................................................................................... |
3-3 |
Battery................................................................................................... |
3-4 |
IsBatteryOKToPrint .............................................................................. |
3-4 |
nBatteryLevel ...................................................................................... |
3-5 |
Printing .................................................................................................. |
3-7 |
Feed .................................................................................................. |
3-7 |
File .................................................................................................... |
3-8 |
Text ................................................................................................. |
3-10 |
LastPrintStatus .................................................................................. |
3-12 |
TextDoubleByte ................................................................................. |
3-14 |
Byte ................................................................................................. |
3-16 |
FileParse .......................................................................................... |
3-18 |
Sensors ............................................................................................... |
3-19 |
fBlackMark ........................................................................................ |
3-19 |
fOnDemand ....................................................................................... |
3-21 |
Misc .................................................................................................... |
3-23 |
ClearError ......................................................................................... |
3-23 |
LockCfgMenu .................................................................................... |
3-24 |
nStatus ............................................................................................. |
3-25 |
ShiftMode ......................................................................................... |
3-27 |
ii
Scanning Functions ..................................................................................... |
4-1 |
General Class ......................................................................................... |
4-2 |
AimDuration......................................................................................... |
4-2 |
BdirRedundancy ................................................................................... |
4-3 |
GoodScanWav ..................................................................................... |
4-4 |
LinearSecurity ..................................................................................... |
4-5 |
NoReadWav......................................................................................... |
4-5 |
Preamble............................................................................................. |
4-7 |
Postamble ........................................................................................... |
4-8 |
Timeout ............................................................................................... |
4-9 |
Bar Code Classes .................................................................................. |
4-10 |
Codabar ............................................................................................ |
4-10 |
Code128 ........................................................................................... |
4-12 |
Code39 ............................................................................................. |
4-14 |
Code93 ............................................................................................. |
4-17 |
D2of5 ................................................................................................ |
4-19 |
I2of5 ................................................................................................. |
4-21 |
MSI................................................................................................... |
4-24 |
RSS .................................................................................................. |
4-26 |
UPCEAN ........................................................................................... |
4-28 |
iii
Control Class........................................................................................ |
4 |
-34 |
CommitChanges ................................................................................ |
4 |
-34 |
DataMode ......................................................................................... |
4 |
-35 |
EnableScanning................................................................................. |
4 |
-37 |
DisableAllCodes ................................................................................ |
4 |
-38 |
DisableScanning ................................................................................ |
4 |
-39 |
ScannerMode .................................................................................... |
4 |
-40 |
SendScanStatus ................................................................................ |
4 |
-42 |
Trigger ............................................................................................. |
4 |
-43 |
TriggerMode...................................................................................... |
4 |
-44 |
SendScanStatus Codes ...................................................................... |
4 |
-46 |
Sample Applications ................................................................................... |
A-1 |
|
VB.NET Demo Sample ............................................................................. |
A-1 |
|
C# Demo Sample .................................................................................... |
A-7 |
|
VB.NET Scan/Print Sample .................................................................... |
A-14 |
|
C# Scan/Print Sample ........................................................................... |
A-33 |
iv
I N T R O D U C T I O N |
1 |
The Monarch® Pathfinder® Ultra® Platinum 6039™ software development kit (SDK) helps developers write applications for the Monarch® Pathfinder® Ultra® Platinum 6039™ printer.
This manual includes the library for developers using
♦Microsoft® Visual Studio® .NET 2003 (for Compact Framework 1.0).
♦Microsoft® Visual Studio® .NET 2005 (for Compact Framework 2.0).
The .NET framework includes compilers for Microsoft Visual Basic and Microsoft Visual C# . This manual includes samples for both Visual Basic and Visual C#.
Information in this document supercedes information in previous versions. Check our Web site (www.paxar.com) for the latest documentation and release information.
A u d i e n c e
This manual is written for experienced Microsoft® Visual Studio® .NET 2003 and 2005 programmers who write printer applications for the Microsoft® Windows® CE 5.0 platform. These programmers should also be familiar with the Monarch® Printer Control Language (MPCLII).
U s i n g t h i s M a n u a l
Following is a summary of the contents of this manual:
Chapter |
Contents |
|
1 |
Introduction |
Information you should know before using the SDK. |
2 |
Developing |
Information about developing applications using the |
|
Applications |
SDK. |
3 |
Printing |
Contains syntax, definitions, and examples of each |
|
Functions |
printing function. |
4 |
Scanning |
Contains syntax, definitions, structures, and examples of |
|
Functions |
each scanning function. |
A |
Sample |
Sample applications written using Microsoft Visual |
|
Applications |
Basic and Microsoft Visual C# . |
Introduction 1-1
S y s t e m R e q u i r e m e n t s
Following are the hardware and software requirements:
Software Requirements
♦Windows® 2000 Professional Edition and Windows® 2000 Service Pack 3 or later; or Windows® XP Professional Edition and Windows® XP.
Note: The Microsoft® Windows Vista™ operating system is not currently supported.
♦Microsoft ActiveSync synchronization software. The ActiveSync software is available on the Microsoft Web site (Microsoft.com) by searching on ActiveSync.
♦Microsoft® Visual Studio® .NET 2003 or 2005
Minimum Hardware Requirements
♦Desktop computer with Pentium® II, 450Mhz (Pentium® III, 600Mhz recommended)
♦Super VGA or higher monitor
♦CD-ROM or DVD-ROM drive
♦96 MB (128 MB recommended) memory for Windows® 2000 Professional and 160 MB for Windows® XP Professional
♦900 MB of free hard disk space
♦USB port
♦USB cable (part number 125859).
1-2 Programmer’s Manual
S D K C o n t e n t s
The SDK is located in the directory you specified during installation. It is divided into several sub-directories, as described below.
Sub-directory |
Description |
bin |
Development tools |
docs |
Online documentation |
include |
Include files |
lib |
Library files |
samples |
Source code samples |
utilities |
Utility programs |
R e l a t e d D o c u m e n t a t i o n
The following table describes other documentation for the printer:
Item |
Description |
Quick Reference |
Includes basic start-up information such as |
|
supply loading, cleaning and minor |
|
troubleshooting. |
Operator’s Handbook |
Includes information about using the printer, |
|
charging the battery, loading supplies, and |
|
more. |
Packet Reference Manual |
Includes syntax descriptions of the MPCL |
|
printer language to design a format. |
System Administrator’s |
Includes information about printer diagnostics, |
Guide |
configuring the scanner, and using scanner |
|
diagnostics. |
Introduction 1-3
A b o u t t h e P r i n t e r
There are several printer features that you must understand before you write an application, such as the speaker, memory, display, and keyboard.
Speaker
Applications can make the printer’s speaker beep for different lengths of time and frequencies or play a .wav file. For example, you might use the speaker to bring an error to the operator’s attention or to indicate a good scan. Refer to the Microsoft® Visual Studio® .NET 2003 or 2005 documentation to use the speaker.
Memory
The printer contains 64 MB of Flash memory and 32 MB of RAM. The Flash memory contains the kernel and permanent storage used for user applications.
Display
The printer has a touch screen display (with a backlight) similar to a hand held computer. Refer to the Microsoft® Visual Studio® .NET 2003 or 2005 documentation to write messages to the display.
Scanner
Each printer comes with the Symbol SE-955 bar code scanner.
See Chapter 4, “Scanning Functions” for functions and data structures for scanning.
1-4 Programmer’s Manual
Keyboard
The printer’s keyboard appears to the right.
Refer to the Microsoft® Visual Studio® .NET 2003 or 2005 documentation to use the keyboard.
Key(s) |
Description |
||
Enter |
Accepts data or a menu selection. |
||
Tab |
Tabs to the next tab stop or the next field. Pressing Fct + Tab |
||
|
|
|
backspaces a tab stop or returns to the previous field. |
Fct |
Performs an application-defined function when pressed with a |
||
|
|
|
single-digit number. |
Alpha |
Enters upper case or lower-case alphabetic mode. |
||
Right |
Moves the cursor to the right in a menu. |
||
Arrow |
Pressing Fct + right arrow scrolls the cursor down in a menu. |
||
Left |
Moves the cursor to the left in a menu. |
||
Arrow |
Pressing Fct + left arrow scrolls the cursor up in a menu. |
||
|
|
|
Backspaces in Alpha mode. |
On/Off |
|
|
Turns on and off the printer. |
|
|||
|
|||
Numeric/ |
Displays a numeric digit or letter. |
||
Alphabetic |
|
Introduction 1-5
F o n t s
The printer has many resident fonts. You must load other fonts separately. Following is a list of these fonts and their IDs:
Standard (1), Reduced (2), Bold (3), OCRA (4), HR1 (5), and HR2 (6)
EFF Swiss Bold (50)
CG Triumvirate Typeface Bold (Full Character Set) 6.5 pt. (1000)
CG Triumvirate Typeface Bold (Full Character Set) 10 pt. (1002)
CG Triumvirate Typeface Bold (Partial Character Set) 18 pt. (1004)
CG Triumvirate Typeface Bold Condensed (Full Character Set) 6.5 pt. (1006)
CG Triumvirate Typeface Bold Condensed (Full Character Set) 10 pt. (1008)
CG Triumvirate Typeface Bold Condensed (Partial Character Set) 18 pt. (1010)
Letter Gothic Bold (Full Character Set) 6 pt. (1012)
CG Triumvirate Typeface Bold 9 pt. (10)
CG Triumvirate Typeface 6 pt. (11)
CG Triumvirate Typeface Bold (Full Character Set) 8 pt. (1001)
CG Triumvirate Typeface Bold (Full Character Set) 12 pt. (1003)
CG Triumvirate Typeface Bold (Partial Character Set) 22 pt. (1005)
CG Triumvirate Typeface Bold Condensed (Full Character Set) 8 pt. (1007)
CG Triumvirate Typeface Bold Condensed (Full Character Set) 12 pt. (1009)
CG Triumvirate Typeface Bold Condensed (Partial Character Set) 22 pt. (1011)
Letter Gothic Bold (Full Character Set) 9 pt. (1013)
Note: The partial character set fonts contain only numeric and special characters. With fonts 1012 and 1013, the space character is only 70% as wide as the other characters.
Using Non-Resident Fonts
Within your application, instantiate a new Print class such as rPrint and call a method such as Text or File to load the non-resident font or a font you have created with the MPCL Toolbox Font Utility.
1-6 Programmer’s Manual
D E V E L O P I N G A P P L I C AT I O N S |
2 |
This chapter describes how to develop an application for the printer.
You will need to:
1. Create MPCL packets for your labels and tags, if needed.
2. Write the application.
3. Build the application.
4. Transfer or copy the application to the printer. See “Transferring Files” for more information.
C r e a t i n g M P C L P a c k e t s
An application prints labels by submitting MPCL packets to the printer. Refer to the 6039 Packet Reference Manual for more information.
Within your application, instantiate a new Print class such as rPrint and call a method such as Text when you need to print. For example,
Developing Applications 2-1
VB.NET Sample
Imports Ultra |
' Platinum Library |
Dim fmtUPCA As String = "{F,1,A,R,E,200,200," & Chr(34) & "UPCA" _
& Chr(34) & "|" & "C,150,49,0,50,8,8,A,L,0,0," & Chr(34) & "Demo _ VB.NET" & Chr(34) & "|"
& "B,1,12,F,25,28,1,4,100,7,L,0|}"
Dim rPrint |
As |
New Print |
' |
Instantiate |
Print class |
||
rPrint.ClearError() |
|
' |
Clear |
any |
errors |
||
If (Not rPrint.IsBatteryOKToPrint) |
Then |
' Check |
Battery |
||||
MsgBox("Low Battery", MsgBoxStyle.OKOnly, "Battery Check") |
|||||||
Else |
|
|
|
|
|
|
|
'--Print Format and then Batch Data |
|
|
|
||||
rPrint.Text |
= |
fmtUPCA |
|
|
|
|
|
rPrint.Text |
= |
"{B,1,N,1|E,0,0,1,1,0,1|" |
|
|
|
||
rPrint.Text |
= |
"1," & Chr(34) |
& txtUPC.Text & Chr(34) & "|}" |
End If
This example prints the data stored in the fmtUPCA string and quotation marks (decimal value 34) around the data stored in the txtUPC.Text field. The rPrint.Text lines contain the batch data.
2-2 Programmer’s Manual
C# Sample
using Ultra; |
// Platinum Library |
string fmtUPCA = "{F,1,A,R,E,200,200,\"UPCA\"|"
+"C,150,49,0,50,8,8,A,L,0,0,\"Demo C Sharp\",1|"
+"B,1,12,F,25,28,1,4,100,7,L,0|}";
Ultra.Print rPrint = |
new Print(); |
// |
Instantiate Print |
|
rPrint.ClearError(); |
|
// |
// |
class |
|
Clear |
any errors |
||
if (!rPrint.IsBatteryOKToPrint) |
// |
Check |
Battery |
MessageBox.Show("Low Battery", "Battery Check");
else
{
//--Print Format and Batch Data
rPrint.Text = fmtUPCA;
rPrint.Text = "{B,1,N,1|E,0,0,1,1,0,1| rPrint.Text = 1,\"" + txtUPC.Text + "\"|}";
}
This example prints the data stored in the fmtUPCA string and the data stored in the txtUPC.Text field. The rPrint.Text lines contain the batch data.
Developing Applications 2-3
W r i t i n g A p p l i c a t i o n s
The SDK is designed to work with the Microsoft® Visual Studio® development system using the .NET 2003 and 2005 framework. This compiler can be downloaded free of charge from the Microsoft.com Web site.
Note: To lock access to functions, such as the display, video, control panel, refer to your standard Microsoft Windows documentation.
B u i l d i n g A p p l i c a t i o n s
When you are finished writing the application, select Build Application to build and then, Deploy Application to download the application. The application and associated files can also be copied by using the procedure defined in “Transferring Files.”
In addition, you can also Build a Cab File. Refer to your Microsoft® Visual Studio® .NET documentation for more information.
Import Files
You must always use Ultra.dll. This .dll file contains the scanning and printing information.
For Socket programming, refer to your standard Microsoft® Windows documentation.
2-4 Programmer’s Manual
S c a n n e r F u n c t i o n O v e r v i e w
The scanner contains a buffer to hold the data from a scan. The application receives data from the system by one of two methods. The first method is by the standard keyboard input and second method is by a special Windows message. See Chapter 4, “Scanning Functions” for information about the two methods.
Using the Scanner
To use the scanner, the application must:
1. Include the code to instantiate the class. For example, using VB.NET:
Dim MyScanner As New Ultra.Scan.General
MyScanner.Postamble = “\n\r”
Dim Scanner As New Ultra.Scan.Control
Scanner.SendScanStatus = False
2. Configure the control scanning attributes and the attributes for each bar code. For example, using VB.NET:
Dim UPC As New Ultra.Scan.UPCEAN
UPC.EnableUPCA = True
UPC.EnableUPCE = False
3. Call the CommitChanges function to save the new settings. For example, using VB.NET
Scanner.CommitChanges()
Developing Applications 2-5
T r a n s f e r r i n g F i l e s t o t h e P r i n t e r
To transfer files between the printer and a computer, you need to have Microsoft ActiveSync Synchronization Software installed on your computer.
Download the ActiveSync synchronization software from the Microsoft.com Web site. Follow the download instructions on the site.
To transfer data files to the printer:
1. Open the folder with your data files on your computer.
2. Turn on the printer and wait thirty seconds for the desktop to load.
Note: For large file transfers, change the Switch State to Suspend setting on the printer to a longer delay time so the printer does not shut down during the transfer.
3. Attach the USB cable to your computer and printer.
4. Click Explore on the Microsoft ActiveSync utility after it connects to the printer. A new window appears called Mobile Device.
5. Open the destination folder for the data files on the Mobile Device (printer).
6. Drag the files from your computer to the Mobile Device folder.
2-6 Programmer’s Manual
P r o g r a m m i n g N o t e s
♦Include the Ultra.dll import file in all your applications. Without it, you are not able to access any scanner or printing functions.
For example,
Imports Ultra |
‘ for VB.NET |
Using Ultra; |
// for C# |
♦Test your application once you have loaded it into the printer.
♦The libraries included in this SDK are designed to support Microsoft® Visual Basic® 2003 and 2005; therefore, some function names changed. Visual Basic and Visual Studio® 2005 are case insensitive. Visual C#® is case sensitive. Many developers use the same name for Type Defines and functions, just by varying the case. However, varying the case creates a new name and your application may not function as designed.
♦Train the end users (operators) and/or their supervisor (system administrator) on the application. They also must know how to perform procedures (loading supplies, for example) that may vary from the generic descriptions in the Operator’s Handbook.
♦When a file is saved in RAM, it is lost when the charge in the main battery and backup battery has been depleted. A file saved in the Onboard Flash folder or SD (Secure Digital) memory card is saved even when both batteries have been depleted.
♦For Socket programming, refer to your standard Microsoft Windows documentation.
♦When you are finished writing the application, select Build Application to build and Deploy Application to download the application. In addition, you can also Build a cab file. Refer to your Microsoft® Visual Studio® .NET documentation for more information.
♦To lock access to functions, such as the display, video, control panel, refer to your standard Microsoft Windows documentation.
Developing Applications 2-7
2-8 Programmer’s Manual
P R I N T I N G F U N C T I O N S |
3 |
The SDK contains a library of functions you can call in your application. The functions are divided into two categories: Printing Interface and Scanning Interface.
This chapter describes the printer management functions and data structures. See Chapter 4, “Scanning Functions” for scanning functions.
The function and data structure names are casesensitive.
Note: Refer to the Microsoft® Visual Studio® .NET 2003 or 2005 documentation to configure the keyboard, sound, and display.
The libraries included in this SDK are designed to support Microsoft® Visual Basic® 2003 and 2005; therefore, some function names changed. Visual Basic and Visual Studio® 2005 are case insensitive. Visual C#® is case sensitive. Many developers use the same name for Type Defines and functions, just by varying the case. However, varying the case creates a new name and your application may not function as designed.
Type |
Functions |
|
Stock |
Calibrate |
|
|
nStockType |
|
Battery |
nBatteryLevel |
IsBatteryOKToPrint |
Printing |
Feed |
TextDoubleByte |
|
File |
Byte |
|
Text |
FileParse |
|
LastPrintStatus |
|
Sensors |
fBlackMark |
fOnDemand |
|
|
|
Misc |
ClearError |
LockCfgMenu |
|
nStatus |
ShiftMode |
Printing Functions 3-1
S t o c k
Calibrate
Description
Calibrates the supplies in the printer and gives the supply information to the Print subsystem.
Operators can load supplies (as described in the Operator’s Handbook) before running an application, but they cannot calibrate the supplies until the application calls this function. In general, you should display a prompt (“Load your supplies,” for example) and require the operator to press a key, such as the trigger, to call this function.
Do not use this function when using fax paper because it has no black mark to detect.
Syntax
public void Calibrate()
Parameters
None
Return Values
None
Example C#
using Ultra; |
|
|
{ |
// |
Instantiate class |
Ultra.Print rPrint = new Print(); |
||
rPrint.Calibrate(); |
// |
Calibrate Supply |
} |
|
|
Example VB.NET
Imports Ultra |
New Print |
' |
Instantiate class |
Dim rPrint As |
|||
rPrint.Calibrate(); |
' |
Calibrate Supply |
3-2 Programmer’s Manual
nStockType
Description
Sets the supply type in the printer. public eSTOCK_TYPE nStockType
Parameters
STOCK_PAPER |
|
|
Paper |
|
|
|
STOCK_FAX |
|
|
Fax |
|
|
|
STOCK_SYNTHETIC |
|
|
Synthetic |
|
|
|
Return Values |
|
|
|
|
|
|
STOCK_PAPER |
|
|
Paper |
|
|
|
STOCK_FAX |
|
|
Fax |
|
|
|
STOCK_SYNTHETIC |
|
|
Synthetic |
|
|
|
Example C# |
|
|
|
|
|
|
using Ultra; |
|
|
|
|
|
|
{ |
|
= |
new Print(); |
// |
Instantiate |
class |
Ultra.Print rPrint |
||||||
rPrint.nStockType |
= |
Ultra.Print.eSTOCK_TYPE.STOCK_PAPER; |
||||
} |
|
|
|
// |
Stock Type |
= Paper |
|
|
|
|
|
|
|
Example VB.NET |
|
|
|
|
|
|
Imports Ultra |
|
' |
Instantiate |
class |
||
Dim rPrint As New |
|
|||||
rPrint.nStockType |
= |
rPrint.eSTOCK_TYPE.STOCK_PAPER; |
Paper |
|||
|
|
|
' |
Set Stock Type to |
Printing Functions 3-3
B a t t e r y
IsBatteryOKToPrint
Description
Checks if the printer’s LiIon battery (located in the handle) is charged enough to allow printing. Check the battery level before any printing session.
Use this function immediately prior to printing, but not during printing. If you use it during printing, the return value is not accurate.
Syntax
public bool IsBatteryOKToPrint
Parameters
None
Return Values
FALSE The battery level is too low to allow printing. TRUE The battery level is high enough to allow printing.
Example C#
using Ultra; |
|
|
{ |
//Instantiate class |
|
Ultra.Print rPrint = new Print(); |
||
rPrint.ClearError(); |
|
// Clear any errors |
if (!rPrint.IsBatteryOKToPrint) |
|
// Not OK to Print |
MessageBox.Show("Low Battery", |
"Battery Check"); |
|
} |
|
|
Example VB.NET |
|
|
Imports Ultra |
|
' Instantiate class |
Dim rPrint As New Print |
|
|
rPrint.ClearError() |
|
' Clear any errors |
If (Not rPrint.IsBatteryOKToPrint) Then |
' Not OK to Print? |
MsgBox("Low Battery", MsgBoxStyle.OKOnly, "Battery Check")
3-4 Programmer’s Manual
nBatteryLevel
Description
Retrieves the LiIon battery’s level. This battery is located in the printer’s handle. This returns a value between 1 and 100, the percentage of charge left in the battery. Check the battery level before any processing.
Use this function immediately prior to printing, but not during printing. If you use this function during printing, the return value is not accurate.
Syntax
public int nBatteryLevel
Parameters
None
Return Values
0You must charge the battery.
1–100 The battery level is high enough to run the printer and
print.
412Could not retrieve the current battery level. Retry the function.
Example C#
using Ultra; |
|
{ |
|
int nStat; |
//Instantiate class |
Ultra.Print rPrint = new Print(); |
nStat = rPrint.nBatteryLevel;
MessageBox.Show("Battery at " + nStat.ToString() + " %","Battery Check",MessageBoxButtons.OK,MessageBoxIcon.Asterisk,MessageBo xDefaultButton.Button1);
}
Printing Functions 3-5
Example VB.NET
Imports Ultra |
New Print |
' Instantiate class |
||
Dim |
rPrint |
As |
||
Dim |
nStat |
As |
String |
|
nStat = Convert.ToString(rPrint.nBatteryLevel)
MsgBox("Battery at " + nStat + " %", MsgBoxStyle.Exclamation,
"Battery Check")
3-6 Programmer’s Manual
P r i n t i n g
Feed
Description
Feeds a label through the printer.
Syntax
public void Feed()
Parameters
None
Return Values
None
Example C#
using Ultra; |
|
|
|
{ |
//Instantiate |
class |
|
Ultra.Print rPrint = new Print(); |
|||
rPrint.Feed(); |
// |
Feed a Label |
|
} |
|
|
|
Example VB.NET |
|
|
|
Imports Ultra |
' |
Instantiate |
class |
Dim rPrint As New Print |
|||
rPrint.Feed() |
' |
Feed a Label |
|
Printing Functions 3-7
File
Description
Writes MPCL packets to the Print subsystem.
You can send more than one packet at a time in a file.
A batch packet starts a print job, which makes an asynchronous call to the Print subsystem. After submitting a print job, the application should call LastPrintStatus in a loop, waiting until the printer becomes free.
Syntax
public string File
Parameters
FileName to be sent for printing
Return Values
None
Example C#
using Ultra;
string strScanData = "C39";
Ultra.Print |
rPrint = |
new |
Print(); |
//Instantiate class |
|
rPrint.File |
= |
"\\Onboard |
Flash\\C39Fmt.txt"; |
||
rPrint.Text |
= |
"{B,1,N,1|E,0,0,1,1,0,1|"; |
|||
rPrint.Text = "1,\"" |
+ strScanData |
+ "\"|2,\"" + strScanData |
|||
+ "\"|}"; |
|
|
|
|
|
3-8 Programmer’s Manual
Example VB.NET
Import Ultra
Dim |
rPrint As New |
' Instantiate class |
|
Dim |
strScanData As |
String = |
"C39" |
rPrint.File = "\Onboard Flash\C39Fmt.txt" rPrint.Text = "{B,1,N,1|E,0,0,1,1,0,1|"
rPrint.Text = "1" & Chr(34) & strScanData & Chr(34) & "|" rPrint.Text = "2" & Chr(34) & strScanData & Chr(34) & "|}"
Printing Functions 3-9
Text
Description
Writes a string to the Print subsystem. MPCL packets can be sent as a string. After sending a completed MPCL Packet use the LastPrintStatus function to get a status of the MPCL Packet.
Syntax
public string Text
Parameters
String to be sent to print
Return Values
None
Example C#
using Ultra;
string fmtC39 = "{F,1,A,R,E,200,200,\"C39\"|"+ "C,150,49,0,50,8,8,A,L,0,0,\"M6039 Platinum\",1|" + "T,1,22,V,6,1,0,1,1,1,O,C,0,0|" + "B,2,20,V,23,2,4,12,100,8,C,0|}";
string strScanData = "C39";
Ultra.Print rPrint = new Print(); |
//Instantiate class |
rPrint.Text = fmtC39;
rPrint.Text = "{B,1,N,1|E,0,0,1,1,0,1|"; rPrint.Text = "1,\"" + strScanData + "\"|2,\"" + strScanData + "\"|}";
3-10 Programmer’s Manual