I am trying to find a script that exports my layout in ArcPro to a JPG once a week. Most of what I have found when searching has been for map series. Can anyone assist? Thanks!
Solved! Go to Solution.
Hi Linda
would this works for you?
import arcpy
docPath = r"D:\FOLDER"
docName = r"AGSPRODOC.aprx"
p = arcpy.mp.ArcGISProject(docPath+"\\"+docName)
# ge a list of all layouts in your map dox
lLayout = p.listLayouts()
for l in lLayout:
print(l.name)
#You could add an if statement to print ONLY a specific layout
l.exportToJPEG(docPath+"\\"+l.name+"jpg")
print("Process Completed")
This help page seems to imply you can just export a single layout to just about whatever image format you like. The arcpy.mp module does takes a little getting used to.
Hi Linda
would this works for you?
import arcpy
docPath = r"D:\FOLDER"
docName = r"AGSPRODOC.aprx"
p = arcpy.mp.ArcGISProject(docPath+"\\"+docName)
# ge a list of all layouts in your map dox
lLayout = p.listLayouts()
for l in lLayout:
print(l.name)
#You could add an if statement to print ONLY a specific layout
l.exportToJPEG(docPath+"\\"+l.name+"jpg")
print("Process Completed")
@DominicRoberge2 , this works great! Thank you! However, one thing it is not doing is including my dynamic text that I have in the layout. I have a date/time exported and a record count. Any idea how to get the print command to include those?
hummm I am not sure. it's working for me (see image below). Can you try to add a new dynamic txt for the count just for fun.
Thanks! That worked!!! Much appreciated!