PrintMap (arcpy.mapping)

摘要

将特定数据框或地图文档 (.mxd) 布局输出到打印机或文件。

讨论

PrintMap 用于将特定数据框或地图文档布局输出到系统打印机或打印文件。如果不提供打印机名称,PrintMap 将使用随地图文档保存的打印机或在地图文档未保存打印机的情况下使用默认系统打印机。

确定本地计算机中可用的打印机的简单方法是使用 ListPrinterNames 函数。

如果使用 ArcPress 进行打印,必须设置打印机属性并将打印机保存至地图文档。

注注:

ArcGIS for Server 不支持基于驱动程序的打印。不过,web 应用程序支持基于非驱动程序的打印。有关详细信息,请参阅在 Web 应用程序中打印

语法

PrintMap (map_document, {printer_name}, {data_frame}, {out_print_file}, {image_quality})
参数说明数据类型
map_document

A variable that references a MapDocument object.

MapDocument
printer_name

A string that represents the name of a printer on the local computer.

(默认值为 None)

String
data_frame

A variable that references a DataFrame object.

(默认值为 PAGE_LAYOUT)

DataFrame
out_print_file

A path that includes the name of an output print file. The format created is dependent on the printer. If you are using a postscript printer, the format will be postscript, and it is recommended that a .ps extension be provided; if you are using a Windows printer, use a .prn extension.

(默认值为 None)

String
image_quality

A string that defines output image quality, the draw resolution of map layers that draw as rasters. Using the default value of "None" will cause the function to use the image quality saved in the map document.

  • BESTAn output image quality resample ratio of 1.
  • BETTERAn output image quality resample ratio of 2.
  • NORMALAn output image quality resample ratio of 3.
  • FASTERAn output image quality resample ratio of 4.
  • FASTESTAn output image quality resample ratio of 5.

(默认值为 None)

String

代码实例

PrintMap 示例 1

以下脚本使用默认打印机选项打印地图。

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
arcpy.mapping.PrintMap(mxd)
PrintMap 示例 2

以下脚本使用特定的打印机名称打印地图文档中的第一个数据框。

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd)[0]
arcpy.mapping.PrintMap(mxd, r"\\olyfile\OLYCanon", df)
9/15/2013