码迷,mamicode.com
首页 > 编程语言 > 详细

arcgis python 把多个MXD批量导出一个PDF

时间:2019-08-16 12:02:51      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:input   art   object   tor   coding   rem   list   python   pat   

# -*- coding: cp936 -*-
import arcpy, os, string

#Read input parameters from script tool
mxdList = string.split(arcpy.GetParameterAsText(0), ";")
outPDFpath = arcpy.GetParameterAsText(1)

#Create a new PDF object to store the results
outputPDF = arcpy.mapping.PDFDocumentCreate(outPDFpath)

#Loop through each MXD in the list, export, create a temporary PDF name,
# and append to final, output PDF
for mxdPath in mxdList:
    mxd = arcpy.mapping.MapDocument(mxdPath)
    PDFPath = mxdPath[:-4] + "_gisoracle.pdf"
    arcpy.mapping.ExportToPDF(mxd, PDFPath)
    outputPDF.appendPages(str(PDFPath))
    os.remove(PDFPath)


#Save the changes and open the result automatically
outputPDF.saveAndClose()
os.startfile(outPDFpath)

#Remove variable reference to file
del outputPDF

 

arcgis python 把多个MXD批量导出一个PDF

标签:input   art   object   tor   coding   rem   list   python   pat   

原文地址:https://www.cnblogs.com/gisoracle/p/11362802.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!