Microsoft Windows CE 3.0  

Printing

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Windows CE does not send printing commands directly to output devices. Rather, 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 hard-coded routines for interfacing with multiple output devices.

On Windows CE, all device-side rendering is done by the display driver, with the rasterized bands handed to the printer driver for output to the printer device. In effect, GDI stores up all the GDI commands issued after a StartPagecall. When the application calls EndPage, GDI works with the display driver to render the commands. To minimize memory usage, application developers should minimize using bitmaps in printed output. When bitmaps are necessary, applications should use StretchBltto defer bitmap rendering until GDI is rendering the printer band.

Most applications strive for "what you see is what you get" (WYSIWYG) output. Ideally, WYSIWYG means that text drawn with a specified font and size on the screen has a similar appearance when 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 CreateFontIndirectfunction and specify the typeface name and logical size of the font you would like to draw with, and then call the SelectObjectfunction 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.

To obtain a printer device context

  1. Call the PageSetupDlgto enable the user to select a printer, the output destination, and to specify the characteristics of the print job.
  2. Call CreateDC, passing in the name of the printer driver .dll file, the output destination, and a DEVMODE containing the device-specific initialization data. DEVMODE is returned by PageSetupDlg.

    To start a print job

    1. Call the SetAbortProcfunction to establish an abort procedure.

      The abort procedure should include a modeless dialog box that enables a user to cancel a print job.

    2. Initialize the necessary variables registered in your AbortProcfunction.
    3. Display a modeless Canceldialog box.
    4. Call the StartDocfunction to start the print job.

      Once you start the print job, you can define individual pages in the document by calling the StartPageand EndPagefunctions and embedding the appropriate calls to GDI drawing functions within this bracket. After you define the last page, you can close the document and end the print job with the EndDocfunction.

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

      Note   Printing is supported on devices that support TrueType fonts. Printing is not supported on devices using raster fonts.


       Last updated on Tuesday, May 18, 2004

      © 2004 Microsoft Corporation. All rights reserved.