Based on How to export a set of layers into multiple PDF(orAI)files, one layer at a time? I was able to alter and execute code that is trying to export 30+ layers from an MXD I have.
import arcpydef turn_off_layers(mxd, df): for lyr in arcpy.mapping.ListLayers(mxd, "", df): lyr.visible = False mxd.save()def print_layers(mxd,df): for i,lyr in enumerate(arcpy.mapping.ListLayers(mxd, "", df)): lyr.visible = True mxd.save() arcpy.mapping.ExportToPDF(mxd, r"Y:\Desktop\Google Drive\DTI\Figures\%s.pdf" % lyr.name) lyr.visible = False mxd.save()if __name__ == "__main__": mxd = arcpy.mapping.MapDocument(r"Y:\Desktop\Google Drive\DTI\DTI_Onondaga_100915.mxd") df = arcpy.mapping.ListDataFrames(mxd, "")[0] turn_off_layers(mxd, df) print_layers(mxd,df)Unfortunately, the code runs and names the PDFs correctly, but every PDF is blank. Can anyone see where I am going wrong? I am using ArcMap 10.2.2 on a 2011 iMac, running Parallels 9 in Cohesion view.
أكثر...
import arcpydef turn_off_layers(mxd, df): for lyr in arcpy.mapping.ListLayers(mxd, "", df): lyr.visible = False mxd.save()def print_layers(mxd,df): for i,lyr in enumerate(arcpy.mapping.ListLayers(mxd, "", df)): lyr.visible = True mxd.save() arcpy.mapping.ExportToPDF(mxd, r"Y:\Desktop\Google Drive\DTI\Figures\%s.pdf" % lyr.name) lyr.visible = False mxd.save()if __name__ == "__main__": mxd = arcpy.mapping.MapDocument(r"Y:\Desktop\Google Drive\DTI\DTI_Onondaga_100915.mxd") df = arcpy.mapping.ListDataFrames(mxd, "")[0] turn_off_layers(mxd, df) print_layers(mxd,df)Unfortunately, the code runs and names the PDFs correctly, but every PDF is blank. Can anyone see where I am going wrong? I am using ArcMap 10.2.2 on a 2011 iMac, running Parallels 9 in Cohesion view.
أكثر...