My current script is exporting all of my layout windows. Does anyone have an example of how I can export a specific layout window?
import arcpy
docPath = r"*PATH*"
docName = r"Test.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)
print("Process Completed")
Solved! Go to Solution.
Is the script from a previous answer? Unless I'm misinterpreting, you just need the syntax for an if statement?
import arcpy
docPath = r"*PATH*"
docName = r"Test.aprx"
layoutName = 'name of your layout'
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)
#if statement to print ONLY a specific layout
if l.name == layoutName:
l.exportToJPEG(docPath+"\\"+l.name)
print("Process Completed")
Is the script from a previous answer? Unless I'm misinterpreting, you just need the syntax for an if statement?
import arcpy
docPath = r"*PATH*"
docName = r"Test.aprx"
layoutName = 'name of your layout'
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)
#if statement to print ONLY a specific layout
if l.name == layoutName:
l.exportToJPEG(docPath+"\\"+l.name)
print("Process Completed")
I found the example through Google and noticed the if statement comment after I had posted this. Thanks for the quick response.