ref: Camera - ArcGIS Pro
# Set the path to your project file (.aprx)
project_file = r"Map 1.3 Heritage.aprx"
# Reference the project
aprx = arcpy.mp.ArcGISProject(project_file)
# get the sitebuffer layer
m = aprx.listMaps()[0]
lyr = m.listLayers()[3]
# get the Map element of the layout
lyt = aprx.listLayouts()[0]
mf = lyt.listElements()[-1]
# set the extent to the sitebuffer layer's extent
mf.camera.setExtent(mf.getLayerExtent(lyr, False, True))
# export to PDF
lyt.exportToPDF(lyt.name)
del aprx
标签:lyt,layer,Implementation,project,zooming,file,arcpy,aprx From: https://www.cnblogs.com/alex-bn-lee/p/17776353.html