ListPrinterNames (arcpy.mapping)

Récapitulatif

Returns a Python list of available printers on the local computer.

Discussion

ListPrinterNames always returns a list object even if only one printer name is returned. In order to return a single printer, an index value must be used on the list (e.g., printer = arcpy.mapping.ListPrinterNames()[0]). For loops on a list provide an easy mechanism to iterate through each item in the list (e.g., for printer in arcpy.mapping.ListPrinterNames():).

ListPrinterNames is an easy way to identify the names of the printers currently available to the local computer. These string values can then be used as input parameters with the PrintMap() function or the printPages method on the DataDrivenPages object.

RemarqueRemarque :

Driver based printing is not supported on ArcGIS for Server. However, non-driver based printing is supported in web applications. For more information, see Printing in web applications.

Syntaxe

ListPrinterNames ()
Valeur renvoyée
Type de donnéesExplication
String

A Python list of printer names.

Exemple de code

ListPrinterNames example:

This script will print the names of the availble printers.

import arcpy
for printerName in arcpy.mapping.ListPrinterNames():
    print printerName
4/26/2014