AnsweredAssumed Answered

Help - Exporting Multiple Map Documents to PDF using Python

Question asked by riant1 on Aug 6, 2015
Latest reply on Aug 6, 2015 by riant1

Hello,

 

I am new to coding. I am trying to write a script that will allow me to export multiple map documents to PDF using Python. I found some code to do just that at the following ESRI help link 44242 - Export map documents to PDF using Python . However when I try to run it I get the below Runtime Error message. The only thing I changed from the original code was the workspace pathway. Thank you very much, Ana

 

>>> import arcpy, os

...

... arcpy.env.workspace = ws = "C:\Users\00177153\Desktop\ArcPy"

...

... mxd_list = arcpy.ListFiles("*.mxd")

...

... for mxd in mxd_files:

...    

...     current_mxd = arcpy.mapping.MapDocument(os.path.join(ws, mxd))

...     pdf_name = mxd[:-4] + ".pdf"

...     arcpy.mapping.ExportToPDF(current_mxd, pdf_name)

... 

... del mxd_files

...

 

 

Runtime Error

Traceback (most recent call last):

     File "<string>", line 7, in <module>

NameError: name 'mxd_files' is not defined

Outcomes