<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Printing with customizable templates in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/printing-with-customizable-templates/m-p/554968#M15027</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've tried everything I could think of with this and have gotten very close to getting what I want but have run into several different problems. When I've used a different method to get around the problems I've just encountered others and I need a sanity check on my approach to the problem and to see if it's even possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to print maps from my web application built with the ArcGIS Javascript API.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The requirements are:&lt;/P&gt;&lt;P&gt;1. need to show only legend elements that are within the visible extent of the printed map. For instance, if I have a feature layer that uses a unique value renderer I only want to show the legend items for the values present on the map.&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="85947" alt="Screenshot_041615_124635_PM.jpg" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/85947_Screenshot_041615_124635_PM.jpg" style="width: 620px; height: 487px;" /&gt;&lt;/P&gt;&lt;P&gt;2. I want to be able to customize picture elements in the print template - to replace a logo for instance.&lt;/P&gt;&lt;P&gt;3. It would be nice if it was relatively fast or at least about as fast as the out of the box printing services. In my experience, this is about 3-6 seconds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried writing a simple python script to replace picture elements.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;LogoName = arcpy.GetParameterAsText(3)
if LogoName == '#' or not LogoName:
&amp;nbsp;&amp;nbsp;&amp;nbsp; LogoName = 'default-logo.png'
Logo = r'c:\GIS_Data\Logos\{}'.format(LogoName)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that works fine and along with arcpy.mapping.ExportToPDF or ExportToPNG it lets me convert a webmap to a printable template with custom logos.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This wasn't enough to get the legend behavior I wanted however. If a Marsh/Bog was within the extent of the map (see picture above) then it would show all wetland elements in the legend. I was able to solve this by creating a staged template that includes all the layers in the web map service (as detailed in this tutorial: &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//0057000000mq000000" title="http://resources.arcgis.com/en/help/main/10.2/index.html#//0057000000mq000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#//0057000000mq000000&lt;/A&gt; ). This gives me everything I want but requires that I create a separate staged template for each map service. We have many map services and would need to keep the templates in sync with the web map services. Doing this for a dozen map services is a pain, doing it for hundreds is not feasible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I decided to do this in .NET ArcObjects. I was able to get it working but the Export method from the PrintAndExportClass takes 2 minutes to run within an SOE. If I create a console application it only takes a few seconds so I think it might have something to do with running it from within the SOE but I can't figure out what would cause such a slow down. I would prefer if it just broke within the SOE but it still runs - just takes forever.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like a sanity check on the best way to approach this problem. It seems simple enough - replace a picture element, allow a single template to handle many map services, only include legend items actually present within the extent and not take 2 minutes to run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What classes and methods within arcobjects should I be using to run a print service that handles these? Preferably it would run within an SOE but If self-hosting a console application in IIS Is faster or better can do that too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Ryan Muller - fixed an unclear pargraph&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 23:58:46 GMT</pubDate>
    <dc:creator>RyanMuller2</dc:creator>
    <dc:date>2021-12-11T23:58:46Z</dc:date>
    <item>
      <title>Printing with customizable templates</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/printing-with-customizable-templates/m-p/554968#M15027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've tried everything I could think of with this and have gotten very close to getting what I want but have run into several different problems. When I've used a different method to get around the problems I've just encountered others and I need a sanity check on my approach to the problem and to see if it's even possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to print maps from my web application built with the ArcGIS Javascript API.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The requirements are:&lt;/P&gt;&lt;P&gt;1. need to show only legend elements that are within the visible extent of the printed map. For instance, if I have a feature layer that uses a unique value renderer I only want to show the legend items for the values present on the map.&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="85947" alt="Screenshot_041615_124635_PM.jpg" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/85947_Screenshot_041615_124635_PM.jpg" style="width: 620px; height: 487px;" /&gt;&lt;/P&gt;&lt;P&gt;2. I want to be able to customize picture elements in the print template - to replace a logo for instance.&lt;/P&gt;&lt;P&gt;3. It would be nice if it was relatively fast or at least about as fast as the out of the box printing services. In my experience, this is about 3-6 seconds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried writing a simple python script to replace picture elements.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;LogoName = arcpy.GetParameterAsText(3)
if LogoName == '#' or not LogoName:
&amp;nbsp;&amp;nbsp;&amp;nbsp; LogoName = 'default-logo.png'
Logo = r'c:\GIS_Data\Logos\{}'.format(LogoName)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that works fine and along with arcpy.mapping.ExportToPDF or ExportToPNG it lets me convert a webmap to a printable template with custom logos.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This wasn't enough to get the legend behavior I wanted however. If a Marsh/Bog was within the extent of the map (see picture above) then it would show all wetland elements in the legend. I was able to solve this by creating a staged template that includes all the layers in the web map service (as detailed in this tutorial: &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//0057000000mq000000" title="http://resources.arcgis.com/en/help/main/10.2/index.html#//0057000000mq000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#//0057000000mq000000&lt;/A&gt; ). This gives me everything I want but requires that I create a separate staged template for each map service. We have many map services and would need to keep the templates in sync with the web map services. Doing this for a dozen map services is a pain, doing it for hundreds is not feasible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I decided to do this in .NET ArcObjects. I was able to get it working but the Export method from the PrintAndExportClass takes 2 minutes to run within an SOE. If I create a console application it only takes a few seconds so I think it might have something to do with running it from within the SOE but I can't figure out what would cause such a slow down. I would prefer if it just broke within the SOE but it still runs - just takes forever.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like a sanity check on the best way to approach this problem. It seems simple enough - replace a picture element, allow a single template to handle many map services, only include legend items actually present within the extent and not take 2 minutes to run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What classes and methods within arcobjects should I be using to run a print service that handles these? Preferably it would run within an SOE but If self-hosting a console application in IIS Is faster or better can do that too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Ryan Muller - fixed an unclear pargraph&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:58:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/printing-with-customizable-templates/m-p/554968#M15027</guid>
      <dc:creator>RyanMuller2</dc:creator>
      <dc:date>2021-12-11T23:58:46Z</dc:date>
    </item>
  </channel>
</rss>

