I have this long-running, works like clockwork py script, which I decided to snip a few lines from to do one-off map exports to PDF:for pgNumLeft in range(1, tempDDPLeft.pageCount + 1, 2):
temp_filename = r"X:\GIS_Projects\1205_Map_Book\MB_" + \
str(pgNumLeft) + ".pdf"
if os.path.exists(temp_filename):
os.remove(temp_filename)
tempDDPLeft.exportToPDF(temp_filename, "RANGE", pgNumLeft, "PDF_SINGLE_FILE", "720","BEST","CMYK","NONE","NONE","VECTORIZE_BITMAP", "FALSE","TRUE", "LAYERS_ONLY", "FALSE")
So I try, as per the example at http://resources.arcgis.com/en/help/main/10.1/index.html#/ExportToPDF/00s300000027000000/: import arcpy, os
mxd = arcpy.mapping.MapDocument(r"X:\GIS_Final\data\basedata\basemap\Maps\ArcGIS\Blockhouse\Blockhouse.mxd")
arcpy.mapping.ExportToPDF(mxd, r"X:\GIS_Final\data\basedata\basemap\Maps\ArcGIS\Blockhouse\Blockhouse.pdf")
del mxd
which returns:Traceback (most recent call last):
File "C:/Temp/TopoMaps.py", line 3, in <module>
arcpy.mapping.ExportToPDF(mxd, r"X:\GIS_Final\data\basedata\basemap\Maps\ArcGIS\Blockhouse\Blockhouse.pdf")
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\utils.py", line 181, in fn_
return fn(*args, **kw)
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\mapping.py", line 1139, in ExportToPDF
layout.exportToPDF(*args)
AttributeError: 'NoneType' object has no attribute 'exportToPDF'
Adding: arcpy.mapping.ExportToPDF(mxd, r"X:\GIS_Final\data\basedata\basemap\Maps\ArcGIS\Blockhouse\Blockhouse.pdf", "PAGE_LAYOUT")
...same error. However, the same line interestingly works in the ArcMap Python Window (I'm trying this in the Python GUI).So I try
arcpy.mapping.ExportToPDF(mxd, r"X:\GIS_Final\data\basedata\basemap\Maps\ArcGIS\Blockhouse\Blockhouse.pdf", "PAGE_LAYOUT", 720, "BEST", "CMYK", "FALSE", "NONE", "VECTORIZE_BITMAP", "FALSE" , "TRUE", "NONE", "FALSE")
Which returns Traceback (most recent call last):
File "C:/Temp/TopoMaps.py", line 3, in <module>
arcpy.mapping.ExportToPDF(mxd, r"X:\GIS_Final\data\basedata\basemap\Maps\ArcGIS\Blockhouse\Blockhouse.pdf", "PAGE_LAYOUT", 720, "BEST", "CMYK", "FALSE", "NONE", "VECTORIZE_BITMAP", "FALSE" , "TRUE", "NONE", "FALSE")
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\utils.py", line 153, in fn_
arg_name].keys())))
ValueError: Invalid value for image_quality: 'FALSE' (choices are: ['BETTER', 'FASTEST', 'FASTER', 'BEST', 'NORMAL'])
>>>
...and many, many, many permutations of variables in many, many, many permutations of where they should go, all with a varation of Invalid value for ...
.What is frustrating is that I followed the ESRI example for data-driven page export to PDF, and the syntax in the online-documentation worked, however, the example for exporttopdf is misleading.map has 2 DF's, 10.1 SP1