I have a very strange problem with printing workflow.
The simplified workflow is that I am printing web map with template for legend. With arpcy.mapping.MapDocument.isOverflowing I am checking, if legend overflows, and if it overflows, I am trying to use template with bigger frame for legend.
The problem is that the isOverlowing value doesn’t work correctly when the script is run from geoprocessing service. If I run the script as a geoprocessing service, I can see in the resulting messages and server log, that the isOverlowing property was equal to false. However if I save the map document I can see the three red dots indicating that legend is overflowing and legend is indeed overflowing. Strangely enough, if I run the same script as a script within IDLE, with the same parameters, same version on python, on the very same server the geoprocessing services was run, I can see in the messages that the isOverflowing property was correctly equal to true.
Simplified script and sample mxd are enclosed. All you need is to set mxdPath on 3th line to path for enclosed mxd document and give it a try. The isOverflowing property value is indicated in messages.
Running with ArcGIS for Server 10.6.1.
Any idea, why it is different with geoprocessing service, or any suggestion how to fix it would be much appreciated.