Symbian3/PDK/Source/GUID-A1F0D18B-5A89-58FC-9361-7B0A9786C826.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 16 Jul 2010 17:23:46 +0100
changeset 12 80ef3a206772
parent 9 59758314f811
permissions -rw-r--r--
Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.

<?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 id="GUID-A041DECA-21EB-462E-A503-ED794BEB8CF1"><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 id="GUID-7C100FE7-38EB-4EE0-9D3C-C0D209FE6BAA"><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-89C95254-2667-37CD-A9DC-0DEEC77A9C82"><apiname>CPrinterDriver::OpenPdrL(const TDesC&amp;)</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-99C5E5F5-DF2C-3682-AE88-47E06A0D1AC0"><apiname>CPrinterDriver::NumModels()
const</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-225235E0-2F06-3C7F-BB2E-83A932E410B6"><apiname>CPrinterDriver::CreatePrinterDeviceL(TInt)</apiname></xref>. </p> </li>
</ul> </section>
<section id="GUID-DE05838E-A239-4535-849C-0F4DA4289DB0"><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-CA59407C-8F11-36F0-A31C-7E7F38F1B624"><apiname>CPrinterDevice::TypefaceSupport(TTypefaceSupport
&amp;,TInt) const</apiname></xref> and displays them. </p> </section>
<section id="GUID-4C6EDF7D-49BE-4309-9B83-654F2EA33C08"><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 id="GUID-6165F5D5-FBF6-4910-B241-F9D61A4FB5C3"><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-0CE0ABD3-841A-3121-9EDE-CE031567A195"><apiname>CPrinterDevice::QueueGetBand(TRequestStatus&amp;
aStatus, TBandAttributes&amp; aBand)</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-6714C5BC-8458-339B-8BED-DA7BE95106E7"><apiname>CPrinterControl::QueueEndPrint(TRequestStatus
&amp;)</apiname></xref> when no more bands are available. </p> </li>
</ul> </section>
<section id="GUID-E2DBE267-21AE-4D47-B520-AB78F01C0BC5"><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 id="GUID-F887FECF-4B72-406D-B185-6BDEC8DFE622"><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 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. </p> </section>
</conbody></concept>