#Definitivo import arcpy # set arguments input_mxd = r"P:\Trabajos\Guis_Urbana\Proyectos\mxd\DDP_Settlements02_Python.mxd" output_folder = r"K:\Apb\Cuadricula_DIS\Formato_png\ideS_Guia_Urb_" dfColorName = "Color" dfBlancoName = "Gris" #df.name.lower prjScale = 2500 #idf_export_width = 11222 #idf_export_height = 25394 #iresolution = 300 idf_export_width = 3591 idf_export_height = 8126 iresolution = 96 mxd = arcpy.mapping.MapDocument("CURRENT") dfColor = arcpy.mapping.ListDataFrames(mxd, dfColorName)[0] dfBlanco = arcpy.mapping.ListDataFrames(mxd, dfBlancoName)[0] for pageNumber in range(1, mxd.dataDrivenPages.pageCount + 1): mxd.dataDrivenPages.currentPageID = pageNumber PageName = mxd.dataDrivenPages.pageRow.PageName dfColor.scale = prjScale dfBlanco.extent = dfColor.extent dfBlanco.scale = prjScale arcpy.RefreshActiveView() arcpy.mapping.ExportToPNG(mxd, output_folder + str(PageName) + ".png", data_frame = "PAGE_LAYOUT", df_export_width = idf_export_width, df_export_height = idf_export_height, resolution = iresolution, world_file = False, color_mode = "24-BIT_TRUE_COLOR", background_color = "255, 255, 255", interlaced = False) arcpy.mapping.ExportToPNG(mxd, output_folder + str(PageName) + ".png", data_frame = "PAGE_LAYOUT", df_export_width = idf_export_width, df_export_height = idf_export_height, resolution = iresolution, world_file = False, color_mode = "24-BIT_TRUE_COLOR", background_color = "255, 255, 255", interlaced = False) #mxd.saveACopy(input_mxd) #del mxd