I used this example to produce printing service. As the result I get map with too many elements in the legend. Is it possible ti show classes that are visible in the current map extent using python script?
There is no need to write any additional ArcPy for this. Simply use dynamic legends (which were added at ArcGIS 10.1) when you are authoring your maps.