-----------------------------
.NetCF: C#-VB.Net
Documentation eVC
(C/C++/MFC), eVB: ----------------------------- Software Developers Special Topics
Printing Utilities |
PrinterCE.NetCF
Developer's Guide
|
PrinterCE for .NetCF: The primary class for printing text, images, drawing objects (lines, rectangles, etc) and much more. | |
AsciiCE for .NetCF: A separate class that allows for printing pure ASCII text to any ASCII printer. | |
BarcodeCE for .NetCF: An optional class derived from PrinterCE that adds over a dozen barcode types to PrinterCE. |
Simple C# code for using the PrinterCE class to print out "Hello World":
PrinterCE prce =
null;
Create an instance of PrinterCE using one of the following 4 overloaded versions:
Syntax: (4 overloaded versions):
public
PrinterCE();
public PrinterCE(string
initstr);
public PrinterCE(EXCEPTION_LEVEL
exclevel);
public PrinterCE(EXCEPTION_LEVEL exclevel,string
initstr);
initstr-
Developer's License Key used to unlock PrinterCE. Default is for
PrinterCE to
run in evaluation mode. After evaluation time limit has expired on a
device, PrinterCE will be locked and will not function.
exclevel -
Sets level of errors that will cause an
exception, using EXCEPTION_LEVEL enumeration:
EXCEPTION_LEVEL Enumeration |
Description |
NONE |
PrinterCE will not throw an exception - use StatusCheck to determine if an error has occurred. |
ABORT_JOB |
PrinterCE throws an exception if the print job is aborted, either by serious error or user cancel. Certain error conditions that affect only the a specific function will not throw an exception. For example, if DrawPicture is called with an image file that cannot be found or is not a valid image file type. |
ALL |
PrinterCE throws an exception for any error found. |
Example:
PrinterCE
prce1 = new
PrinterCE(PrinterCE.EXCEPTION_LEVEL.ABORT_JOB,"YOURLICENSEKEY");
//No
License Key for evaluation
With exception handling disabled, when an error occurs within
For example, if a printer error occurs, the entire
printing job must be aborted, so all calls to
READ-ONLY property returns string describing this version of PrinterCE
Syntax: string
aboutstr=PrinterCE1.About
String describing this version of PrinterCE - including information on WinCE platform, processor type and version. This string can be used in a MessageBox to display the information - MessageBox.Show(PrinterCE1.About,"PrinterCE Version");
MessageBox.Show(PrinterCE1.About,"PrinterCE Version");
This method converts a value from one ScaleMode system to
another.
Syntax:
double
ConvertCoord(double val, MEASUREMENT_UNITS
fromscalemode,
MEASUREMENT_UNITS
toscalemode);
MEASUREMENT_UNITS Enumeration |
Description |
TWIPS |
1440 Twips per inch |
POINTS |
72 points per inch |
PIXELS |
Printer resolution - for example 300 dpi |
INCHES |
Inches |
MILLIMETERS |
Millimeters |
CENTIMETERS |
Centimeters |
fromval - Value to be converted
fromscale - "convert from" MEASUREMENT_UNITS
toscale - "convert to" MEASUREMENT_UNITS.
toval - Converted value.
To convert 1.25 inches into printer resolution:
double PrResVal=PrinterCE1.ConvertCoord(1.25,PrinterCE.MEASUREMENT_UNITS.INCHES,
Prints a circle or ellipse on a page.
Syntax: (4 overloaded versions):
void DrawCircle(double x,double
y,double radius);
void DrawCircle(double x,double
y,double radius,Color pen color);
void DrawCircle(double x,double
y,double radius,double
aspect);
x - Horizontal coordinate for the center point of a circle.
y - Vertical coordinate for the center point of a circle.
radius - Radius of a circle.
color – color of a circle's outline. Default is ForeColor value
aspect – aspect ratio of a circle. The default value is 1.0,
which yields a perfect circle. Other values draw an ellipse. (Also see
DrawEllipse for another way to draw ellipses).
The ScaleMode property of object determines the units of
measure used.
The FillColor and FillStyle properties of object determine
how a circle is filled.
The DrawWidth property determines the width of the line used to draw a
circle.
Prints an ellipse on a page.
Syntax (2 overloaded versions):
void DrawEllipse(double
x1,double y1,double
x2,double y2);
void DrawEllipse(double
x1,double y1,double
x2,double y2,Color pencolor);
x1, y1, x2, y2 - Values define a rectangle (x1,y1)
as one corner and (x2,y2) as
opposing corner. An ellipse is drawn that
just fits within this bounding rectangle.
color – color of a circle's outline. Default is ForeColor value
The ScaleMode property of object determines the units of
measure used.
The FillColor and FillStyle properties of object determine
how a circle is filled.
The DrawWidth property determines the width of the line used to draw a
circle.
Prints a line.
Syntax (2
overloaded versions):
void DrawLine(double
x1,double y1,double
x2,double y2);
void
DrawLine(double x1,double
y1,double x2,double
y2,Color pencolor);
Parameters
x1, y1 - starting coordinates for a line or rectangle
x2, y2 - ending coordinates for a line or rectangle.
color – Color used to draw a line. Default is ForeColor value.
The DrawWidth property determines the width of the line.
The
ScaleMode property determines the unit of measure used.
Prints a BMP,
JPG, GIF or PNG image file on the page.
Syntax
(2
overloaded versions):
void
DrawPicture(string picture, double
x, double y);
void DrawPicture(string picture, double
x, double y,
double width, double
height,bool keepaspect);
Parameters
picture
: Path & filename of the image to be drawn.
x,y : Coordinates where picture will be drawn (in ScaleMode units). By
default, x,y is the top/left corner of the image location. Use
JustifyHoriz/JustifyVert to change this to Center or Bottom/Right.
width : Destination width of picture. Default (or if width==0): actual image width
height : Destination height of picture. Default (or if height==0): actual image height is used.
keepaspect :
If width and/or height are negative values, DrawPicture
creates a mirror image along the vertical axis (if width is negative)
and/or the horizontal axis (if height is negative).
Print a point on the page.
Syntax
(2
overloaded versions):
void
DrawPoint(double x,double
y);
void DrawPoint(double x,double
y,Color pencolor);
Parameters
x, y - Coordinates of the point to draw (in ScaleMode units)
color - Color used to draw the point. Default is ForeColor value.
DrawWidth property determines the size of
the point.
Prints a rectangle on a page.
Syntax
(2
overloaded versions):
void
DrawRect(double x1,double
y1,double x2,double
y2);
void DrawRect(double
x1,double y1,double
x2,double y2,Color pencolor);
x1, y1, x2, y2 - defines a rectangle with (x1,y1) as one
corner and (x2,y2) as opposing corner
color - Color used to draw the rectangle. Default is ForeColor value.
Coordinates
are in ScaleMode units.
FillColor and FillStyle properties of object
determine how a rectangle is filled.
DrawWidth property determines the
width of the line used to draw a rectangle.
Prints a rectangle with rounded corners on a page.
Syntax
(2
overloaded versions):
void
DrawRoundedRect(double x1,double
y1,double x2,double
y2,
double corner_width,double
corner_height);
void DrawRoundedRect(double
x1,double y1,double
x2,double y2,
double corner_width,double
corner_height,Color pencolor);
x1, y1, x2, y2 - Defines a rectangle with (x1,y1) as one
corner and (x2,y2) as opposing corner.
cornerwidth,cornerheight - defines the width and height of the curve of
the rounded rectangle..
color - Color used to draw the rectangle. Default is ForeColor value.
Coordinates
are in ScaleMode units.
FillColor and FillStyle properties of object
determine how a rectangle is filled.
DrawWidth property determines the
width of the line used to draw a rectangle.
Prints text on the page. (See also DrawTextFlow).
Syntax
(4
overloaded versions):
void
DrawText(string drawstr);
string - Text to be drawn.
x, y - Coordinates of the text to be drawn. Default: string is drawn at the intrinsic (TextX,TextY) coordinates.
ccnt- Number of characters in "string" that should
be printed Default: entire line of text is printed.
The font properties of the PrinterCE control determines the
appearance of the text.
The ForeColor property determines the color of the
text.
After the text is drawn, TextX, TextY are updated so that the next
DrawText command will print on a new line.
The JustifyHoriz, JustifyVert,
and Rotation properties all impact how and where the text is actually
drawn on the page.
Coordinates are in ScaleMode units
Flows printed text on the page, optionally handling word wrap and page breaks automatically. For sample code visit here.
Syntax
(4
overloaded versions):
int
DrawTextFlow(string drawstr);
drawstr - Text to be drawn.
x, y - Coordinates of the position within
the "drawing box" for the top left corner of the start of the text.
Defaults to x, y coordinates of
most recent DrawText/DrawTextFlow call. Pass -1 to use default values
left, top, width, height - Defines a "drawing box" within
which the text will be flowed on the page.
Defaults to left and top
margins with full page width and height. Pass -1 to use default values.
ccnt - Number of characters in text string to print.
Defaults to all text string. Pass -1 to use default.
flowtype -
Bit flags to enable/disable Draw Flow options (OR these together)
FLOW_OPTIONS Enumeration | Description |
DEFAULT |
Default "flow" working mode: auto word-wrap, auto page break (form feed) |
NOWORDWRAP |
Prints one line of text, determining where to break the text string. Returns number of characters printed. |
NOFORMFEED |
Prints text, flowing in "drawing box" as appropriate. If reaches the bottom of the "drawing box", stops printing and returns total number of characters printed. |
NOENDINGLINEFEED |
Normal operation after flowing text into the "drawing box" is to move to the start of the next line (CR/LF). Using NOENDINGLINEFEED causes (x, y) coordinates to be left immediately after the end of the last character printed. |
HARDBREAK |
Normal operation is for DrawTextFlow to try to "break" a line of text in a natural flow, such as at a space. Use HARDBREAK to fit all text possible onto each line, with break made after the last character that will fit. |
Returns number of characters printed during DrawTextFlow operation.
- JustifyHoriz
and Rotation properties are ignored - DrawTextFlow always draws
LEFT justified in NORTH rotation.
- JustifyVert is used to determine vertical justification.
- The ForeColor property determines the color of the
text.
- Coordinates are in ScaleMode units
Property: Returns / sets the line width in ScaleMode uints for output from
a graphics method.
Syntax:
get: double wid = PrinterCE1.DrawWidth;
set: PrinterCE1.DrawWidth = (double) wid;
Begin printing the current page, then reset
printing properties to default.
Syntax: void EndDoc();
Property: Returns / sets the color used to fill in
graphics methods: DrawRect, DrawRoundedRect, DrawCircle and DrawEllipse.
Examples:
get: Color wid = PrinterCE1.FillColor;
set: PrinterCE1.FillColor = Color.Blue;
When the FillStyle property is set to Transparent (default), the FillColor setting is ignored.
Property: Returns / sets the pattern used to fill in
graphics methods: DrawRect, DrawRoundedRect, DrawCircle and DrawEllipse.
FILL_STYLE Enumaration |
Description |
SOLID |
Solid |
TRANSPARENT |
Transparent |
Examples:
get: PrinterCE.FILL_STYLE style = PrinterCE1.FillStyle;
set: PrinterCE1.FillStyle= PrinterCE.FILL_STYLE.SOLID;
When the FillStyle property is set Transparent, the FillColor
setting is ignored.
Property: Returns / sets the Bold font style to true (Bold ON) or false (Bold OFF);
Examples:
get: bool isbold = PrinterCE1.FontBold;
set: PrinterCE1.FontBold=true;
Property: Returns / sets the current font's Bold weight.
Examples:
get: int boldweight = PrinterCE1.FontBoldVal;
set: PrinterCE1.FontBoldVal=850;
value - Integer value between 0 and 1000 to set the weight of
the font. Normal weight setting is 400 and standard Bold is 700.
Property: Returns / sets the Italic font style to true (Italic ON) or false (Italic OFF);
Examples:
get: bool isitalic = PrinterCE1.FontItalic;
set: PrinterCE1.FontItalic=true;
Property: Returns / sets the font used to print text.
Examples:
get: string fontname = PrinterCE1.FontName;
set: PrinterCE1.FontName="Courier New";
Any TrueType font can be used. To install a TrueType font to the device, simply copy from desktop PC to \Windows\Fonts folder on the device. You can use Pocket Word -> Edit -> Format -> pull down list of available fonts to see exact font names of all installed fonts.
Property: Returns / sets the point size of the font to be used for printing.
Examples:
get: int fontsize = PrinterCE1.FontSize;
set: PrinterCE1.FontSize=14; //Set font size to 14 point
Note: to match a point size with equivalent point size of Microsoft Word, use negative point size... for example, to match Word's 12 point font, use PrinterCE1.FontSize = -12.
Max is 2,160 points, min is 4 points.
Property: Returns / sets the Strikethrough style, true = Strikethrough ON, false OFF
Examples:
get: bool isstrikethru = PrinterCE1.FontStrikethru;
set: PrinterCE1.FontStrikethru=true;
Property: Returns / sets the Underline font style.
Examples:
get: bool isunderline = PrinterCE1.FontUnderline;
set: PrinterCE1.FontUnderline=true;
Property: Returns / sets the foreground color used to
print text.
Examples:
get: Color forecolor = PrinterCE1.ForeColor;
set: PrinterCE1.ForeColor=Color.Red;
ERROR GetLastError
-
ERROR Enumeration |
Description |
NONE |
No current error |
|
Unable to complete printing task. |
|
Print operation cancelled by user |
|
Not enough memory to complete the task |
|
Invalid argument to PrinterCE.NetCF call |
|
Unknown error |
|
Print Dialog error |
|
Couldn't create font. |
|
Unable to load image. |
|
Check printer settings (page size, margins, etc) |
INFRARED |
Unable to establish Infrared link |
|
Unable to establish link to printer |
|
Lost communications link to printer |
|
Dialog error... cannot continue |
|
Unable to print across the network. |
|
Network support functions for network printing not found on this device. |
|
Unable to connect to computer or find network printers. Check computer name and network connection. |
|
Network unavailable or this device does not support network printing. |
|
Unable to connect with Bluetooth printer... Use Bluetooth Manager to discover your printer and connect it to Serial Port. Verify that Bluetooth Radio is ON. |
Example:
PrinterCE.ERROR
errtype = PrinterCE1.GetLastError;
if (errtype == PrinterCE.ERROR.USERCANCELLED) {
//Handle user cancel situation
}
This method returns width and height of an image in an image file in ScaleMode units.
Parameters
picture
: Path & filename of the image to be drawn.
width: Actual width of image
height: Actual height of image
Returns: true if valid picture found.
READ-ONLY Property - Returns the height of the current font in ScaleMode units
Syntax: double ht = PrinterCE1.GetStringHeight;
Returns the width of the given text
string (in ScaleMode units)
Syntax: double wid = PrinterCE1.GetStringWidth("TextString");
Returns version of PrinterCE.NetCF - forms major.minor.build.revision
Syntax:
READ-ONLY property returns TRUE if current selected printer can print color.
Syntax: bool usescolor = PrinterCE1.IsColor;
Property: Returns / sets the horizontal justification (left, center, right) of following DrawText and DrawImage methods.
JUSTIFY_HORIZ Enumeration |
LEFT (Default) |
CENTER |
RIGHT |
Examples:
get: PrinterCE.JUSTIFY_HORIZ hjust = PrinterCE1.JustifyHoriz;
set: PrinterCE1.JustifyHoriz=PrinterCE.JUSTIFY_HORIZ.CENTER;
Property: Returns / sets the vertical justification (top, center, bottom) of following DrawText and DrawImage methods.
JUSTIFY_VERT Enumeration |
TOP (Default) |
CENTER |
BOTTOM |
Examples:
get: PrinterCE.JUSTIFY_VERT vjust = PrinterCE1.JustifyVert;
set: PrinterCE1.JustifyVert=PrinterCE.JUSTIFY_VERT.BOTTOM;
Abort
the current page - Flush all print operations and reset
printing properties to default.
Syntax: void KillDoc();
Begin printing the current page then prepare for another page of printing commands. Do not reset printing properties to default.
Syntax: void NewPage();
Property: Returns / sets an indent from the left margin
of the page where the start of the horizontal printing is found.
Examples:
get: int curleftindent = PrinterCE1.PgIndentLeft;
set: PrinterCE1.PgIndentLeft=300; //Set left indent 300 dots from margin
The PgIndentLeft and PgIndentTop settings can be called
multiple times while printing one page. All subsequent drawing methods use
the new settings. Use this technique to
easily print multiple columns and/or rows of items.
Property: Returns / sets an indent from the top margin
of the page where the start of the vertical printing is found.
Examples:
get: int curtopindent = PrinterCE1.PgIndentTop;
set: PrinterCE1.PgIndentTop=300; //Set top indent 300 dots from margin
The PgIndentLeft and PgIndentTop settings can be called multiple times while printing one page. All subsequent drawing methods use the new settings.
Property: Returns / sets the bottom margin
of the page.
Examples:
get: double curBottomMgn
= PrinterCE1.PrBottomMargin;
set: PrinterCE1.PrBottomMargin = (double)
0.75;
Property: Returns / sets the action of the "Printing in
progress" dialog box (which allows the user to cancel the print
operation).
|
Description |
|
|
|
|
|
|
|
|
|
|
|
|
Examples:
get: PrinterCE.DIALOGBOX_ACTION dbox
= PrinterCE1.PrDialogBox;
set: PrinterCE1.PrDialogBox = PrinterCE.DIALOGBOX_ACTION.UP;
By default, the "Printing in progress" dialog box
is displayed with the first call by VB to a PrinterCE page operation
(such as Select Printer, Draw Object, etc). This dialog box will remain
until EndDoc or KillDoc completes the printing job. Calling
PrDialogBox(vbDlgDisable) will prevent PrinterCE from displaying
the dialog box (and will not give the user any chance to cancel).
See PrDialogBoxText() to change the text displayed
or language used by this dialog.
This method allows changing the text displayed or language
used by the "Printing in progress" dialog box.
Syntax:
void PrDialogBoxText(string
MainText,string TitleText,
string
CancelBtnText);
MainStr - String for main text portion of the "Printing
in progress" dialog box.
TitleStr - String for title portion of the "Printing in
progress" dialog box.
CancelBtnStr - String for Cancel Button portion of the "Printing in
progress" dialog box
The text of this dialog box may be changed at any time… if
the dialog box is already displayed, it will be taken down, the new text
added, and then the dialog box will be redisplayed. If the dialog box is
not currently displayed, it will remain down until a call to PrDialogBox()
or until PrinterCE automatically displays it.
READ-ONLY property returns "dots per inch" resolution of currently selected printer
Syntax: int prRes = PrinterCE1.PrinterResolution;
Property: Returns / sets the left margin
of the page.
Examples:
get: double curLeftMgn
= PrinterCE1.PrLeftMargin;
set: PrinterCE1.PrLeftMargin = (double)
0.75;
Property: Returns / sets the right margin
of the page.
Examples:
get: double curRightMgn
= PrinterCE1.PrRightMargin;
set: PrinterCE1.PrRightMargin = (double)
0.75;
This method causes the printer control to reset all
printer-specific values to the printer defaults.
Syntax: void PrinterCE1.PrSetDefaults();
Property: Returns / sets the top margin
of the page.
Examples:
get: double curTopMgn
= PrinterCE1.PrTopMargin;
set: PrinterCE1.PrTopMargin = (double)
0.75;
This property returns and sets the orientation of the printed page using the ORIENTATION enumeration.
ORIENTATION Enumeration |
Description |
PORTRAIT |
Normal page orientation |
LANDSCAPE |
Page rotated landscape |
Example: PrinterCE1.PrOrientation=PrinterCE.ORIENTATION.LANDSCAPE;
Property: Returns / sets the paper selection for the printed page using PAPER_SELECTION enum:
PAPER_SELECTION Enumeration |
LETTER |
A4 |
B5 |
LEGAL |
CUSTOM |
Examples:
get: PrinterCE.PAPER_SELECTION ptype = PrinterCE1.PrPaperSelection;
set: PrinterCE1.PrPaperSelection= PrinterCE.PAPER_SELECTION.LETTER;
READ-ONLY Property - Returns the current height in ScaleMode
units of the
printable area of the page (after subtracting out Top & Bottom
margins).
Example:
get: double pght
= PrinterCE1.PrPgHeight;
READ-ONLY Property - Returns the current width in ScaleMode
units of the
printable area of the page (after subtracting out Left & Right
margins).
Example:
get: double pgwid
= PrinterCE1.PrPgWidth;
Property: Returns / sets the quality of the printing – High vs Draft using PRINT_QUALITY enum:
PRINT_QUALITY Enumeration |
HIGH |
DRAFT |
Examples:
get: PrinterCE.PRINT_QUALITY ptype = PrinterCE1.PrPrintQuality;
set: PrinterCE1.PrPrintQuality = PrinterCE.PRINT_QUALITY.HIGH;
Many printers do not support DRAFT "print quality".
Property: Returns / sets the rotation of subsequent text and image drawing commands using ROTATION_TYPE enumeration:
ROTATION_TYPE Enumeration |
Description |
NORTH |
Rotation is 0 degrees |
EAST |
Rotation is 90 degrees clockwise |
SOUTH |
Rotation is 180 degrees |
WEST |
Rotation is 270 degrees clockwise |
Examples:
get: PrinterCE.ROTATION_TYPE rot = PrinterCE1.Rotation;
set: PrinterCE1.Rotation= PrinterCE.ROTATION_TYPE.SOUTH;
Images and text can be printed at 90 degree rotations and
intermixed freely on the same page. For example, you can print a text
string in the default rotation North, call the Rotation method = 180 and
then print another string upside-down.
The trickiest part of using Rotation is getting a mental
image of how the text strings and images will be positioned on a page. For
example, if you have justification set to Left and Top justify the usage
of TextX and TextY will be used to justify the text string or image based
on the rotation setting.
Property: Returns / sets the
unit of measurement for coordinates of printing objects
MEASUREMENT_UNITS Enumeration |
Description |
TWIPS (Default) |
1,440 twips per inch. 567 twips per centimeter |
POINTS |
72 points per logical inch |
PIXELS |
Smallest unit of printer resolution |
INCHES |
|
MILLIMETERS |
|
CENTIMETERS |
|
Examples:
get: PrinterCE.MEASUREMENT_UNITS scale = PrinterCE1.ScaleMode;
set: PrinterCE1.ScaleMode= PrinterCE.MEASUREMENT_UNITS.INCHES;
Method pops up the Select Printer dialog box to allow the user
to select the printer and printer options to be used for printing.
Syntax: void SelectPrinter(bool StartPrinting);
StartPrinting - If true, includes "Start Printing" button on the dialog box and attempts to establish communication with printer if user taps this. If false, uses "Save Settings" button instead and saves user settings to registry when tapped (exclusive to PrinterCE.NetCF).
If SelectPrinter is never called, the default printer and
settings are used.
Write-Only property sets error level of errors reported to user by PrinterCE.NetCF. NOTE: The SetReportLevel setting will not affect the Exception Level set by PrinterCE.NetCF constructor (see here for Exception Level info).
Set report level using REPORT_LEVEL enumeration:
REPORT_LEVEL Enumeration |
Description |
ALL_ERRORS (Default) |
All errors and user cancel are reported to user by PrinterCE via error dialog |
SERIOUS_ERRORS |
All errors are reported, but user cancel will not show "Are you sure" message box prompt. |
NO_ERRORS |
No errors are reported to user... it is up to app to
report errors. |
NO_ERRORS_SKIP_CANCEL |
No errors are reported to user. If user presses Cancel, no "Are you sure" prompt is given. |
Example:
set: PrinterCE1.SetReportLevel=PrinterCE.REPORT_LEVEL.NO_ERRORS;
Set IP address and port for networked print server. SetupNetIPPrinter must be called before calling SetupPrinter().
Syntax: void SetupNetIPPrinter(string netstr,int port,bool OpenPort);
Parameters
netstr
- IP
address string
port - IP port value
OpenPort - true if want to establish communication link immediately
Example: prce.SetupNetIPPrinter("192.168.0.234",9101,false);
Set IP address and port for networked print server. SetupNetIPPrinter must be called before calling SetupPrinter(). SetupNetSharedPrinter must be called before calling SetupPrinter().
Syntax: void SetupNetSharedPrinter(string netstr,bool OpenPort);
Parameters
netstr
- Network
path string to shared printer.
OpenPort - true if want to establish communication link immediately
Example:
prce.SetupNetSharedPrinter("\\\\FieldSoft\\HP995c",true);
This establishes connection to printer "HP995c" on networked PC
"FieldSoft".
Programmatically
set the printer and port settings
Syntax:
2 overloaded versions
void
SetupPrinter(PRINTER Printer,PORT Port,bool
OpenPort);
void SetupPrinter(PRINTER Printer,PORT Port,PORT_SPEED Baudrate,
bool OpenPort);
Printer - One of the following PRINTER selections:
Description |
|
USE_CURRENT |
Use most recently saved printer from registry. |
ABLE_AP1300 | Able Systems Ap1300 |
AXIOHM_A631 | Axiohm A631 |
BROTHER | Brother MPrint |
|
Brother PocketJet 3 and PocketJet 200 |
|
Brother PocketJet 3 Plus and PocketJet
II |
|
Brother PocketJet 6 |
BROTHER_PJ6plus |
Brother PocketJet 6 Plus |
BROTHER_RuggedJet |
Brother RJ-4030/4040 |
CANONBJ360 |
Canon BubbleJet compatible printers |
CANONBJ600 | Canon PIXMA iP90, i80, i70 |
CANONBJ300 | Canon BubbleJet 300 dpi |
CITIZEN_203 |
Citizen 203DPI printers |
CITIZEN_CMP10 |
Citizen CMP-10 |
CITIZEN_PD22 |
Citizen PD-22 |
CITIZEN_PD04 |
Citizen PD-04, PD-24 |
CITIZEN_PN60 |
Citizen PN60i |
DATAMAX_APEX |
Datamax-O'Neil Apex, Andes, OC |
DATAMAX_ONEIL_MFT |
|
ELTRADE |
Eltrade Mobilife |
EPSON_ESCP2 |
Epson ESC/P 2 compatible printers |
EPSON_STYLUS |
Epson Stylus compatible printers |
EPSON_TM_P60 |
Epson TM-P60 |
FUJITSU_FTP628 |
Fujitsu FTP-628WSL110 |
GEBE_FLASH |
GeBE Flash 4" Thermal |
GENERIC24_180 |
Generic Epson compatible 180DPI 24-pin printers (LQ/ESC) |
GENERIC24_360 |
Generic Epson compatible 360DPI 24-pin printers (LQ/ESC) |
GENERIC24_203 |
Generic Epson compatible 203DPI 24-pin printers (LQ/ESC) |
HP_PCL |
HP PCL compatible - includes DeskJet and LaserJet |
INTERMEC |
Intermec PR2/3, PB/PW/68/78 Thermal |
INTERMECPB |
Intermec PB3/PB2 (Note: For PB42, PB50, use INTERMEC) |
INTERMEC_FINGERPRINT |
Intermec Fingerprint |
IPC_PP50 |
IPC PP-50 |
IPC_PP55 |
IPC PP-55 |
MARTEL |
Martel MCP78xx |
|
OMNIPrint 6240 and 6400 |
PANASONIC_JTH200PR |
Panasonic JTH200PR |
PENTAX_200 |
Pentax PocketJet 3 and PocketJet 200 |
PENTAX_300 |
Pentax PocketJet 3 Plus and PocketJet
II |
PENTAX_RUGGEDJET |
Pentax RuggedJet 3 & RuggedJet 4 |
PERIPHERON_NOMAD |
Peripheron Nomad |
POCKET_SPECTRUM |
Pocket Spectrum |
S_PRINT |
CUSTOM s'print |
SATO |
SATO MB200i |
SEIKO3445 |
Seiko DPU-3445 |
SEIKO_L465 |
Seiko DPU-L465 |
TALLY_MIP360 |
TallyGenicom MIP360 rugged 24-pin dot matrix printer |
TALLY_MTP4 |
|
ZEBRA | Zebra Cameo, Encore and QL |
SIPIX |
SiPix A6 printer |
DYMOCOSTAR |
DymoCoStar label printers |
SEIKOLABELWRITER |
Seiko LabelWriter printers |
Port - One of the following PORT selections:
Description |
|
USE_CURRENT |
Use most recently saved port from registry. |
INFRARED |
Infrared port |
NETPATH |
Print to shared printer on a networked host PC |
NETIP |
Print to network IP printer - a printer with its own IP address |
COMPAQ_BT |
HP/Compaq Bluetooth iPAQ or sleeve |
IPAQ_BT |
HP/Compaq Bluetooth iPAQ or sleeve |
SOCKETCOM_BT |
Socket Bluetooth card support |
WIDCOMM_BT | |
COM1 |
Com1: serial port |
COM2 |
Com2: serial port |
COM3 |
Com3: serial port |
COM4 |
Com4: serial port |
COM5 |
Com5: serial port |
COM6 |
Com6: serial port |
COM7 |
Com7: serial port |
COM8 |
Com8: serial port |
COM9 | Com9: serial port |
COM0 | Com0: serial port |
TOFILE |
Print to file "\OUTPUT.PRN" |
LPT |
LPT: parallel port |
|
|
Baudrate - One of the following PORT_SPEED values. Defaults to USE_CURRENT.
Description |
|
USE_CURRENT |
Use most recently saved baud rate from registry. |
S_4800 |
4800 baud |
S_9600 |
9600 baud |
S_19200 |
19200 baud |
S_38400 |
38400 baud |
S_57600 |
57600 baud |
S_115200 |
115200 baud |
OpenPort - If true, tries to immediately establish communication with the selected printer and port. If false, delays until ready to send print data.
This method selects paper settings (see also SetupPaperCustom).
Syntax:
(2 overloaded versions):
void
SetupPaper(PAPER_SELECTION PaperSize,ORIENTATION Orientation);
void SetupPaper(PAPER_SELECTION
PaperSize,ORIENTATION Orientation,
double LeftMargin,double
TopMargin,double RightMargin,double
BottomMargin);
PaperSize - One of the following PAPER_SELECTION values:
Description |
|
USE_CURRENT |
Use most recently saved paper selection from registry. |
LETTER |
Letter sized paper |
A4 |
A4 paper |
B5 |
B5 paper |
LEGAL |
Legal-sized paper |
CUSTOM |
Custom-sized paper (see SetupPaperCustom as preferred way to set CUSTOM paper). |
Orientation - One of ORIENTATION values:
Description |
|
USE_CURRENT |
Use most recently saved orientation selection from registry. |
PORTRAIT |
Portrait mode |
LANDSCAPE |
Landscape (sideways) mode |
LeftMargin, TopMargin, RightMargin, BottomMargin: Sets printing margins in ScaleMode units. Defaults to most recently saved margin values. To leave any margin values unchanged, use -1.0 for margin setting.
This method selects CUSTOM paper type and sets paper size.
Syntax:
(2 overloaded versions):
public
void SetupPaperCustom(ORIENTATION
Orientation,
double CustomPaperWidth,double
CustomPaperHeight);
public void
SetupPaperCustom(ORIENTATION Orientation,
double CustomPaperWidth,double
CustomPaperHeight,double
LeftMargin,
double TopMargin,double
RightMargin,double BottomMargin);
Orientation: See ORIENTATION
table.
CustomPaperWidth,
CustomPaperHeight - Paper width and height (in ScaleMode units)
LeftMargin, TopMargin, RightMargin, BottomMargin - Margins used for
printed page (in ScaleMode units)
This method programmatically sets a variety of "other" printing
options
Syntax:
void
SetupPrinterOther(FORMFEED_SETTING FFSetting,double
FormFeedScrollDistance,
DENSITY Density,SERIAL_HANDSHAKE Handshake,BITFLAG BitFlags,
COMPRESSION Compression,DITHER
Dither,PRINTQUALITY PrintQuality);
FFSetting- One of the following FormFeed selections:
Description |
|
USE_CURRENT |
Use most recently saved setting from registry. |
NORMAL |
Printer sends formfeed command to printer at end of each
page. |
PAPERHEIGHT |
PrinterCE scrolls printer to selected paper height. |
SCROLL |
PrinterCE will scroll paper by "FormFeedScrollDistance"
distance from last printed portion of page. |
FormFeedScrollDistance - Distance (in ScaleMode units) to scroll if
FFSetting=FFEED_SCROLL
Density - Darkness/Lightness setting for print density.
Description |
|
USE_CURRENT |
Use most recently saved setting from registry. |
EXTRALIGHT |
Lightest printing |
EXTRALIGHT |
Lightest printing |
LIGHTER |
Medium light printing |
NORMAL |
Normal printing density |
DARKER |
Darker printing |
EXTRADARK |
Darkest printing |
Handshake - Valid only for serial port selections (COMx) - Defines serial port handshake:
Description |
|
USE_CURRENT |
Use most recently saved setting from registry. |
SOFTWARE |
Uses Xon/Xoff |
HARDWARE |
Uses hardware control lines |
NO_HANDSHAKE |
No handshaking of serial port. |
BitFlags - Miscellaneous bit settings (OR these together):
BITFLAG Enumeration | Description |
USE_CURRENT |
Use most recently saved setting from registry. |
ADJUST_IR |
Forces IR (infrared) buffer size to 2040 bytes for Canon BJC printers and to 64 bytes for all other printers... this fixes IR hardware incompatibilities in a few printers. |
ALTERNATE_IR |
(Obsolete) There are a few Windows CE devices that have trouble printing through the infrared port to specific printers due to problems in the infrared port driver of the device. This option provides an alternate (generally less robust) approach to IR connection. |
COLOR |
Enables color printing for HP PCL, Canon BJC, Epson and other color printers. |
CMYONLY |
CMY 3-Color Printing - for color printers that do not have black ink. |
SINGLETHREAD |
PrinterCE normally uses two threads (separate processes) for printing. Selecting BITFLAG_SINGLETHREAD forces PrinterCE to use one thread. |
Compression - Select data compression mode for printing:
Description |
|
USE_CURRENT |
Use most recently saved setting from registry. |
STANDARD |
Uses standard printer compression for faster printing (default) |
NONE |
No compression - much slower printing. |
Dither - Select Dither or Diffusion technique for image conversion :
Description |
|
USE_CURRENT |
Use most recently saved setting from registry. |
DIFFUSION |
Uses color diffusion (default) |
DITHER |
Use dithering |
PrintQuality - Select High Quality vs Draft mode printing (if available). Note: DraftMode is not
supported for many printer types and may not result in
any difference.
Description |
|
USE_CURRENT |
Use most recently saved setting from registry. |
STANDARD |
Uses standard quality printing (default) |
DRAFT |
Draft mode printing (if available) |
Method to set or query all printer and paper related settings for PrinterCE.NetCF SDK using PRINTER_SETUP struct:
PRINTER_SETUP structure (not in this order): PRINTER Printer; PORT Port; PORT_SPEED PortSpeed; PAPER_SELECTION PaperSelection; ORIENTATION Orientation; FORMFEED_SETTING FormFeedSetting; DENSITY Density; SERIAL_HANDSHAKE SerialHandshake; COMPRESSION Compression; DITHER Dither; PRINTQUALITY PrintQuality; ADJUST_IR AdjustIR; OTHER_IR OtherIR; COLOR_MONO ColorMono; THREAD Thread; Int32 IP_port; //See SetupNetIPPrinterExample:
// Get current printer settings from PrinterCE.NetCF
PrinterCE.PRINTER_SETUP prsettings = prce.SetupPrSettings_All;
//Make a few changes...
prsettings.Printer=PrinterCE.PRINTER.EPSON_ESCP2;
prsettings.SharedPrinter_NetStr="\\\\FieldSoft\\MyPr";
prsettings.PaperSelection=PrinterCE.PAPER_SELECTION.A4;
prsettings.TopMargin=0.66;
//Save the new settings back to
PrinterCE.NetCF
prce.SetupPrSettings_All=prsettings;
Description |
|
USE_CURRENT |
Use most recently saved setting from registry. |
STANDARD |
Uses standard IR buffers size (default) |
OPTIONAL |
Forces IR (infrared) buffer size to 2040 bytes for Canon BJC printers and to 64 bytes for all other printers... this fixes IR hardware incompatibilities in a few printers. |
Description |
|
USE_CURRENT |
Use most recently saved setting from registry. |
STANDARD |
Uses standard IR support (default) |
OPTIONAL |
(Obsolete) There are a few Windows CE devices that have trouble printing through the infrared port to specific printers due to problems in the infrared port driver of the device. This option provides an alternate (generally less robust) approach to IR connection. |
Description |
|
USE_CURRENT |
Use most recently saved setting from registry. |
MONOCHROME |
Set printer to monochrome (non-color) |
CMYK_4COLOR |
Set to print in color for printers with 4 ink colors (Cyan, Magenta, Yellow and Black). |
CMY_3COLOR |
Set to print in color for printers with 3 ink colors (Cyan, Magenta and Yellow). |
Description |
|
USE_CURRENT |
Use most recently saved setting from registry. |
MULTIPLE |
Uses separate print thread for enhanced printing performance (default) |
SINGLE |
Use single thread for PrinterCE.NetCF functionality. |
Method: Frees system resources when PrinterCE instance is being destroyed. Note: It is not necessary to call ShutDown if the PrinterCE instance is global and lasts for the lifetime of your app. Only call ShutDown if PrinterCE instance is about to be destroyed.
Example:
PrinterCE prce = null; try { prce = new PrinterCE(); //Create instance of PrinterCE class //... various PrinterCE printing commands called here prce.EndDoc(); //Done with this page - print it } catch (PrinterCEException exc) { MessageBox.Show("PrinterCE Exception","Exception"); } finally { if (prce!=null) { prce.ShutDown(); //PrinterCE about to go away - free PrinterCE resources } prce=null; }READ-ONLY property: returns the current status of
PrinterCE.
Syntax:
PRINT_STATUS StatusCheck();
Returns
PRINT_STATUS Enumeration |
Description |
NO_ERROR |
No error to report |
USER_CANCEL |
User cancelled print job |
ABORT_OPERATION |
Error aborted the last print operation (but the print job
is still viable). |
ABORT_PRINT |
Error aborted the print job |
The AbortOperation status is momentary… if a "DrawPicture"
method cannot find the specified image file, that operation is aborted and
a call to StatusCheck that follows the DrawPicture method will return
vbAbortOperation. However, if a successful DrawText operation immediately
follows the aborted DrawPicture call, a call to StatusCheck after DrawText
will return vbNoError..
Property: Returns / sets the current X coordinate for
text positioning in ScaleMode units. The next DrawText
method call will use this coordinate to position its text (unless DrawText
overrides it with an X coordinate in the method).
Examples:
get: double curX
= PrinterCE1.TextX;
set: PrinterCE1.TextX=2.5;
Actual position of the text is impacted by
the JustifyHoriz/JustifyVert and Rotation property settings. TextX is
measured from the Left margin setting.
Property: Returns / sets the current Y coordinate for
text positioning in ScaleMode units. The next DrawText
method call will use this coordinate to position its text (unless DrawText
overrides it with an Y coordinate in the method).
Examples:
get: double curY =
PrinterCE1.TextY;
set: PrinterCE1.TextY=2.5;
Actual position of the text is impacted by
the JustifyHoriz/JustifyVert and Rotation property settings. TextY is
measured from the Top margin setting.