This example demonstrates how to load printer driver information files and create a printer driver. The purpose of the PdrStore API is to:
Provide access to the printer driver information contained in .pdr files for applications to build a printer driver list
Load and create an appropriate printer driver for a given printer.
During initialisation, the example first loads the printer driver, then creates a session with the font and bitmap server. This is detailed in the following sections.
Click on the following link to download the example: PDRStore.zip
Click: browse to view the example code.
void CPdrExample::CreatePrinterDriver()
This function provides the following funtionality:
Opens a printer driver information (.pdr) file using CPrinterDriver::OpenPdrL(const TDesC&)
Gets the total number of driver models available using CPrinterDriver::NumModels() const
Creates a printer device using CPrinterDriver::CreatePrinterDeviceL(TInt).
void CPdrExample::DisplayTypefaces()
Gets the list of supported typefaces using CPrinterDevice::TypefaceSupport(TTypefaceSupport &,TInt) const and displays them.
void CPdrExample::CreatePrinterControl()
Creates a printer control using CPrinterDevice::CreateControlL().
void CPdrExample::PrintPages()
This function prepares the printer driver for printing the pages. It involves the following:
Gets the number of bands per page using CPrinterControl::BandsPerPage()
Gets each band to be printed using CPrinterDevice::QueueGetBand(TRequestStatus& aStatus, TBandAttributes& aBand)
Creates a graphic context using CPrinterDevice::CreateContextL() to draw
Terminates the print process using CPrinterControl::QueueEndPrint(TRequestStatus &) when no more bands are available.
This is a console application, so does not have a GUI. It builds an executable called pdrstoreexample.exe in the standard location (\epoc32\release\winscw\ <build_variant> for CodeWarrior). The Symbian platform build process describes how to build this application. After launching the executable, depending on the emulator you are using, you may need to task away from the app launcher/shell screen to view the console.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.