Symbian3/PDK/Source/GUID-A1F0D18B-5A89-58FC-9361-7B0A9786C826.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Tue, 30 Mar 2010 11:56:28 +0100
changeset 5 f345bda72bc4
parent 3 46218c8b8afa
child 9 59758314f811
permissions -rw-r--r--
Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-A1F0D18B-5A89-58FC-9361-7B0A9786C826" xml:lang="en"><title>pdrstore:
Creating a Printer Driver using pdr files</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<section><title> Description</title> <p>This example demonstrates how to load
printer driver information files and create a printer driver. The purpose
of the PdrStore API is to: </p> <ul>
<li id="GUID-4320D425-C6D3-5119-A7DF-9C75BA4FA66A"><p>Provide access to the
printer driver information contained in <filepath>.pdr</filepath> files for
applications to build a printer driver list </p> </li>
<li id="GUID-7F7C199C-EC78-565B-8CF2-3ED6212035A5"><p>Load and create an appropriate
printer driver for a given printer. </p> </li>
</ul> <p>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. </p> </section>
<section id="GUID-F2FBFB59-3029-50FD-8854-E734D3ACF5C0"><title>Download</title> <p>Click
on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-b4699e53-658f-4006-a903-12af723cc33f.zip" scope="external"> PDRStore.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-b4699e53-658f-4006-a903-12af723cc33f.html" scope="peer">browse</xref> to view the example code. </p> </section>
<section><title> Create a printer driver</title> <codeblock id="GUID-0ED8C6D9-81DF-52A6-8F7F-70D21449C1A1" xml:space="preserve">void CPdrExample::CreatePrinterDriver()</codeblock> <p>This function provides the following funtionality: </p> <ul>
<li id="GUID-DA7ECFC7-7728-5A57-82B7-E0330ACBE71A"><p>Opens a printer driver
information (<filepath>.pdr</filepath>) file using <xref href="GUID-812DCC89-1897-30FE-AD96-2A35DAF437D8.dita#GUID-812DCC89-1897-30FE-AD96-2A35DAF437D8/GUID-617D27C1-AB5F-3B58-A4F3-9EB53FE70B63"><apiname>CPrinterDriver::OpenPdrL()</apiname></xref>  </p> </li>
<li id="GUID-CF237DFC-249B-5B44-8F5F-3011A75422E3"><p>Gets the total number
of driver models available using <xref href="GUID-812DCC89-1897-30FE-AD96-2A35DAF437D8.dita#GUID-812DCC89-1897-30FE-AD96-2A35DAF437D8/GUID-EC44033C-1209-389B-9230-827BBB49F72C"><apiname>CPrinterDriver::NumModels()</apiname></xref>  </p> </li>
<li id="GUID-8363CBE3-D404-5805-A6FF-F14B5E65D0ED"><p>Creates a printer device
using <xref href="GUID-812DCC89-1897-30FE-AD96-2A35DAF437D8.dita#GUID-812DCC89-1897-30FE-AD96-2A35DAF437D8/GUID-03171887-4F70-36F9-BF02-F664717E5E2D"><apiname>CPrinterDriver::CreatePrinterDeviceL()</apiname></xref>. </p> </li>
</ul> </section>
<section><title>Display the supported typefaces</title> <codeblock id="GUID-95133682-4612-50F6-94F3-7FA6F5EFA54C" xml:space="preserve">void CPdrExample::DisplayTypefaces()</codeblock> <p>Gets the list of supported typefaces using <xref href="GUID-02E9DA67-8CC0-3785-B917-A14C8AA7E714.dita#GUID-02E9DA67-8CC0-3785-B917-A14C8AA7E714/GUID-52F99F83-3BFE-3703-B30F-36453BAC4FD5"><apiname>CPrinterDevice::TypefaceSupport()</apiname></xref> and
displays them. </p> </section>
<section><title>Create a printer control</title> <codeblock id="GUID-FF996CFF-8CA3-581F-824C-B76EF8EA5006" xml:space="preserve">void CPdrExample::CreatePrinterControl()</codeblock> <p>Creates a printer control using <xref href="GUID-02E9DA67-8CC0-3785-B917-A14C8AA7E714.dita#GUID-02E9DA67-8CC0-3785-B917-A14C8AA7E714/GUID-CEB04B4E-78C8-33C1-B894-1C89C65BF8C4"><apiname>CPrinterDevice::CreateControlL()</apiname></xref>. </p> </section>
<section><title>Preparing for printing</title> <codeblock id="GUID-2BE7956F-C976-583B-8E9A-01990D7B44E1" xml:space="preserve">void CPdrExample::PrintPages()</codeblock> <p>This function prepares the printer driver for printing the pages. It
involves the following: </p> <ul>
<li id="GUID-73362C6E-DEC0-5842-A76E-99247F34E567"><p>Gets the number of bands
per page using <xref href="GUID-2E0F522C-2A42-3E2E-ADE8-43398BB86906.dita#GUID-2E0F522C-2A42-3E2E-ADE8-43398BB86906/GUID-6DD8081E-C801-3B80-83FB-E613A527A274"><apiname>CPrinterControl::BandsPerPage()</apiname></xref>  </p> </li>
<li id="GUID-5B0F8F3C-FE43-5B97-AE37-97454C71D7BF"><p>Gets each band to be
printed using <xref href="GUID-02E9DA67-8CC0-3785-B917-A14C8AA7E714.dita#GUID-02E9DA67-8CC0-3785-B917-A14C8AA7E714/GUID-3B4B041B-0840-3FBA-8C6B-8A28342D57DC"><apiname>CPrinterDevice::QueueGetBand()</apiname></xref>  </p> </li>
<li id="GUID-EF600D86-1EB8-52EE-B3D4-5A15BBDAEB79"><p>Creates a graphic context
using <xref href="GUID-02E9DA67-8CC0-3785-B917-A14C8AA7E714.dita#GUID-02E9DA67-8CC0-3785-B917-A14C8AA7E714/GUID-5A8B4073-BA25-34FC-8186-88D6B000028A"><apiname>CPrinterDevice::CreateContextL()</apiname></xref> to draw </p> </li>
<li id="GUID-D0E0ECC7-BB6F-5EF6-80BE-EFAEA4216B8D"><p>Terminates the print
process using <xref href="GUID-2E0F522C-2A42-3E2E-ADE8-43398BB86906.dita#GUID-2E0F522C-2A42-3E2E-ADE8-43398BB86906/GUID-AE7026BB-9E8C-3367-B9BD-AB3594DDD1A0"><apiname>CPrinterControl::QueueEndPrint()</apiname></xref> when no
more bands are available. </p> </li>
</ul> </section>
<section><title>Class Summary</title><p><xref href="GUID-02E9DA67-8CC0-3785-B917-A14C8AA7E714.dita"><apiname>CPrinterDevice</apiname></xref></p><p><xref href="GUID-2E0F522C-2A42-3E2E-ADE8-43398BB86906.dita"><apiname>CPrinterControl</apiname></xref></p><p><xref href="GUID-812DCC89-1897-30FE-AD96-2A35DAF437D8.dita"><apiname>CPrinterDriver</apiname></xref></p><p><xref href="GUID-DAD09DCF-3123-38B4-99E9-91FB24B92138.dita"><apiname>CGraphicsContext</apiname></xref></p></section>
<section><title>Usage</title> <p>This is a console application, so does not
have a GUI. It builds an executable called <filepath>pdrstoreexample.exe</filepath> in
the standard location (<filepath>\epoc32\release\winscw\</filepath> <i>&lt;build_variant&gt;</i> for
CodeWarrior). The <xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">Symbian
platform build process</xref> 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. </p> </section>
</conbody></concept>