FieldSoftware
Home

PrinterCE SDK
   General Info
   Download
   Purchase & Pricing

Developer Info
   eVC MFC
   eVC C/C++
   eVB

Special Features
   AsciiCE
   PrintDC
   BarcodeCE

Documentation
   PrinterCE SDK
   AsciiCE
   PrintDC
   BarcodeCE

Special Topics
  Supported Printers
  Bluetooth Printing
  Network Printing

  DLL Load Error

.Net CF C# or VB.Net:
  PrinterCE.NetCF SDK

-----------------------------

Software Developers
  PrinterCE SDK
 
PrinterCE.NetCF SDK
  PocketHTMLprint SDK

Printing Utilities
  SmartPhonePrint
  PrintPocketCE
  PIEprint
  PocketPixPrint
  PocketShot
 
PocketClipPrint

 Arcade Games
  SockOut
  MazeCraze

Contact Info

PrinterCE Developer's Guide
Library Name : PrinterCE
DLL Name : PrEngineCE.dll
Control Name: PrEngineCE.PrinterCE

The PrinterCE ActiveX control provides the Windows CE software developer with tools to add printing capabilities to eVB, eVC (MFC/CE and C/C++) applications developed in Microsoft’s CE Studio. The PrinterCE control actually consists of three separate controls wrapped into the PrEngineCE.dll:

bulletPrinterCE: The primary control for printing text, images, drawing objects (lines, rectangles, and so on) and much more.
bulletAsciiCE2: A separate control that allows for printing pure ASCII text to any ASCII printer.
bulletPrintDC : Emulates the standard Windows printing process for C/C++/MFC developers porting existing Windows apps.
bulletBarcodeCE: An optional control that adds over a dozen barcode types to the PrinterCE toolkit.

 

 PrinterCE Methods & Properties

About

READ-ONLY property returns string describing this version of PrinterCE/AsciiCE/BarcodeCE.

MFC Syntax: Cstring str =PrinterCE1.GetAbout();

C++ Syntax: PrinterCE1.get_About(BSTR* str);

eVB Syntax: str=PrinterCE1.About

 

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.

MFC Syntax: long bitvals =PrinterCE1.GetCapabilities();

C++ Syntax: PrinterCE1.get_Capabilities(long * bitvals);

eVB Syntax: bitvals = PrinterCE1.Capabilities

Returns

Bit values that identify the capabilities of the current control:

Constant

Setting

Description

CAPS_STD

01h

PrinterCE Standard capabilities

CAPS_PLUS

02h

PrinterCE SDK

CAPS_ASCII

04h

AsciiCE

CAPS_BARCODE

08h

BarcodeCE

CAPS_ASCII2

10h

AsciiCE2

CAPS_PRINTDC

20h

PrintDC

ConvertCoord

This method converts a value from one ScaleMode system to another.

MFC Syntax: float toval=PrinterCE1.ConvertCoord(float fromval, long fromscale, long toscale);
C++ Syntax:  PrinterCE1.ConvertCoord(float fromval, long fromscale, long toscale,float* toval);  
eVB Syntax: toval = PrinterCE1.DrawConvertCoord fromval, fromscale, toscalee

Parameters

fromval - Value to be converted
fromscale - "convert from" ScaleMode
toscale - "convert to" ScaleMode.

Returns

toval - Converted value.

Example:

To convert 1.25 inches into printer resolution: PrResVal=PrCE1.ConvertCoord(1.25,vbInches,vbPixels)

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

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 – Optional - RGB color of a circle's outline. If omitted (or NULL), the ForeColor value is used.
aspect – Optional - 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).

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

x1, y1 - starting coordinates for a line or rectangle
x2, y2 - ending coordinates for a line or rectangle.
color – Optional - RGB color used to draw a line. If omitted/NULL, the ForeColor value is used.
boxfill – Optional – If omitted or NULL, simple line is drawn. if = vbLineBox causes a box to be drawn using the coordinates to specify opposite corners of the box. vbLineBoxFill specifies that the box is filled with the same color used to draw the box. (See DrawRect and DrawRoundedRect for other ways to draw rectangles)

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.

MFC Syntax: PrinterCE1.DrawPicture(BSTR picture,float x,float y,VARIANT* width,VARIANT* height,VARIANT* keepaspect);
C++ Syntax:
PrinterCE1.DrawPicture(BSTR picture,float x,float y,VARIANT* width,VARIANT* height,VARIANT* keepaspect);
eVB Syntax:
  PrinterCE1.DrawPicture picture, x, y, [width], [height], [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 : Optional destination width of picture. If omitted or if zero, the actual image width is used.
height : Optional destination height of picture. If omitted or if zero, the actual image height is used.

keepaspect :
 

keepaspect value

Description

TRUE

Aspect Ratio (width to height of original image is retained. Image is sized to fit inside area of "width" x "height"

FALSE (default)

Image is stretched or scrunched to fit within "width" x "height"

2

Returns actual width and height of image in "width" and "height" values... NO PICTURE IS DRAWN!. Uses ScaleMode to determine unit of measure for width & height values. Input values for x, y, width and height are not used when determining and returning image width and height.

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.

MFC Syntax:   PrinterCE1.DrawPoint(float x, float y,VARIANT* color);

C++ Syntax:    PrinterCE1.DrawPoint(float x, float y,VARIANT* color);              

eVB Syntax:  PrinterCE1.DrawPoint x, y, [color]

Parameters

x, y - Coordinates of the point to draw (in ScaleMode units)
color - Optional. RGB color for point. If omitted/NULL, the current ForeColor value setting is used.

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

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.

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.

MFC Syntax:    PrinterCE1.DrawText(LPSTSTR str, VARIANT* x VARIANT* y, VARIANT* count);

C++ Syntax:     PrinterCE1.DrawText(BSTR str, VARIANT* x VARIANT* y, VARIANT* count);

eVB Syntax:   PrinterCE1.DrawText string, [x], [y], [count]

Parameters

string - Text to be drawn.
x, y - Optional. Coordinates of the text to be drawn. If not specified or NULL, string is drawn at the intrinsic (TextX,TextY) coordinates.
count - Optional. Number of characters in "string" that should be printed – if not specified or NULL then entire line of text is drawn.

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.

MFC Syntax: float size =PrinterCE1.GetDrawWidth();

                    PrinterCE1.SetDrawWidth(float size);

C++ Syntax:  PrinterCE1.get_DrawWidth(float * size);

                    PrinterCE1.put_DrawWidth(float size);

eVB Syntax: PrinterCE1.DrawWidth [=size]

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.

MFC Syntax:      PrinterCE1.EndDoc();

C++ Syntax:      PrinterCE1.EndDoc();

eVB Syntax:   PrinterCE1.EndDoc

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.

MFC Syntax: long value =PrinterCE1.GetFillColor();

                    PrinterCE1.SetFillColor(long value);

C++ Syntax:  PrinterCE1.get_FillColor(long * value);

                    PrinterCE1.put_FillColor(long value);

eVB Syntax: PrinterCE1.FillColor [=value]

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.

MFC Syntax: long value =PrinterCE1.GetFillStyle();

                    PrinterCE1.SetFillStyle(long value);

C++ Syntax:  PrinterCE1.get_FillStyle(long * value);

                    PrinterCE1.put_FillStyle(long value);

eVB Syntax:  PrinterCE1.FillStyle [=value]

Parameters

value - Integer that specifies the fill style. The following table describes the settings for number.

Constant

Setting

Description

picFSSolid

0

Solid

picFSTransparent

1 (default)

Transparent

Remarks

When the FillStyle property is set Transparent, the FillColor setting is ignored.

FontBold

This property returns and sets the Bold font style.

MFC Syntax: long value =PrinterCE1.GetFontBold();

                    PrinterCE1.SetFontBold(long value);

C++ Syntax:  PrinterCE1.get_FontBold(long * value);

                    PrinterCE1.put_FontBold(long value);

eVB Syntax:  PrinterCE1.FontBold [=value]

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.

MFC Syntax: long value =PrinterCE1.GetFontBoldVal();

                    PrinterCE1.SetFontBoldVal(long value);

C++ Syntax:  PrinterCE1.get_FontBoldVal(long * value);

                    PrinterCE1.put_FontBoldVal(long value);

eVB Syntax:  PrinterCE1.FontBoldVal [=value]

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

Sets the "current font settings" to selected weight..

FontItalic

This property returns and sets the Italic font style.

MFC Syntax: long value =PrinterCE1.GetFontItalic();

                    PrinterCE1.SetFontItalic(long value);

C++ Syntax:  PrinterCE1.get_FontItalic(long * value);

                    PrinterCE1.put_FontItalic(long value);

eVB Syntax: PrinterCE1.FontItalic [=value]

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

Use these font properties to format text.

FontName

This property returns and sets the font used to print text..

MFC Syntax: Cstring font =PrinterCE1.GetFontName();

                    PrinterCE1.SetFontName(BSTR font);

C++ Syntax:  PrinterCE1.get_FontName(BSTR* font);

                    PrinterCE1.put_FontName(BSTR font);

eVB Syntax:  PrinterCE1.FontName [=font]

Parameters

font - String expression that specifies the font name to use.

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.

MFC Syntax: long value =PrinterCE1.GetFontSize();

                    PrinterCE1.SetFontSize(long value);

C++ Syntax:  PrinterCE1.get_FontSize(long * value);

                    PrinterCE1.put_FontSize(long value);

eVB Syntax:  PrinterCE1.FontSize [=value]

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.

MFC Syntax: long value =PrinterCE1.GetFontStrikethru();

                    PrinterCE1.SetFontStrikethru(long value);

C++ Syntax:  PrinterCE1.get_FontStrikethru(long * value);

                    PrinterCE1.put_FontStrikethru(long value);

eVB Syntax:  PrinterCE1.FontStrikethru [=value]

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.

MFC Syntax: long value =PrinterCE1.GetForeColor();

                    PrinterCE1.SetForeColor(long value);

C++ Syntax:  PrinterCE1.get_ForeColor(long * value);

                    PrinterCE1.put_ForeColor(long value);

eVB Syntax: PrinterCE1.ForeColor [=value]

Parameters

value – RGB color value. Default color is set to Black.

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)

MFC Syntax: float value =PrinterCE1.GetGetStringHeight(BSTR string);

C++ Syntax:            PrinterCE1.get_GetStringHeight(BSTR string, float* value);

eVB Syntax:            value=PrinterCE1.GetStringHeight(string)

Parameters

string – Text string

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)

MFC Syntax: float value =PrinterCE1.GetGetStringWidth(BSTR string);

C++ Syntax:  PrinterCE1.get_GetStringWidth(BSTR string, float* value);

eVB Syntax:  value=PrinterCE1.GetStringWidth(string)

Parameters

string – Text string