Printing

Windows CE does not send printing commands directly to output devices. Instead, it passes all output information to device drivers, which, in turn, send the information to display devices and printers. Windows CE has a small footprint in part because it does not need to maintain hardcoded routines for interfacing with multiple output devices.

Most applications strive for what you see is what you get (WYSIWYG) output. Ideally WYSIWYG would mean that text drawn with a specified font and size on the screen would have a similar appearance when it is printed. However, it is almost impossible to obtain true WYSIWYG output, partly because of differences between video and printer technologies.

To obtain a WYSIWYG effect when drawing text, call the CreateFont function and specify the typeface name and logical size of the font you would like to draw with, and then call the SelectObject function to select the font into a printer device context. Windows CE will select a physical font that is the closest possible match to the specified logical font.

Before you start a print job, you should use the SetAbortProc to establish an abort procedure. Your abort procedure should include a modeless dialog box that allows a user to cancel a print job. Once you have initialized the necessary variables, registered your AbortProc function, and displayed your modeless Cancel dialog box, you can start the print job by calling the StartDoc function.

Once you have started the print job, you can define individual pages in the document by calling the StartPage and EndPage functions and embedding the appropriate calls to GDI drawing functions within this bracket. After you have defined the last page, you can close the document and end the print job with the EndDoc function.

Windows CE does not have a print manager. It will not spool or print more than a single copy of a document at a time.

Note The display driver does all the rendering in Windows CE, and scales the output to the printer resolution. If you intend to print text, you should use a system with TrueType fonts, because raster fonts cannot be scaled to different printer resolutions without severely compromising the quality of the text.