We're using RHEL7 and ArcGIS Enterprise 10.9.1
Whenever I invoke the WebMap.print() method, while using a custom print template, the legend is not added to the layout and locked down layers are not rendered on the map. I resorted to editing the arcgis.mapping._types module.
# Here are the edits I made
# Commenting this out because layoutOptions doesn't belong in the map_options dict.
# if layout_options:
# map_options["layoutOptions"] = layout_options
# compose export options
export_options = {"dpi": dpi, "outputSize": output_dimensions}
# This allows for printing locked down layers
for layer in self._webmapdict["operationalLayers"]:
layer["token"] = self._con.token
print_options = {
"mapOptions": map_options,
"operationalLayers": self._webmapdict["operationalLayers"],
"baseMap": self._basemap,
"exportOptions": export_options,
}
# layout_options belongs in the print_options dict.
if layout_options:
print_options["layoutOptions"] = layout_options
Figure I should bring this to the community's attention.