c# PrintCE SDK dll 开发文档 无线 蓝牙 打印 A4纸 组件 原创

 PrintCE SDK 开发文档 C#  无线 蓝牙 打印 组件

简体中文汉化组件下载 http://download.csdn.net/source/3420004


Graphic MODE printing:

1. For C/C++ programmers (eVC 3.0/4.0, MS Visual Studio 2005/2008)

1.1. Using set of functions PDC_ and corresponding to print functions for Win32
A C/C++ programmer acquainted with Win32 printing process can easily add printing to the program for Pocket PC. You can use this method in projects both including MFC or without MFC.

See Printing using PDC_ functions set for full details.

Note: See samples of projects using PDC_ print function set.

1.2. Using set of functions 'prn'.
This function set represents simplified approach to printing and allow developers non-acquainted with Win32 printing process to add printing function sparing their time.
You can use this method in projects both including MFC or without MFC. This method is the simplest one and the most preferable for projects of any grade of complexity.

See Printing using 'prn' functions set for full details.

Note: See samples of projects using 'prn' print function set.

2. For C# programmers (MS Visual Studio 2005/2008)

2.1. Using PrintCE SDK in MS Visual Studio 2005 /2008 for C#
A C# programmers can easily add printing to the program for .NET Compact Framework.

See using PrintCE SDK in your C# for .NET project for full details.

Note: See samples of projects.

3. For Visual Basic programmers (eVB 3.0, MS Visual Studio 2005/2008)

3.1. Using PrintCE SDK in eMbedded Visual Basic programs (eVB 3.0).
PrintCE.dll activates ActiveX control which is used for printing from eVB programs. Using ActiveX allows to easy adding to VB project of wide option range for text and graphic print management for WinCE.

See Printing using ActiveX control for full details.

Note: See samples of projects.

3.2. Using PrintCE SDK in MS Visual Studio 2005 / 2008 for Visual Basic.
A Visual Basic programmers can easily add printing to the program for .NET Compact Framework..

See using PrintCE SDK in your Visual Basic for .NET project for full details.

Note: See samples of projects.

 

TEXT MODE printing:

1. For C/C++ programmers (eVC 3.0/4.0, MS Visual Studio 2005/2008)

1.1. Using set of functions ASCII_
This function set represents simplified approach to printing into text mode. You can use this function set in projects both including MFC or without MFC.

See Printing using ASCII_ functions set for full details.

Note: See samples of projects using PDC_ print function set.

2. For C# programmers (MS Visual Studio 2005/2008)

2.1. Using PrintCE SDK in MS Visual Studio 2003 / 2005 /2008 for C#
A C# programmers can easily add text mode printing to the program for .NET Compact Framework.

See using PrintCE SDK in your C# for .NET project for full details.

Note: See samples of projects.

3. For Visual Basic programmers (eVB 3.0, MS Visual Studio 2005/2008)

3.1. Using PrintAscii ActiveX control in eMbedded Visual Basic programs.
PrintCE.dll activates ActiveX control which is used for printing from eVB programs. Using ActiveX allows to easy adding to VB project of wide option range for text and graphic print management for WinCE.

See Printing using PrintAscii ActiveX control for full details.

Note: See samples of projects.

3.2. Using PrintCE SDK in MS Visual Studio 2005 / 2008 for Visual Basic.
A Visual Basic programmers can easily add text mode printing to the program for .NET Compact Framework..

See using PrintCE SDK in your Visual Basic for .NET project for full details.

Note: See samples of projects.

 
 

Printing using PDC_ function set
Instruction for installation and used | Description functions

To use PrintCE in your C/C++ project you need to:

1. Copy PrintCE.dll to the \Windows\ directory on Pocket PC.
      you can use PrintCEDriver.arm.cab, PrintCEDriver.sh3.cab, PrintCEDriver.mips.cab for installation of PrintCE.dll or run PrintCEDriverPocketPC.exe or
PrintCEDriverWinCE.exe for automatic install from Desktop PC to Pocket PC/WinCE device.

2. Copy PrintCE.h in the directory with your project

3. Add line #include "PrintCE.h" in the code where PrintCE is supposed to be used.

4. PrintCE.h contains LoadPrintLib() function which performs explicit linking PrintCE.DLL. You should call this function before calling any other function from the library.
LoadPrintLib() returns TRUE if dll is found and FALSE if otherwise. To unload the library, use UnloadPrintLib().

Printing standard procedure includes steps as follows:

1. Load printing library LoadPrintLib().

if( LoadPrintLib() == FALSE ) {
      AfxMessageBox(_T("PrintCE.dll not Found"));
      return;
}

2. Initialization of printing library PDC_Init(_T("License key"))

// library initialization (licence key is transfered as a parameter)
PDC_Init(_T("Demo"));

3. Open 揚rint Setup?PDC_PrintDlg() or PDC_PageSetupDlg()

// show print setup dialog

PRINTDLG pdlg;

memset(&pdlg, 0, sizeof(PRINTDLG));
pdlg.cbStruct = sizeof(PRINTDLG);
pdlg.hwndOwner = hOwner;
pdlg.dwFlags = PD_INTHOUSANDTHSOFINCHES; // measuring units - inches

PDC_PrintDlg(&pdlg);

4. Get printer device context PDC_GetPrinterDC()

// get printer DC

HDC prnDC;

prnDC = PDC_GetPrinterDC();

5. Get parameters of printer device context for correct positioning of print elements PDC_GetDeviceCaps()

// get printer dpiX, dpiY, margins m_left, m_right, m_top, m_bottom
// and page sizes width, height in pixels

int dpiX, dpiY, width, height, m_left, m_right, m_top, m_bottom;
RECT page_rc;

dpiX = PDC_GetDeviceCaps(prnDC, LOGPIXELSX);
dpiY = PDC_GetDeviceCaps(prnDC, LOGPIXELSY);

m_left = (pdlg.rcMargin.left * dpiX)/1000;
m_right = (pdlg.rcMargin.right * dpiX)/1000;
m_top = (pdlg.rcMargin.top * dpiY)/1000;
m_bottom = (pdlg.rcMargin.bottom * dpiY)/1000;
width = PDC_GetDeviceCaps(prnDC, PHYSICALWIDTH) - (m_left + m_right);
height = PDC_GetDeviceCaps(prnDC, PHYSICALHEIGHT) - (m_top + m_bottom);

6. Start printing document PDC_StartDoc()

// start printing document

DOCINFO di;

memset(&di, 0, sizeof(DOCINFO));
di.cbSize = sizeof(DOCINFO);

PDC_StartDoc(prnDC, &di);

7. Print pages (the following steps should be taken for each of the pages:)

7.1. Start printing page PDC_StartPage()

PDC_StartPage(prnDC);

7.2. Print elements using set of functions

API CreatePen(), CreateSolidBrush(), CreateFontIndirect(), LoadBitmap(), etc.
or corresponding MFC
and set of functions PrintCE
PDC_SelectObject(), PDC_BitBlt(), PDC_DrawText(), PDC_Polyline(), PDC_Rectangle() etc.

// create pens of 0.01 (black) inches in width
HPEN hPenBlack;
hPenBlack = CreatePen(PS_SOLID, (int)(0.01 * dpiX), RGB(0,0,0));

// create red brushes
HBRUSH hBrushRed;
hBrushRed = CreateSolidBrush(RGB(255,0,0));

PDC_SelectObject(prnDC, hBrushRed);
PDC_SelectObject(prnDC, hPenBlack);

// draw Ellips 5x10 inch
PDC_Ellipse(prnDC, m_left, m_top, 5*dpiX, 10*dpiY);

7.3. End printing page PDC_EndPage()

PDC_EndPage(prnDC);

8. End printing document PDC_EndDoc()

PDC_EndDoc(prnDC);

9. Deinitialization of printing library PDC_UnInit()

PDC_UnInit();

10. Unload printing library UnloadPrintLib()

UnloadPrintLib();


Full set of PDC_ print functions exported from PrintCE.Dll :

Initialization Methods

MethodDescription
PDC_InitInitialization of library
PDC_UnInitDeinitialization of library
PDC_PrintDlgThis function displays Print Setup dialog box
PDC_PageSetupDlgThis function is replacement for PDC_PrintDlg . It displays Print Setup dialog box.
PDC_SilentPrintSetupThis function allows to set up printing without a printing dialog.
PDC_SetAbortProcThis function sets the application-defined function that allows a print job to be cancelledduring printing.
PDC_SetSilentModeThis function controls (permits or prohibits) presentation of a current printing statement window.
PDC_SetPDFFileThis function allows to set output PDF file path.
PDC_SetLanguageThis function sets language of the user interface.
PDC_SetPrnParamThis function sets specific printer and port settings.

Print Info

MethodDescription
PDC_GetVersionReturns current version of PrintCE
PDC_GetCurrentSetupThis function allows to get the current settings of printing.
PDC_GetStateThis function allows to get the current statement of a printing driver.
PDC_IsConnectionThis function is a simplified version of the PDC_GetState.
PDC_GetSentBytesThis function allows to get a number of bytes sent to printer.

Printer/Device Escape Methods

MethodDescription
PDC_StartDocThis function starts a print job
PDC_EndDocThis function ends a print job
PDC_StartPageThis function prepares the printer driver to accept data
PDC_EndPageThis function informs the device that the application has finished writing to a page

Device Context Methods

MethodDescription
PDC_GetPrinterDCReturns printer DC (Device Context).
PDC_CreateCompatibleDCCreates a memory device context (DC) compatible with the specified printer device context.
PDC_GetDeviceCapsRetrieves information about the capabilities of a printer device.
PDC_DeleteDCDeletes the specified printer or memory device context

Type-Safe Selection Methods

MethodDescription
PDC_SelectObjectThis function selects an object (HFONT, HBRUSH, HPEN, HBITMAP, or HDIBSECTION) into a printer device context

Drawing-Attribute Methods

MethodDescription
PDC_SetBkColorSets the current background color to the specified color.
PDC_SetBkModeSets the background mix mode of the specified printer device context.
PDC_SetROP2Sets the current foreground mix mode. Foreground mix mode used to combine pens and interiors of filled objects with the colors already on the screen.
PDC_SetTextColorSets the text color of the specified printer device context.

Line-Output Methods

MethodDescription
PDC_DrawLineDraws a line using the current pen.
PDC_PolylineDraws a series of line segments by connecting the points in the specified array.

Simple Drawing Methods

MethodDescription
PDC_RectangleDraws a rectangle.
PDC_RoundRectDraws a rectangle with rounded corners.

Ellipse Methods

MethodDescription
PDC_EllipseDraws an ellipse

Bitmap Methods

MethodDescription
PDC_BitBltTransfers pixels from a specified source rectangle to a specified destination rectangle, altering the pixels according to the selected raster operation (ROP) code
PDC_StretchBltCopies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary.

Text Methods

PDC_DrawTextDraws formatted text in the specified rectangle.
PDC_DrawTextFlowFlows text on the page.
PDC_GetTextFlowHeightReturns height of text.
PDC_ExtTextOutDraws a character string by using the currently selected font. An optional rectangle may be provided, to be used for clipping, opaquing, or both.
PDC_GetTextExtentPointComputes the width and height of the specified string of text.
PDC_GetTextExtentExPointRetrieves the number of characters in a specified string that will fit within a specified space and fills an array with the text extent for each of those characters.
PDC_GetTextMetricsFills the specified buffer with the metrics for the currently selected font.

Barcode Methods

PDC_Draw2OF5Draws Interleaved 2 of 5 type barcode.
PDC_DrawCodaBarDraws Codabar type barcode.
PDC_DrawCode39Draws Code 39 type barcode.
PDC_DrawCode93Draws Code 93 type barcode.
PDC_DrawCode128Draws Code 128 type barcode.
PDC_DrawEAN8Draws EAN-8 type barcode
PDC_DrawEAN13Draws EAN-13 type barcode
PDC_DrawMSIDraws MSI type barcode
PDC_DrawPostnetDraws Postnet type barcode
PDC_DrawUCC128Draws UCC 128 type barcode
PDC_DrawUPCADraws UPC-A type barcode
PDC_DrawUPCEDraws UPC-E type barcode
PDC_DrawPDF417Draws PDF417 type barcode
PDC_SetBarCodeHeightSets height of the bar code
PDC_SetBarCodeScaleSets scale factor of the bar code
PDC_SetBarCodeAngleSets rotation angle of the bar code

Printing using 'prn' function set
Instruction for installation and used | Description functions

To use PrintCE in your C/C++ project you need to:

1. Copy PrintCE.dll to the \Windows\ directory
      you can use PrintCEDriver.arm.cab, PrintCEDriver.sh3.cab, PrintCEDriver.mips.cab for installation of PrintCE.dll or run PrintCEDriver.exe for automatic install from Desktop PC to Pocket PC/WinCE.

2. Copy PrintCE.h in the directory with your project

3. Add line #include "PrintCE.h" in the code where PrintCE is supposed to be used.

4. PrintCE.h contains LoadPrintLib() function which performs explicit linking PrintCE.DLL.
You should call this function before calling any other function from the library.
LoadPrintLib() returns TRUE is dll is found and FALSE if otherwise.
To unload the library use UnloadPrintLib().

 

Printing standard procedure includes steps as follows:

1. Load printing library LoadPrintLib().

if( LoadPrintLib() == FALSE ) {
      AfxMessageBox(_T("PrintCE.dll not Found"));
      return;
}

2. Initialization of printing library prnInit (_T("License key"))

// library initialization (licence key is transfered as a parameter)

prnInit(_T("Demo"));

3. Open 揚rint Setup?prnSetupDlg()

// switch measuring units to inches
prnSetMeasureUnit(kInches);

// show print setup dialogue
prnSetupDlg(m_hWnd);

4. Start printing document prnStartDoc()

// start printing document
prnStartDoc();

5. Print pages (the following steps should be taken for each of the pages:)

5.1. Start printing page prnStartPage ()

// start printing page
prnStartPage();

5.2. Print elements using set of 憄rn?functions prnSetFontSize(), prnSetTextColor(), prnDrawText (), prnDrawLine(), prnDrawRect(), etc.

// print heading with font of 14 points in height, bold

prnSetFontName(_T("Tahoma"));
prnSetFontSize(14.0);
prnSetFontBold(TRUE);
prnDrawAlignedText(_T("Hello World"), prnGetPageWidth()/2, 0, hCenter, vTop);

6. End printing document prnEndDoc()

// end printing document
prnEndDoc();

7. Deinitialization of printing library prnUnInit()

// library deinitialization
prnUnInit();

8. Unload printing library UnloadPrintLib()

UnloadPrintLib();


Full set of 憄rn?print functions exported from PrintCE.Dll

Initialization

MethodDescription
prnInitInitialization of library.
prnUnInitDeinitialization of library.
prnSetupDlgThis function displays Print Setup dialog box.
prnStartDocThis function starts a print job.
prnEndDocThis function ends a print job
prnStartPageThis function prepares the printer driver to accept data
prnSilentPrintSetupThis function allows to set up printing without a printing dialog.
prnSetAbortProcThis function sets the application-defined function that allows a print job to be cancelledduring printing.
prnSetSilentModeThis function controls (permits or prohibits) presentation of a current printing statement window.
prnSetPDFFileThis function allows to set output PDF file path.
prnSetLanguageThis function sets language of the user interface.
prnSetPrnParamThis function sets specific printer and port settings.

Print info

MethodDescription
prnGetVersionReturns current version of PrintCE
prnGetCurrentSetupThis function allows to get the current settings of printing.
prnGetStateThis function allows to get the current statement of a printing driver.
prnIsConnectionThis function is a simplified version of the prnGetState.
prnGetSentBytesThis function allows to get a number of bytes sent to printer.

Text Functions

MethodDescription
prnDrawTextThe function draws a text
prnDrawText2This function draws a text with the selected colour
prnDrawTextFlowThe function flows text on the page
prnGetTextFlowHeightThe function returns height of text
prnDrawAlignedTextThe function draws a text horizontally and vertically aligned

Ellipse Functions

MethodDescription
prnDrawEllipseThis function draws an ellipse
prnDrawCircleThe function draws a circle of the selected radius

Line-Polygon Functions

MethodDescription
prnDrawLineThe function draws a line
prnDrawRectThe function draws a rectangle
prnDrawSolidRectThe function draws a rectangle filled with the selected colour
prnDrawRoundRectThe function draws a rectangle with rounded corners

Bitmap Functions

MethodDescription
prnDrawPictureThe function draws JPG or BMP file
prnGetPictureSizeThe function returns size of the picture in the JPG or BMP file
prnDrawBitmapThe function draws HBITMAP

Convert Function

MethodDescription
prnConvertValueThe function transfers values from one measurement unit to another
prnConvertValueXThe function transfers values from one measurement unit to another (for the X axis)
prnConvertValueYThe function transfers values from one measurement unit to another (for the Y axis)

Drawing-Attribute

MethodDescription
prnSetMeasureUnitThe function sets the current measurement unit for coordinates
prnGetMeasureUnitThe function returns the current measurement unit for coordinates
prnSetLineWidthThe function sets width of the line used for printing of rectangles, ellipses, lines and so on
prnGetLineWidthThe function returns width of the line used for printing of rectangles, ellipses, lines and so on
prnSetLineColorThe function sets colour of the line used for printing of rectangles, ellipses, lines and so on
prnGetLineColorThe function returns colour of the line used for printing of rectangles, ellipses, lines and so on
prnSetFillColorThe function sets colour of the filling used for printing of rectangles, ellipses and so on
prnGetFillColorThe function returns colour of the filling used for printing of rectangles, ellipses and so on
prnSetFillStyleThe function sets pattern of the filling used for printing of rectangles, ellipses and so on
prnGetFillStyleThe function returns pattern of the filling used for printing of rectangles, ellipses and so on
prnSetTextColorThe function sets colour of the text for printing
prnGetTextColorThe function returns colour of the text
prnSetTransparentTextBgrThis function sets the background mode of the text used by functions prnDrawText(), prnDrawAlignedText() and prnDrawText2()
prnSetTextHorAlignThis function sets a value that determines the horizontal justification used by functions prnDrawText() and prnDrawText2()
prnSetTextVertAlignThis function sets a value that determines the vertical justification used by functions prnDrawText() and prnDrawText2()

Font Functions

MethodDescription
prnSetFontNameThe function sets name of the font
prnGetFontNameThe function returns name of the font
prnSetFontSizeThe function sets size of the font (in points)
prnSetFontSize2The function sets size of the font used in measurement unit
prnGetFontSizeThe function returns font size in points
prnGetFontSize2The function returns font size in the selected measurement units
prnSetFontBoldThe function sets width of the font
prnGetFontBoldThe function returns width of the font
prnSetFontItalicThe function sets typeface Italic
prnGetFontItalicThe function returns typeface Italic
prnSetFontStrikeThe function sets the font style stroked
prnGetFontStrikeThe function returns the font style strpked
prnSetFontUnderlineThe function sets the font style Underline
prnGetFontUnderlineThe function returns the font style Underline
prnGetTextHeightThe function returns height of the text in the current units
prnGetTextWidthThe function returns width of the text in the current units
prnGetFontAngleThe function returns rotation angle of the font in degree
prnSetFontAngleThe functionsets rotation angle of the font in degree

Page Atribute

MethodDescription
prnGetPageHeightThe function returns height of the page in the current units
prnGetPageWidthThe function returns width of the page in the current units
prnGetLeftMarginThe function returns left margin on the page in the current measurement units
prnSetLeftMarginThe function set left margin on the page in the current measurement units
prnGetRightMarginThe function returns right margin on the page in the current measurement units
prnSetRightMarginThe function set right margin on the page in the current measurement units
prnGetTopMarginThe function returns upper margin on the page in the current measurement units
prnSetTopMarginThe function set upper margin on the page in the current measurement units
prnGetBottomMarginThe function returns lower margin on the page in the current measurement units
prnSetBottomMarginThe function set lower margin on the page in the current measurement units

Barcode Methods

prnDraw2OF5Draws Interleaved 2 of 5 type barcode.
prnDrawCodaBarDraws Codabar type barcode.
prnDrawCode39Draws Code 39 type barcode.
prnDrawCode93Draws Code 93 type barcode.
prnDrawCode128Draws Code 128 type barcode.
prnDrawEAN8Draws EAN-8 type barcode
prnDrawEAN13Draws EAN-13 type barcode
prnDrawMSIDraws MSI type barcode
prnDrawPostnetDraws Postnet type barcode
prnDrawUCC128Draws UCC 128 type barcode
prnDrawUPCADraws UPC-A type barcode
prnDrawUPCEDraws UPC-E type barcode
prnDrawPDF417Draws PDF417 type barcode
prnSetBarCodeHeightSets height of the bar code
prnSetBarCodeScaleSets scale factor of the bar code
prnSetBarCodeAngleSets rotation angle of the bar code

 

Printing using ASCII_ function set
Instruction for installation and used | Description functions

To use PrintCE in your C/C++ project you need to:

1. Copy PrintCE.dll to the \Windows\ directory on Pocket PC.
      you can use PrintCEDriver.arm.cab, PrintCEDriver.sh3.cab, PrintCEDriver.mips.cab for installation of PrintCE.dll or run PrintCEDriverPocketPC.exe or
PrintCEDriverWinCE.exe for automatic install from Desktop PC to Pocket PC/WinCE device.

2. Copy AsciiCE.h in the directory with your project

3. Add line #include "AsciiCE.h" in the code where ASCII_ functionsis supposed to be used.

4. AsciiCE.h contains LoadAsciiLib() function which performs explicit linking PrintCE.DLL. You should call this function before calling any other function from the library.
LoadAciiLib() returns TRUE if dll is found and FALSE if otherwise. To unload the library, use UnloadAsciiLib().

Printing standard procedure includes steps as follows:

1. Load printing library LoadAsciiLib().

if( LoadAsciiLib() == FALSE ) {
      AfxMessageBox(_T("PrintCE.dll not Found"));
      return;
}

2. Initialization of printing library ASCII_Init(_T("License key"))

// library initialization (licence key is transfered as a parameter)
ASCII_Init(_T("Demo"));

3. Connect to printer

// connect to printer
ASCII_Connect(port, port_param);

4. Send data to printer

// send string
ASCII_SendString(str);

// send char
ASCII_SendChar(ch);

// send array of bytes
ASCII_SendArray(byte_array, array_len);

5. Disconnect

ASCII_Disconnect();

9. Deinitialization of printing library ASCII_UnInit()

ASCII_UnInit();

10. Unload printing library UnloadAsciiLib()

UnloadAsciiLib();


Full set of ASCII_ print functions exported from PrintCE.Dll :

Initialization Methods

MethodDescription
ASCII_InitInitialization of library
ASCII_UnInitDeinitialization of library
ASCII_SetComPortParamSet COM port parameters
ASCII_SetLanguageThis function sets language of the user interface
ASCII_SetupPortThis function displays Port Setup dialog box

Print Info

MethodDescription
ASCII_GetVersionReturns current version of library
ASCII_GetStateThis function allows to get the current statement of a printing driver.
ASCII_GetSentBytesThis function allows to get a number of bytes sent to printer.

Connect/Disconnect

MethodDescription
ASCII_ConnectConnect to printer
ASCII_ConnectSilentConnect to printer (prohibits presentation of a current printing statement window)
ASCII_DisconnectClose connection

Send data

MethodDescription
ASCII_SendStringThis function allows to send string to printer
ASCII_SendCharThis function allows to send single character (byte) to printer
ASCII_SendArray This function allows to send array of bytes to printer

 


 

Printing using PrintCE ActiveX control
Instruction for Visual Basic (eVB 3.0) | Description functions

To use PrintCE ActiveX control in your Embedded Visual Basic (eVB 3.0) project you need to:

1. Click Start->Run on Desktop PC and type "regsvr32 Path\Desktop\PrintCE.dll". Path is PrintCE SDK files location. Sample: regsvr32 C:\Inesoft PrintCE SDK\eVB\PocketPC\Desktop\PrintCE.dll

2. Add PrintCE.bas file into your project. This file contains some predefined constants.

3. In eVB, select Tools -> Remote Tools -> Control Manager.

4. Expand element (click on the "+") corresponding to your device platform (ie Pocket PC 2002, Pocket PC, etc). You'll see three child elements: Emulation, Device and Desktop.

5. Selecting them one after another, perform the following actions for each of them: select "Control" menu -> Add New Control, in the opening window state path to PrintCE.DLL version corresponding to current platfirm (for Emulation - X86Em\PrintCE.dll, for Device element - select PrintCE.DLL corresponding to your PocketPC processor, Desktop Design Contor - select Desktop\PrintCE.dll) and press "Open".

All PrintCE.dll files is PrintCE SDK/eVB directory location.

6. You can use CreateObject() in your eVB code to create the PrintCE control or you can add the control to your control bar by selecting Project->Components and checking PrintCE. Then place the control on your form (it will be invisible at run-time) and start using it.

If you distribute PrintCE.dll with your program, you need to add registration of PrintCE.dll in .inf file for CabWizard (see VC help: "Creating an .inf File for the CAB Wizard" -> [DefaultInstall] section -> CESelfRegister) or see Example CAB


Description of methods and properties of PrintCE ActiveX control :

Initialization

Method
Methods or Properties
Description
Init
Method
Initialization of library
UnInit
Method
Deinitialization of library.
SetupDlg
Method
Displays Print Setup dialog box.
StartDoc
Method
Starts a print job.
EndDoc
Method
Ends a print job
StartPage
Method
Prepares the printer driver to accept data
SilentSetup
Method
Set up printing without a printing dialog.
Silent
Property
Controls (permits or prohibits) presentation of a current printing statement window.
PDFFile
Property
Sets output PDF file path.
Language
Property
Sets language of the user interface.

Print info

Method
Methods or Properties
Description
Version
Property
Current version of PrintCE driver
GetCurrentSetup
Method
Allows to get the current settings of printing.
State
Property
Current statement of a printing driver.
Connection
Property
Current statement of a connection.
SentBytes
Property
Number of bytes sent to printer.

Text Functions

Method
Methods or Properties
Description
DrawText
Method
Draws a text
DrawText2
Method
Draws a text with the selected colour
DrawTextFlow
Method
Flows text on the page
GetTextFlowHeight
Method
Returns height of text
DrawAlignedText
Method
Draws a text horizontally and vertically aligned

Ellipse Functions

Method
Methods or Properties
Description
DrawEllipse
Method
Draws an ellipse
DrawCircle
Method
Draws a circle of the selected radius

Line-Polygon Functions

Method
Methods or Properties
Description
DrawLine
Method
Draws a line
DrawRect
Method
Draws a rectangle
DrawSolidRect
Method
Draws a rectangle filled with the selected colour
DrawRoundRect
Method
Draws a rectangle with rounded corners

Bitmap Functions

Method
Methods or Properties
Description
DrawPicture
Method
Draws JPG or BMP file
GetPictureSize
Method
Returns size of the picture in the JPG orBMP file

Convert Function

Method
Methods or Properties
Description
ConvertValue
Method
Transfers values from one measurement unit to another

Drawing-Attribute

Method
Methods or Properties
Description
MeasureUnit
Property
Current measurement unit for coordinates
LineWidth
Property
Width of the line used for printing of rectangles, ellipses, lines and so on
LineColor
Property
Colour of the line used for printing of rectangles, ellipses, lines and so on
FillColor
Property
Colour of the filling used for printing of rectangles, ellipses, lines and so on
FillStyle
Property
Pattern of the filling used for printing of rectangles, ellipses and so on
TextColor
Property
Colour of the text used by functions DrawText(), DrawAlignedText() for printing
TransparentTextBgr
Property
Background mode of the text used by functions DrawText(), DrawAlignedText() and DrawText2()
TextHorAlign
Property
Value that determines the horizontal justification used by functions DrawText() and DrawText2()
TextVertAlign
Property
Value that determines the vertical justification used by functions DrawText() and DrawText2()

Font Functions

Method
Methods or Properties
Description
FontName
Property
Name of the font used by functions DrawText(), DrawText2, DrawAlignedText() for printing
FontSize
Property
Size of the font (in points) used by functions DrawText(), DrawText2, DrawAlignedText() for printing
SetFontSize2
Method
Sets size of the font used by the functions DrawText(), DrawText2, DrawAlignedText() for printing in the selected units
GetFontSize2
Method
Returns font size in the selected measurement units
FontBold
Property
Returns and sets the Bold font style
FontItalic
Property
Returns and sets the Italic font style
FontStrike
Property
Returns and sets the Strikeout font style
FontUnderline
Property
Returns and sets the Underline font style
GetTextHeight
Method
Returns height of the text in the current units
GetTextWidth
Method
Returns width of the text in the current units

Page Atribute

Method
Methods or Properties
Description
PageHeight
Property
Returns height of the page in the current units
PageWidth
Property
Returns width of the page in the current units
LeftMargin
Property
Left margin on the page in the current measurement units
RightMargin
Property
Right margin on the page in the current measurement units
TopMargin
Property
Top margin on the page in the current measurement units
BottomMargin
Property
Bottom margin on the page in the current measurement units

Barcode Methods

Method
Methods or Properties
Description
Draw2OF5
Method
Draws Interleaved 2 of 5 type barcode.
DrawCodaBar
Method
Draws Codabar type barcode.
DrawCode39
Method
Draws Code 39 type barcode.
DrawCode93
Method
Draws Code 93 type barcode.
DrawCode128
Method
Draws Code 128 type barcode.
DrawEAN8
Method
Draws EAN-8 type barcode
DrawEAN13
Method
Draws EAN-13 type barcode
DrawMSI
Method
Draws MSI type barcode
DrawPostnet
Method
Draws Postnet type barcode
DrawUCC128
Method
Draws UCC 128 type barcode
DrawUPCA
Method
Draws UPC-A type barcode
DrawUPCE
Method
Draws UPC-E type barcode
BarcodeHeight
Property
Height of the bar code

 


Printing using PrintAscii ActiveX control
Instruction for Visual Basic (eVB 3.0) | Description functions

To use PrintAscii ActiveX control in your Embedded Visual Basic (eVB 3.0) project you need to:

1. Click Start->Run on Desktop PC and type "regsvr32 Path\Desktop\PrintCE.dll". Path is PrintCE SDK files location. Sample: regsvr32 C:\Inesoft PrintCE SDK\eVB\PocketPC\Desktop\PrintCE.dll

2. Add PrintCE.bas file into your project. This file contains some predefined constants.

3. In eVB, select Tools -> Remote Tools -> Control Manager.

4. Expand element (click on the "+") corresponding to your device platform (ie Pocket PC 2002, Pocket PC, etc). You'll see three child elements: Emulation, Device and Desktop.

5. Selecting them one after another, perform the following actions for each of them: select "Control" menu -> Add New Control, in the opening window state path to PrintCE.DLL version corresponding to current platform (for Emulation - X86Em\PrintCE.dll, for Device element - select PrintCE.DLL corresponding to your PocketPC processor, Desktop Design Contor - select Desktop\PrintCE.dll) and press "Open".

All PrintCE.dll files is PrintCE SDK/eVB directory location.

6. You can use CreateObject() in your eVB code to create the PrintAscii control or you can add the control to your control bar by selecting Project->Components and checking PrintAscii. Then place the control on your form (it will be invisible at run-time) and start using it.

If you distribute PrintCE.dll with your program, you need to add registration of PrintCE.dll in .inf file for CabWizard (see VC help: "Creating an .inf File for the CAB Wizard" -> [DefaultInstall] section -> CESelfRegister) or see Example CAB


Description of methods and properties of PrintAscii ActiveX control :

Initialization

Method
Methods or Properties
Description
Init
Method
Initialization of library
UnInit
Method
Deinitialization of library.
SetComPortParam
Method
Set COM port parameters.

Print Info

Method
Methods or Properties
Description
Version
Property
Current version of library
State
Property
Current statement of a printing driver.
SentBytes
Property
Number of bytes sent to printer.

Connect/Disconnect

Method
Methods or Properties
Description
Connect
Method
Connect to printer
Disconnect
Method
Close connection

Send data

Method
Methods or Properties
Description
SendString
Method
Send string to printer
SendChar
Method
Send single character (byte) to printer

 


Printing using PrintCE SDK for Visual Studio 2005 & 2008 .NET

To use PrintCE SDK in your C# project you need to:

1. Copy PrintCE.dll to the \Windows\ directory
      use PrintCEDriver.arm.cab, PrintCEDriver.sh3.cab, PrintCEDriver.mips.cab for installation of PrintCE.dll or run PrintCEDriver.exe for automatic install from Desktop PC to Pocket PC/WinCE.

2. Copy PrintCE.cs in the directory with your project

3. Add PrintCE.cs to your project (menu "Project/Add existing item...")

4. Add line using PrintCENET; in the code where PrintCE is supposed to be used.

5. Create PrintCE class for graphic mode printing or PrintASCII class for text mode printing

PrintCE print1 = null;

print1 = new PrintCE();

or

PrintASCII print1 = null;

print1 = new PrintASCII();

For details see description of methods and properties of PrintCE .NET control and PrintAscii .NET control

If you distribute PrintCE.dll with your program, you need to add registration of PrintCE.dll in .inf file for CabWizard (please refer to VC help: "Creating an .inf File for the CAB Wizard" -> [DefaultInstall] section -> CESelfRegister) or see Example CAB

To use PrintCE SDK in your Visual Basic for .NET project you need to:

1. Copy PrintCE.dll to the \Windows\ directory
      use PrintCEDriver.arm.cab, PrintCEDriver.sh3.cab, PrintCEDriver.mips.cab for installation of PrintCE.dll or run PrintCEDriver.exe for automatic install from Desktop PC to Pocket PC/WinCE.

2. Copy PrintCE.vb in the directory with your project

3. Add PrintCE.vb to your project (menu "Project/Add existing item...")

4. Create PrintCE class for graphic mode printing or PrintASCII class for text mode printing.

Dim print1 As PrintCE

print1 = New PrintCE

or

Dim print1 As PrintASCII

print1 = New PrintASCII

For details see description of methods and properties of PrintCE .NET control and PrintAscii .NET control

If you distribute PrintCE.dll with your program, you need to add registration of PrintCE.dll in .inf file for CabWizard (please refer to VC help: "Creating an .inf File for the CAB Wizard" -> [DefaultInstall] section -> CESelfRegister) or see Example CAB

 


Description of methods and properties of PrintCE .NET control :

Initialization

Method
Methods or Properties
Description
Init
Method
Initialization of library
UnInit
Method
Deinitialization of library.
SetupDlg
Method
Displays Print Setup dialog box.
StartDoc
Method
Starts a print job.
EndDoc
Method
Ends a print job
StartPage
Method
Prepares the printer driver to accept data
SilentPrintSetup
Method
Set up printing without a printing dialog.
SilentMode
Property
Controls (permits or prohibits) presentation of a current printing statement window.
PDFFile
Property
Sets output PDF file path.
Language
Property
Sets language of the user interface.
SetPrnParam
Method
Sets specific printer and port settings.

Print info

Method
Methods or Properties
Description
Version
Property
Current version of PrintCE driver
GetCurrentSetup
Method
Allows to get the current settings of printing.
State
Property
Current statement of a printing driver.
Connection
Property
Current statement of a connection.
SentBytes
Property
Number of bytes sent to printer.

Text Functions

Method
Methods or Properties
Description
DrawText
Method
Draws a text
DrawText2
Method
Draws a text with the selected colour
DrawTextFlow
Method
Flows text on the page
GetTextFlowHeight
Method
Returns height of text
DrawAlignedText
Method
Draws a text horizontally and vertically aligned

Ellipse Functions

Method
Methods or Properties
Description
DrawEllipse
Method
Draws an ellipse
DrawCircle
Method
Draws a circle of the selected radius

Line-Polygon Functions

Method
Methods or Properties
Description
DrawLine
Method
Draws a line
DrawRect
Method
Draws a rectangle
DrawSolidRect
Method
Draws a rectangle filled with the selected colour
DrawRoundRect
Method
Draws a rectangle with rounded corners

Bitmap Functions

Method
Methods or Properties
Description
DrawPicture
Method
Draws JPG or BMP file
DrawBitmap
Method
Draws Bitmap
GetPictureSize
Method
Returns size of the picture in the JPG orBMP file

Convert Function

Method
Methods or Properties
Description
ConvertValue
Method
Transfers values from one measurement unit to another

Drawing-Attribute

Method
Methods or Properties
Description
MeasureUnit
Property
Current measurement unit for coordinates
LineWidth
Property
Width of the line used for printing of rectangles, ellipses, lines and so on
LineColor
Property
Colour of the line used for printing of rectangles, ellipses, lines and so on
FillColor
Property
Colour of the filling used for printing of rectangles, ellipses, lines and so on
FillStyle
Property
Pattern of the filling used for printing of rectangles, ellipses and so on
TextColor
Property
Colour of the text used by functions DrawText(), DrawAlignedText() for printing
TransparentTextBgr
Property
Background mode of the text used by functions DrawText(), DrawAlignedText() and DrawText2()
TextHorAlign
Property
Value that determines the horizontal justification used by functions DrawText() and DrawText2()
TextVertAlign
Property
Value that determines the vertical justification used by functions DrawText() and DrawText2()

Font Functions

Method
Methods or Properties
Description
FontName
Property
Name of the font used by functions DrawText(), DrawText2, DrawAlignedText() for printing
FontSize
Property
Size of the font (in points) used by functions DrawText(), DrawText2, DrawAlignedText() for printing
FontBold
Property
Returns and sets the Bold font style
FontItalic
Property
Returns and sets the Italic font style
FontStrike
Property
Returns and sets the Strikeout font style
FontUnderline
Property
Returns and sets the Underline font style
FontAngle
Property
Returns and sets the rotation angle of the font
GetTextHeight
Method
Returns height of the text in the current units
GetTextWidth
Method
Returns width of the text in the current units

Page Atribute

Method
Methods or Properties
Description
PageHeight
Property
Returns height of the page in the current units
PageWidth
Property
Returns width of the page in the current units
LeftMargin
Property
Left margin on the page in the current measurement units
RightMargin
Property
Right margin on the page in the current measurement units
TopMargin
Property
Top margin on the page in the current measurement units
BottomMargin
Property
Bottom margin on the page in the current measurement units

Barcode Methods

Method
Methods or Properties
Description
Draw2OF5
Method
Draws Interleaved 2 of 5 type barcode.
DrawCodaBar
Method
Draws Codabar type barcode.
DrawCode39
Method
Draws Code 39 type barcode.
DrawCode93
Method
Draws Code 93 type barcode.
DrawCode128
Method
Draws Code 128 type barcode.
DrawEAN8
Method
Draws EAN-8 type barcode
DrawEAN13
Method
Draws EAN-13 type barcode
DrawMSI
Method
Draws MSI type barcode
DrawPostnet
Method
Draws Postnet type barcode
DrawUCC128
Method
Draws UCC 128 type barcode
DrawUPCA
Method
Draws UPC-A type barcode
DrawUPCE
Method
Draws UPC-E type barcode
DrawPDF417
Method
Draws PDF417 type barcode
BarcodeHeight
Property
Height of the bar code
BarcodeScale
Property
Scale factor of the bar code
BarcodeAngle
Property
Rotation angle of the bar code

 


Description of methods and properties of PrintAscii .NET control :

Initialization

Method
Methods or Properties
Description
Init
Method
Initialization of library
UnInit
Method
Deinitialization of library.
SetComPortParam
Method
Set COM port parameters.
Language
Property
Language of the user interface.
SetupPort
Method
Displays Port Setup dialog box.

Print Info

Method
Methods or Properties
Description
Version
Property
Current version of library
State
Property
Current statement of a printing driver.
SentBytes
Property
Number of bytes sent to printer.

Connect/Disconnect

Method
Methods or Properties
Description
Connect
Method
Connect to printer
ConnectSilent
Method
Connect to printer (prohibits presentation of a current printing statement window)
Disconnect
Method
Close connection

Send data

Method
Methods or Properties
Description
SendString
Method
Send string to printer
SendByte
Method
Send single byte (character) to printer
SendBytes
Method
Send array of bytes to printer

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值