Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Why does the Legend vanish when exporting MXD to PDF using ArcPy?

$
0
0

I try to export multi MXD files into pdf. The code run without an errors, but the problem is that the legend vanished from several pdf files:

import arcpy,os
import arcpy.mapping
from arcpy import env

env.workspace = r"D:PROJECTSaradIndustrygis"
counter = 0
startTime = datetime.datetime.now()
for mxd in arcpy.ListFiles("*.mxd"):
    print mxd
    mapdoc = arcpy.mapping.MapDocument(r"D:PROJECTSaradIndustrygis\" + mxd)
    arcpy.mapping.ExportToPDF(mapdoc, r"D:PROJECTSaradIndustrygisout\"+os.path.basename(mapdoc.filePath).replace ('.mxd','') +".pdf")
    print 'ExportToPDF'
    mapdoc.save()
    counter = counter + 1

del mxd
print counter
endTime = datetime.datetime.now()
elapsed = endTime - startTime 
print elapsed

Viewing all articles
Browse latest Browse all 767

Latest Images

Trending Articles



Latest Images