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

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

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

Software Developers
  PrinterCE SDK
 
PrinterCE.NetCF SDK
  PocketHTMLprint SDK

Printing Utilities
  PrintPocketCE
  PIEprint
  PocketPixPrint
  PocketShot
 
PocketClipPrint

 Arcade Games
  SockOut
  MazeCraze

Contact Info

PrintDC SDK
Included with PrinterCE SDK
Library Name : PrEngineCE.lib
DLL Name : PrEngineCE.dll

PrintDC SDK is a set of printing-related functions exported by the PrinterCE DLL (PrEngineCE.dll) that closely emulates the standard Windows printing process. PrintDC assists Windows Mobile/WinCE C/C++/MFC developers in porting applications from Windows as well as developers who are familiar with the standard Windows printing process. While the PrinterCE control offers many benefits for most Windows Mobile/WinCE apps that need printing, PrintDC can speed the task of porting printer functionality from an existing Windows app.

In order to emulate the standard Windows printing process as closely as possible, it was necessary to design PrintDC for use as a set of standard DLL-exported functions rather than as an ActiveX control like PrinterCE. This prevents use of PrintDC by eVB, but provides easy use by eVC/VCCE in C/C++/MFC apps. Note that PrintDC's functions closely emulate the Windows CE HPC and HPC/Pro printing functions. PrintDC is a part of PrinterCE SDK and works on Windows Mobile, Pocket PC, CE.Net and Windows CE devices.

Downloading & Using PrintDC SDK:
To use PrintDC, you need to download the following from the table below:

bullet

PrintDC.h - #include file that defines PrintDC functions exported by PrinterCE

bullet

PrEngineCE.lib file for each WinCE platform and processor. Copy these into the "LIB" directories on your desktop so that the Link process will find them. Then add path to this for each processor in your eVC project: Project menu -> Settings -> Link Tab -> Object/Library modules list.

bullet

PrEngineCE.dll for each WinCE platform and processor. Download the PrinterCE installer for each platform and run it to install and register PrinterCE to your devices. Alternatively, you can download each DLL separately

 

NOTE: You also need to download and install PrinterCE here.

PrintDC Demo

NOTE: Also download
and install PrinterCE
here.


PrintDC Demo Pocket PC WM6, WM5, PPC2003

PrintDC Demo H/PC Pro, 2000
 

PrEngineCE.LIB Files Pocket PC WM6, WM5, PPC2003: ARM    Emulator
Pocket PC 2000:
ARM
    MIPS    SH3    Emulator
H/PC Pro & 2000: ARM
    MIPS    SH3    SH4    Emulator

CE.Net 5.x -
ARM4/XScale    Emulator

CE.Net v4.x ARM/XScale using 240x320 displays:
ARM4/XScale/ARMv4I CAB     ARMv4T CAB    Emulator

CE.Net ARM/XScale using horizontal displays such as 640x240
ARM4/XScale/ARMv4I CAB     ARMv4T CAB
    Emulator

Download PrintDC.h - Include in your app to define PrintDC functions
Download PrintDC Demo source code

PrintDC Demo & Source Code:
The best way to demonstrate and explore PrintDC is to download the PrintDC Demo and PrinterCE (see table). The demo shows how PrintDC can select fonts and text attributes, print out text, draw objects (lines, rectangles, ellipsis), and a bitmap image. Anyone familiar with standard Windows printing code will be familiar with the steps found in the PrintDC demo. Note that the text portion of the demo determines the correct font size that will allow the array of text strings to fit within the page size. The demo source code includes code for reading and printing a BMP bitmap file and shows how to use PDC_SetAbortProc() to provide a "printing in progress" screen with cancel button for the user.

Overview of PrintDC Printing Process :
Below is an outline of the typical steps involved with using PrintDC to print on Windows CE devices. Notice that all PrintDC functions begin with the PDC_ prefix, but anyone familiar with standard Windows printing will easily recognize these steps:

bullet

PDC_PrintDlg() - Puts up "Select Printer" dialog box, returns printer DC (device context) and other printer info.

bullet

PDC_SetAbortProc() - Establish abort query handler which main app is responsible for.

bullet

PDC_StartDoc() - Start printing document

bullet

PDC_StartPage() - Start next page

bullet

PDC GDI calls to draw printing data to printer device context (see functions below)

bullet

PDC_EndPage() - print out this page... if more pages to print, loop back to PDC_StartPage()

bullet

PDC_EndDoc() - done with the document - close printer connection

bullet

PDC_DeleteDC() - delete Printer DC.

Notes:

bullet

Fonts, pens, and brushes can be created using all standard functions (such as CreateFontIndirect(), etc).. See limitations under PDC_SelectObject() below.

bulletBitmaps and DIBSections can be created in any desired way. PDC_CreateCompatibleDC() is then used to create a memDC, the image is selected into the printer DC via PDC_SelectObject() and “printed” via PDC_BitBlt() or PDC_StretchBlt(). See PrintDC_Demo source code for full code to read a bitmap BMP file into memory and use PrintDC to print it.
bulletLine drawing is done via PDC_Polyline().

PrintDC Functions: Click here for PrintDC documentation

PrintDC Standard
Printing Functions
Special PrintDC Functions
PDC_BitBlt()
PDC_CreateCompatibleDC()
PDC_DeleteDC()
PDC_DrawText()
PDC_Ellipse()
PDC_EndDoc()
PDC_EndPage()
PDC_ExtTextOut()
PDC_GetDeviceCaps()
PDC_GetLastError()

PDC_GetTextExtentExPoint()

PDC_GetTextExtentPoint()
PDC_GetTextMetrics()
PDC_PageSetupDlg()
PDC_Polyline()
PDC_PrintDlg()
PDC_Rectangle()
PDC_RoundRect()
PDC_SelectObject()
PDC_SetAbortProc()
PDC_SetBkColor()
PDC_SetBkMode()
PDC_SetROP2()
PDC_StartDoc()
PDC_StartPage()
PDC_StretchBlt()
PDC_SetTextColor(
)
PDC_Init() 
PDC_UnInit()
PDC_SetReportLevel()
PDC_StatusCheck()
PDC_GetPrinterDC()
PDC_GetVersion()
PDC_SetScaleMode()
PDC_SetupPrinter()
PDC_SetupPrinterOther()
PDC_SetupPaper()
PDC_SetupNetPath()

"Hello World" Example:
This demo function works with PrintDC (all of the PDC_xxx() functions) to pop up a "Select Printer" dialog box and then print out "Hello World". A "real" application would need to add other items such as an AbortProc (via PDC_SetAbortProc()) to display a "Printing in Progress" dialog box. See PrintDC_Demo for source code that implements a full-featured demo print page, including an example AbortProc and code to read a BMP file and print it out via PrintDC.

#include "PrintDC.h"   //Contains function definitions for PrintDC
// Be sure to download and copy PrEngineCE.lib files (see table above) for each processor
//   in each platform and add this to Project -> Settings -> Link -> Object/Library Modules.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void PrintDC_HelloWorld(HWND hWnd)
{
   //Initialize PrintDC
   PDC_Init(_T("YOUR LICENSE KEY"));

   // Let user select printer
   PRINTDLG pdlg;
   memset(&pdlg, 0, sizeof(PRINTDLG));
   pdlg.cbStruct = sizeof(PRINTDLG);
   pdlg.hwndOwner= hWnd;
   pdlg.dwFlags = PD_SELECTPORTRAIT | PD_INTHOUSANDTHSOFINCHES;
   if (!PDC_PrintDlg(&pdlg)) {  //Show "Select Printer" dialog
      PDC_KillDoc(NULL);  //user may have pressed cancel - free PrintDC resources and clear error condition
     
return;
   }

   //Get the printer DC
   HDC hPrDC;
   hPrDC=pdlg.hdc; //Can also use PDC_GetPrinterDC()
   if (hPrDC==NULL) return;
   //Get printer resolution
   int DPI;
   DPI=PDC_GetDeviceCaps(hPrDC,LOGPIXELSX);

   //Get our margins - stored as thousandths of an inch.since used PD_INTHOUSANDTHSOFINCHES
   // Convert margins to printer units (DPI) and subract physical offsets
   int leftmargin,topmargin;
   leftmargin=(pdlg.rcMargin.left*DPI)/1000 - PDC_GetDeviceCaps(hPrDC,PHYSICALOFFSETX);
   topmargin=(pdlg.rcMargin.top*DPI)/1000 - PDC_GetDeviceCaps(hPrDC,PHYSICALOFFSETY);

   //Lets get started printing
   DOCINFO di;
   PDC_StartDoc(hPrDC,&di);
   PDC_StartPage(hPrDC);

   //Print our text using default font
   LPTSTR lpStr;
   lpStr=_T("Hello World");
   PDC_ExtTextOut(hPrDC,leftmargin, topmargin, 0, NULL, lpStr, _tcslen(lpStr), NULL);

   //We're done... lets finish up
   PDC_EndPage(hPrDC);
   PDC_EndDoc(hPrDC);
   PDC_UnInit();
}