PrintBase CATPrinterManager

Usage: you must use this class as is. You should never derive it.


public class CATPrinterManager

Class to manage system printers.

Role: A printer manager can retrieve the list of available printers and their attributes, it can retrieve the system default printer or can send data to a specific printer.
It's a pure static and OS-specific class.
Calling at the beginning of the application is not compulsory. Therefore, should be called at the end in order to release memory and save default print parameters.


Constructor and Destructor Index


o CATPrinterManager()
Constructor/Destructor of CATPrinterManager.
o ~CATPrinterManager()

Method Index


o Begin(char*)
Initializes and builts printer list.
o End(void)
Terminates the using of printer management.
o GetDefaultParameters(void)
Returns the default parameters.
o GetDefaultPrinter(void)
Returns the default printer.
o GetDefaultPrinterIndex(void)
Returns the default printer index.
o GetDefaultUnit(void)
Returns the default unit.
o GetDriverCfgPath(CATUnicodeString&)
Retrieves the driver configuration path
o GetInstance()
Returns the instance of CATPrinterManager.
o GetPrinterCount(void)
Returns the number of available printers.
o GetPrinterFromIndex(int)
Returns a printer from its index.
o GetPrinterGroupCount(void)
Retrieves the number of groups
o GetPrinterGroupListFromIndex(int,CATListOfInt&)
Retrieves the index of the printers included in the indexed group
o GetPrinterGroupNameFromIndex(int,CATUnicodeString&)
Retrieves the group name according to his index
o GetPrinterGroups(CATLISTV(CATUnicodeString)&,CATLISTV(CATUnicodeString)&)
Retrieves the printers names and the printers groups names
o GetPrinterList(void)
Returns the list of available printers.
o GetTempDirectory(void)
Returns the temporary directory.
o ReadPrinterProperties(CATPrinter*,CATBaseUnknown*)
Reads printer properties.
o SaveDefaultParameters()
Saves the parameters on disk
o SetDefaultParameters(CATPrintParameters&)
Sets the default parameters.
o SetDefaultPrinterIndex(int)
Sets the default printer index.
o SetDefaultUnit(CATPrintUnit)
Sets the default unit.
o SetPrinterGroups(CATLISTV(CATUnicodeString)&,CATLISTV(CATUnicodeString)&)
Sets the printers names and the printers groups names
o Write(CATPrinter&,CATPrintStream&,int)
Sends data to a printer.
o WritePrinterProperties(CATPrinter*,CATBaseUnknown*)
Writes printer properties.
o exportPrinter(unsigned int,CATUnicodeString&)
Export a printer in an XML file (old format)
o importPrinter(CATUnicodeString&)
Import a printer from an XML file (old format)

Constructor and Destructor


o CATPrinterManager
public CATPrinterManager()
Constructor/Destructor of CATPrinterManager.
o ~CATPrinterManager
public virtual ~CATPrinterManager()

Methods


o Begin
public static Begin( const iDirectory=NULL)
Initializes and builts printer list.
Parameters:
iDirectory
The printers directory.
Legal values: The default is $CATUserSettingPath/Printers.
o End
public static End( )
Terminates the using of printer management.
o GetDefaultParameters
public static GetDefaultParameters( )
Returns the default parameters.
Returns:
The default parameters.
o GetDefaultPrinter
public static GetDefaultPrinter( )
Returns the default printer.
Returns:
The default printer.
o GetDefaultPrinterIndex
public static GetDefaultPrinterIndex( )
Returns the default printer index.
Returns:
The the default printer index.
o GetDefaultUnit
public static GetDefaultUnit( )
Returns the default unit.
Returns:
The default unit.
o GetDriverCfgPath
public static GetDriverCfgPath( oDriverCfgPath)
Retrieves the driver configuration path
Parameters:
oDriverCfgPath
The path to retrieve
o GetInstance
public static GetInstance()
Returns the instance of CATPrinterManager.
Only one CATPrinterManager can be instancied.
Returns:
The CATPrinterManager instance.
o GetPrinterCount
public static GetPrinterCount( )
Returns the number of available printers.
Returns:
The number of available printers.
o GetPrinterFromIndex
public static GetPrinterFromIndex( iIndex)
Returns a printer from its index.
Parameters:
iIndex
The index of the printer.
Returns:
The printer which index is iIndex.
o GetPrinterGroupCount
public static GetPrinterGroupCount( )
Retrieves the number of groups
Returns:
The number of groups
o GetPrinterGroupListFromIndex
public static GetPrinterGroupListFromIndex( iIndex,
oPrinterIndexList)
Retrieves the index of the printers included in the indexed group
Parameters:
iIndex
The group index number
oPrinterIndexList
The printers index list
o GetPrinterGroupNameFromIndex
public static GetPrinterGroupNameFromIndex( iIndex,
oGroupName)
Retrieves the group name according to his index
Parameters:
iIndex
The group index number
oGroupName
The retrieved group name
o GetPrinterGroups
public static GetPrinterGroups( oPrinterGroupNames,
oPrinterNamesByGroup)
Retrieves the printers names and the printers groups names
Parameters:
oPrinterGroupNames
The printers group names
oPrinterNamesByGroup
The printers names for every group
o GetPrinterList
public static GetPrinterList( )
Returns the list of available printers.
Returns:
The list of available printers.
o GetTempDirectory
public static GetTempDirectory( )
Returns the temporary directory.
Returns:
The temporary directory.
o ReadPrinterProperties
public static ReadPrinterProperties( const iPrinter,
ioProperties)
Reads printer properties.
Parameters:
iPrinter
The printer to scan.
ioProperties
The properties of the printer.
o SaveDefaultParameters
public static SaveDefaultParameters()
Saves the parameters on disk
o SetDefaultParameters
public static SetDefaultParameters( const iParameters)
Sets the default parameters.
Parameters:
iParameters
The default parameters.
o SetDefaultPrinterIndex
public static SetDefaultPrinterIndex( iIndex)
Sets the default printer index.
Parameters:
iIndex
The index of the default printer.
o SetDefaultUnit
public static SetDefaultUnit( iUnit)
Sets the default unit.
Parameters:
iUnit
The default unit.
o SetPrinterGroups
public static SetPrinterGroups( const iPrinterGroupNames,
iPrinterNamesByGroup)
Sets the printers names and the printers groups names
Parameters:
iPrinterGroupNames
The printers group names to set
iPrinterNamesByGroup
The printers names for every group to set
o Write
public static Write( const iPrinter,
const iStream,
iNbcopies=1)
Sends data to a printer.
Parameters:
iPrinter
The printer where the data are sent.
iStream
The data to send.
iNbcopies
The number of copies.
Legal values: The defaut is 1.
o WritePrinterProperties
public static WritePrinterProperties( const iPrinter,
iProperties)
Writes printer properties.
Parameters:
iPrinter
The printer to update.
iProperties
The properties of the printer.
o exportPrinter
public static exportPrinter( iIndex,
const iExportName)
Export a printer in an XML file (old format)
Parameters:
iIndex
The index of the printer to export in the printers list
IExportName
The path to the XML file
o importPrinter
public static importPrinter( const iImportName)
Import a printer from an XML file (old format)
Parameters:
importName
The path to the XML file

This object is included in the file: CATPrinterManager.h
If needed, your Imakefile.mk should include the module: CATPrintBase

Copyright © 1999-2014, Dassault Systèmes. All rights reserved.