Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



How to set the printer model

A printer device must be selected before printing can begin.

  1. You must have added at least one directory to the list of printer driver search paths and a printer model list must have been created before you can select a model. For more information on the search path, see CPrintSetup.

  2. Retrieve the list of all supported printer models using CPrintSetup::ModelNameListL(). A printer model is identified by its UID and also has an associated model name.

  3. Select the target printer device using CPrintSetup::CreatePrinterDeviceL().

  4. The model list is deleted in the destructor for CPrintSetup, but if it is no longer needed, it may be deleted beforehand using FreeModelList().

// Provide search path for printer drivers
_LIT(KSearchPath,"\\resource\\printers\\*");
iPrintSetup->AddPrinterDriverDirL(KSearchPath); 

// Get list of models - causes list to be allocated
CPrinterModelList* modelList = iPrintSetup->ModelNameListL(iFs);

// Create a printer device. Select first in list (random choice)
iPrintSetup->CreatePrinterDeviceL(modelList->NumToUid(0));

// Free models list
iPrintSetup->FreeModelList();


Notes