Documente Academic
Documente Profesional
Documente Cultură
About
READ-ONLY property returns string describing this version of PrinterCE/AsciiCE/BarcodeCE.
Returns
String describing this version of PrinterCE - including information on WinCE platform (Pocket PC,
HPC/Pro), processor type and version. This string can be used in a MsgBox() to display the information.
Capabilities
READ-ONLY property returns bit-values that identify all the capabilities in the current control.
Returns
ConvertCoord
This method converts a value from one ScaleMode system to another.
Parameters
Returns
toval - Converted value.
Example:
DrawCircle
This method prints a circle or ellipse on a page.
MFC Syntax: PrinterCE1.DrawCircle(float x, float y,float rad, VARIANT* color, VARIANT* aspect);
C++ Syntax: PrinterCE1.DrawCircle(float x, float y,float rad, VARIANT* color, VARIANT* aspect);
eVB Syntax: PrinterCE1.DrawCircle x, y, [color], [aspect]
Parameters
Remarks
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.
DrawEllipse
This method prints an ellipse on a page.
MFC Syntax: PrinterCE1.DrawEllipse(float x1, float y1, float x2, float y2, VARIANT* color);
C++ Syntax: PrinterCE1.DrawEllipse(float x1, float y1, float x2, float y2, VARIANT* color);
eVB Syntax: PrinterCE1.DrawEllipse x1, y1, x2, y2, [color]
Parameters
x1, y1, x2, y2 - Required. 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 – Optional - RGB color of a circle's outline. If omitted, the ForeColor value is used.
Remarks
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.
DrawLine
This method draws lines and rectangles on a Form.
MFC Syntax: PrinterCE1.DrawLine(float x1, float y1, float x2, float y2, VARIANT* color, VARIANT* boxfill);
C++ Syntax: PrinterCE1.DrawLine(float x1, float y1, float x2, float y2, VARIANT* color, VARIANT* boxfill);
eVB Syntax: PrinterCE1.DrawLine x1, y1, x2, y2, [color], [boxfill]
Parameters
Remarks
The DrawWidth property determines the width of the line. The ScaleMode property determines the unit of
measure used.
boxfill Value
vbLineBox 1 Draws box using coords as opposite corners
vbLineBoxFill 2 Draws box and fills with line color
DrawPicture
This method prints a BMP, JPG, GIF or PNG image file on the page. Note: A few non-Pocket PC devices
may not include full image support (BMP should always be supported). You can test your device to verify
what file types are supported.
Parameters
Remarks
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).
DrawPoint
This method draws a point on the page.
Parameters
Remarks
The setting of the DrawWidth property determines the size of the point.
DrawRect
This method draws a rectangle on a page.
MFC Syntax: PrinterCE1.DrawRect(float x1, float y1, float x2, float y2, VARIANT* color);
C++ Syntax: PrinterCE1.DrawRect(float x1, float y1, float x2, float y2, VARIANT* color);
eVB Syntax: PrinterCE1.DrawRect x1, y1, x2, y2, [color]
Parameters
x1, y1, x2, y2 - defines a rectangle with (x1,y1) as one corner and (x2,y2) as opposing corner
color – Optional - RGB color of rectangle’s outline. If omitted/NULL, the ForeColor value is used
Remarks
DrawRoundedRect
This method draws a rectangle with rounded corners on a page.
MFC Syntax: PrinterCE1.DrawRoundedRect(float x1, float y1, float x2, float y2, float cornerwidth, float
cornerheight, VARIANT* color);
C++ Syntax: PrinterCE1.DrawRoundedRect(float x1, float y1, float x2, float y2, float cornerwidth, float
cornerheight, VARIANT* color);
eVB Syntax: PrinterCE1. DrawRoundedRect x1,y1,x2,y2,cornerwidth,cornerheight, [color]
Parameters
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 - Optional. RGB color of a rectangle’s outline. If omitted/NULL, the ForeColor value is used.
Remarks
Coordinates are in ScaleMode units. FillColor and FillStyle properties of object determine how a rectangle
is filled. The DrawWidth property determines the width of the line used to draw a rectangle.
DrawText
This method draws text on the page.
Parameters
Remarks
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
DrawWidth
This property returns and sets the line width for output from a graphics method.
Parameters
size –Value for the width of the line in the current ScaleMode. For example, if ScaleMode is set to Inches,
size of 0.1 would select a line width of 1/10 of an inch. A size of 0 sets line width to 1 pixel.
EndDoc
This method causes the current page to be printed and resets printing properties to default.
Remarks
Causes the current page to be printed and then resets all properties to their default settings. See also
"NewPage".
FillColor
This property returns and sets the color used to fill in graphics methods: DrawRect, DrawRoundedRect,
DrawCircle and DrawEllipse.
Parameters
value - Standard RGB color value that determines the fill color. By default, FillColor is set to 0 (Black).
Remarks
When the FillStyle property is set to Transparent (default), the FillColor setting is ignored. The valid range
for a normal RGB color is from 0 through 16,777,215 (&HFFFFFF). The high byte of a number in this
range equals 0. The lower 3 bytes, from least to most significant byte, determine the amount of red,
green, and blue, respectively. The red, green, and blue components are each represented by a number
from 0 through 255 (&HFF).
FillStyle
This property returns and sets the pattern used to fill in graphics methods: DrawRect, DrawRoundedRect,
DrawCircle and DrawEllipse.
Parameters
value - Integer that specifies the fill style. The following table describes the settings for number.
Remarks
When the FillStyle property is set Transparent, the FillColor setting is ignored.
FontBold
This property returns and sets the Bold font style.
Parameters
value - Boolean expression that specifies the font style. Following are the settings for Boolean:
True - Turns on Bold formatting, False - Turns off Bold formatting.
Remarks
Sets the "current font settings" to Bold or Normal. For more selective settings, see FontBoldVal property.
FontBoldVal
This property returns and sets the Bold font style.
Parameters
value - Integer value between 0 and 1000 to set the weight of the font. Normal weight setting is 400 and
standard Bold is 700.
Remarks
FontItalic
This property returns and sets the Italic font style.
Parameters
value - Boolean expression that specifies the font style. Following are the settings for Boolean:
True - Turns on the formatting in that style, False - Turns off the formatting in that style (default)
Remarks
FontName
This property returns and sets the font used to print text..
Parameters
Remarks
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.
FontSize
This property returns and sets the size of the font to be used for printing.
Parameters
value – Numeric expression that specifies the font size, in points, to use.
Remarks
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.
The maximum value for FontSize is 2,160 points. The minimum value is 4 points.
FontStrikethru
This property returns and sets the Strikethrough style.
Parameters
value - Boolean expression specifying the font style. Following are the settings for Boolean:
True - Turns on the strike-through formatting. False - Turns off the strike-through formatting (default)
FontUnderline
This property returns and sets the Underline font style.
MFC Syntax: long value =PrinterCE1.GetFontUnderline();
PrinterCE1.SetFontUnderline(long value);
C++ Syntax: PrinterCE1.get_FontUnderline(long * value);
PrinterCE1.put_FontUnderline(long value);
eVB Syntax: PrinterCE1.FontUnderline [=value]
Parameters
value - Boolean expression that specifies the font style. Following are the settings for Boolean:
True - Turns on the underline formatting. False - Turns off the underline formatting (default)
ForeColor
This property returns and sets the foreground color used to print text.
Parameters
Remarks
The valid range for a normal RGB color is from 0 through 16,777,215 (&HFFFFFF). The high byte of a
number in this range equals 0. The lower 3 bytes, from least to most significant byte, determine the
amount of red, green, and blue, respectively. The red, green, and blue components are each represented
by a number from 0 through 255 (&HFF).
GetStringHeight
READ-ONLY Property - Returns the height of the given text string (in ScaleMode units)
Parameters
Returns
value – returns height of text string for currently selected font in ScaleMode units
GetStringWidth
READ-ONLY Property - Returns the width of the given text string (in ScaleMode units)
Parameters
Returns
value – returns width of text string for currently selected font in ScaleMode units
GetVersion
READ-ONLY Property - Returns an integer value representing the version of PrinterCE
Returns
Init
This method registers PrinterCE (or AsciiCE) with the application's RegID string to verify that the app is
licensed to use the printer functions.
Parameters
regidstring - registration id string provided when the PrinterCE license is purchased. This will identify
which version of PrinterCE is licensed and permit all licensed functions to work.
retval - boolean return value - True if registration was successful, false otherwise.
Remarks
If Init() is not called or is not successful, then the registry is queried to see if the user has registered a
single-use license. If not, then an "evaluation" version (30-day time limit) allows the user to continue
printing
IsColor
This READ-ONLY property returns TRUE if current selected printer can print color.
Returns
value – Boolean – TRUE if both printer and printer driver can print in color.
JustifyHoriz
This property returns and sets a value that determines the horizontal justification of following DrawText
and DrawImage methods.
Parameters
value - Integer that specifies horizontal justification of text and images. The following table describes the
settings for number.
JustifyVert
This property returns and sets a value that determines the vertical justification of following DrawText and
DrawImage methods..
Parameters
value - Integer that specifies vertical justification of text and images. The following table describes the
settings for number.
KillDoc
This method clears any printing commands and resets printing properties to default.
Causes the current page to be deleted (not printed) and then resets all properties to their default settings.
NewPage
This method causes the current page to be printed.
Remarks
Causes the current page to be printed. All properties except for TextX,TextY remain unchanged. See also
"EndDoc".
PgIndentLeft
This property returns and sets an indent from the left margin of the page where the start of the horizontal
printing is found.
Parameters
value - Numeric expression that specifies margin distance. The value is in printer resolution dots.
Remarks
The PgIndentLeft and PgIndentTop settings can be called multiple times while printing one page. All
subsequent drawing methods use the new settings (but prior drawing methods do not). Use this technique
to easily print multiple columns and/or rows of items.
PgIndentTop
This property returns and sets an indent from the top margin of the page where the start of the vertical
printing is found.
Parameters
value - Numeric expression that specifies margin distance. The value is in printer resolution dots.
Remarks
The PgIndentLeft and PgIndentTop settings can be called multiple times while printing one page. All
subsequent drawing methods use the new settings (but prior drawing methods do not). Use this technique
to easily print multiple columns and/or rows of items.
PrBottomMargin
This property returns and sets the bottom margin for the printed page
Parameters
value - Numeric expression that specifies margin distance. The value is in ScaleMode units. Default is
printer default margin value.
PrDialogBox
This method controls action of the "Printing in progress" dialog box (which allows the user to cancel the
print operation).
Parameters
Return Value
retval - Current status of operation (see table above). If not user cancel or AbortError, then returns current
status of printer dialog box (vbDlgUp, etc).
Remarks
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() for info on changing the text displayed or language used by this dialog.
PrDialogBoxText
This method allows changing the text displayed or language used by the "Printing in progress" dialog box.
Parameters
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
Remarks
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.
PrLeftMargin
This property returns and sets the left margin for the printed page
Parameters
value - Numeric expression that specifies margin distance. The value is in ScaleMode units. Default is
printer default margin value.
PrRightMargin
This property returns and sets the right margin for the printed page
Parameters
value - Numeric expression that specifies margin distance. The value is in ScaleMode units. Default is
printer default margin value.
PrSetDefaults
This method causes the printer control to reset all printer-specific values to the printer defaults.
PrTopMargin
This property returns and sets the Top margin for the printed page
Parameters
value - Numeric expression that specifies margin distance. The value is in ScaleMode units. Default is
printer default margin value.
PrOrientation
This property returns and sets the orientation of the printed page (portrait or landscaped)
Parameters
PrPaperSelection
This property returns and sets the paper selection for the printed page: Letter size or A4.
MFC Syntax: long value=PrinterCE1.GetPrPaperSelection();
PrinterCE1.SetPrPaperSelection(long value);
C++ Syntax: PrinterCE1.get_PrPaperSelection(long * value);
PrinterCE1.put_PrPaperSelection(long value);
eVB Syntax: PrinterCE1. PrPaperSelection [=value]
Parameters
PrPgHeight
READ-ONLY Property - Returns the current height of the printable area of the page (after subtracting out
Top & Bottom margins).
Returns
value - Numeric value of the page height in the current ScaleMode units.
PrPgWidth
READ-ONLY Property - Returns the current width of the printable area of the page (after subtracting out
Left & Right margins).
Parameters
PrPrintQuality
This property returns and sets the quality of the printing – High vs Draft
Parameters
Remarks
Rotation
This property returns and sets a value that determines the rotation of subsequent text and image drawing
commands.
Parameters
Remarks
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.
ScaleMode
This property returns and sets a value that indicates the unit of measurement for coordinates of printing
objects
Parameters
value - Integer that specifies the unit of measurement. The following table shows the settings for value.
Constant Setting Description
1
vbTwips Twip 1,440 twips per inch. 567 twips per centimeter
(default)
vbPoints 2 Point (72 points per logical inch)
vbPixels 3 Pixel (smallest unit of printer resolution
vbInches 5 Inch
vbMillimeters 6 Millimeter
vbCentimeters 7 Centimeter
SelectPrinter
This method pops up the Printer Dialog box to allow the user to select the printer and printer options to be
used for printing.
Remarks
If SelectPrinter is never called, the default printer and settings are used.
SetErrorLevel
This Write-Only property sets error level of errors returned by PrinterCE.
Parameters
Remarks
There are two approaches that a VB program can take while using PrinterCE… first is to set up "On Error"
statements in each sub or function that calls a PrinterCE method or property and use the "On Error"
handler to determine the course of action when an error occurs within PrinterCE. The second approach is
to use occasional calls to StatusCheck to determine if an error has occurred.
When an error occurs within PrinterCE, the severity of the error is determined and PrinterCE "remembers"
this as appropriate. So, for example, if a printer error occurs, the entire printing job must be aborted, so all
calls to PrinterCE will remember that it is aborting and this will be handled gracefully. However, if the error
is an "image file not found" error from a "DrawPicture" method, that current DrawPicture task must be
aborted, but the rest of the print job can continue.
This structure allows the VB program that uses PrinterCE to have a relaxed approach to error handling,
even to the point of ignoring errors completely (although it would be kind to the user to do StatusCheck
calls and display error dialog boxes as needed).
C++ and MFC-based applications can use the StatusCheck() method to determine if some error or user
action has caused AsciiCE to stop printing. Since AsciiCE stops trying to print once an error or user
cancel has been found, StatusCheck() only needs to be called when the application may be entering
some extended period of activity.
NOTE to eVB developers: Feedback we have gotten from eVB users is that eVB error trapping seems to
create more problems than it solves. My recommendation is to not use eVB "On Error" type trapping at
all. Simply use StatusCheck to determine if any
errors have occurred and handle as you wish.
Most apps actually only need to call StatusCheck for checking PrinterCE errors in two places:
- Right after SelectPrinter call - because this is the most common place the user might Cancel or a printer
connection error might occur (such as trying to establish an Infrared connection with no IR printer in
range).
- Right after call to EndDoc (and NewPage if you are printing multiple pages). This lets you determine if
an error was found between SelectPrinter and end of printing the page. If a vbAbortPrint error occurs after
SelectPrinter and before EndDoc, all PrinterCE functions will simply see the error condition and
immediately return until EndDoc, which resets the error condition and prepares PrinterCE to try again.
SetReportLevel
This Write-Only property sets error level of errors reported to user with MsgBox() error report by
PrinterCE.
Parameters
There are two approaches that a VB program can take while using PrinterCE… first is to set up "On Error"
statements in each sub or function that calls a PrinterCE method or property and use the "On Error"
handler to determine the course of action when an error occurs within PrinterCE. The second approach is
to use occasional calls to StatusCheck to determine if an error has occurred.
When an error occurs within PrinterCE, the severity of the error is determined and PrinterCE "remembers"
this as appropriate. So, for example, if a printer error occurs, the entire printing job must be aborted, so all
calls to PrinterCE will remember that it is aborting and this will be handled gracefully. However, if the error
is an "image file not found" error from a "DrawPicture" method, that current DrawPicture task must be
aborted, but the rest of the print job can continue.
This structure allows the VB program that uses PrinterCE to have a relaxed approach to error handling,
even to the point of ignoring errors completely (although it would be kind to the user to do StatusCheck
calls and display error dialog boxes as needed).
SetupNetPath
NOTE: All calls to SetupNetPath MUST be called BEFORE calling SetupPrinter().
This method sets network path - used if Port=PORT_NETPATH or PORT_IP. For PORT_NETPATH, just
pass the UNC path to PC and named shared printer (see example below). For PORT_IP, make two calls
to SetupNetPath - first one passes NetID string "+1" to specify that next SetupNetPath call will contain IP
address, then call again with IP address (see example).
Parameters
NetID
Value Description
string
Next call to SetupNetPath will pass text string
Network IP
+1 identifying Network IP Printer's IP address (for
Printer Addr
example: "192.168.0.1")
Next call to SetupNetPath will pass text string
Network IP Port
+2 identifying Network IP Printer's Port address (for
Addr
example: "9100")
For example, for an eVB app to specify Host PC to be "JoesPC" with networked printer named "HP995":
PrinterCE1.SetupNetPath "\\JoesPC\HP995"
'Now select printer type and network port type
PrinterCE1.SetupPrinter PR_HP_PCL, PORT_NETPATH, S_DONTCARE
If you wanted to use a network IP printer, you might use the following
SetupPrinter
This method sets the main printer settings
Parameters
Baudrate - One of the following baudrate selections (can use S_DONTCARE or any selection for
PORT_LPT or PORT_NETWORK port selections)::
SetupPaper
This method sets the main paper-selection settings
Parameters
PaperWidth, PaperHeight - Paper width and height used if PaperSize=vbCustom (in ScaleMode units).
Maximum values: 22 inches, 56 cm, 32000 twips - note that actual paper width settings depend on printer
selection and other factors.
LeftMgn, TopMgn, RightMgn, BottomMgn - Margins used for printed page (in ScaleMode units)
SetupPrinterOther
This method sets a variety of "other" printing options
Parameters
Handshake - Valid only for serial port selections (COM1 or COM2) - Defines serial port handshake:
BITFLAG_ADJUST_IR (0x01) - 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.
BITFLAG_ALTERNATE_IR (0x02) - IR Adjust - 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. If your device "hangs" (stops working) when trying to establish infrared connection, try
enabling IR Adjust. Do NOT check this item unless necessary, because it may result in significantly
slower printing speeds:
BITFLAG_COLOR (0x04) - Color - enables color printing for HP PCL, Canon BJC and Epson printer
selections.
BITFLAG_CMYONLY (0x08) - CMY 3-Color Printing - for color printers that do not have black ink.
BITFLAG_SINGLETHREAD (0x40) - PrinterCE normally uses two threads (separate processes) for
printing. Selecting BITFLAG_SINGLETHREAD forces PrinterCE to use one thread.
StatusCheck
This READ-ONLY property returns the current status of PrinterCE.
Returns
Remarks
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..
Most apps actually only need to call StatusCheck for checking PrinterCE errors in two places:
- Right after SelectPrinter call - because this is the most common place the user might Cancel or a printer
connection error might occur (such as trying to establish an Infrared connection with no IR printer in
range).
- Right after call to EndDoc (and NewPage if you are printing multiple pages). This lets you determine if
an error was found between SelectPrinter and end of printing the page. If a vbAbortPrint error occurs after
SelectPrinter and before EndDoc, all PrinterCE functions will simply see the error condition and
immediately return until EndDoc, which resets the error condition and prepares PrinterCE to try again.
TextX
This property returns and sets the current X coordinate for text positioning.
Parameters
value - Numeric value for the X coordinate. The next DrawText method call will use this coordinate to
position its text (unless DrawText overrides it with an X coordinate in the method). The TextX value is in
the current ScaleMode units. Actual position of the text is impacted by the JustifyHoriz/JustifyVert and
Rotation property settings. TextX is measured from the Left margin setting.
Remarks
TextX and TextY are automatically adjusted after every DrawText call to move to the next line of text. This
allows for automatic printing of multiple lines of text. The amount moved is dependent on the FontSize
(point size) of the text. The direction of movement is dependent on the Rotation property setting
TextY
This property returns and sets the current Y coordinate for text positioning.
Parameters
value - Numeric value for the Y coordinate. The next DrawText method call will use this coordinate to
position its text (unless DrawText overrides it with a Y coordinate in the method). The TextY value is in
the current ScaleMode units. Actual position of the text is impacted by the JustifyHoriz/JustifyVert and
Rotation property settings. TextY is measured from the Top margin setting.
Remarks
TextX and TextY are automatically adjusted after every DrawText call to move to the next line of text. This
allows for automatic printing of multiple lines of text. The amount moved is dependent on the FontSize
(point size) of the text. The direction of movement is dependent on the Rotation property setting