I want to use the bookmarks in ArcMap 10.2.2 and 10.3 MXDs to loop through the bookmarks, zoom to the extent of said bookmark and then export a PDF by renaming the PDF with the name of the bookmark. It seems like a simple task especially when Esri offers a greate example for this (from http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000060000000)
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Users\Kim\Documents\Work_related\NursingSchool\P20_OnlineWellStudy\PBH_interpolationSurfaces.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Dataframe")[0]
for bkmk in arcpy.mapping.ListBookmarks(mxd, data_frame=df):
print bkmk
df.extent = bkmk.extent
outFile = r"C:\Users\Kim\Documents\Work_related\NursingSchool\P20_OnlineWellStudy\PBH_interpolationSurfaces\\" + bkmk.name + ".pdf"
arcpy.mapping.ExportToPDF(mxd, outFile, df)
del mxd
BUT, I've run this code and variances of it, with the same error:
Runtime error
Traceback (most recent call last):
File "<string>", line 8, in <module>
File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\utils.py", line 181, in fn_
return fn(*args, **kw)
File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\mapping.py", line 1139, in ExportToPDF
layout.exportToPDF(*args)
AttributeError: Invalid destination path
What does this error mean? I don't know what I need to change in the parsing error for the ExportToJPEC. I've changed this to ExportToPDF and get the same error. I thought it might be triggered from the bookmark "printBookmark" being inaccessible, but I can access that by simple using a print statement:
Bookmark(name=u'printBookmark', extent=<Extent object at 0x23227670[0x22c36ad0]>).
Is this related to the difference between ArcGIS versions (10.1. vs. 10.2.2?)
Invalid destination path
-- check your script with a single PDF (e.g.outFile = r"C:\temp\out.pdf"
), does that work? If so, you'll need to adjust how you create that variable.