<?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 Set output extent in multiple MXD exporter script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/set-output-extent-in-multiple-mxd-exporter-script/m-p/679087#M52628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello GeoNet! Lately I started using the very useful&amp;nbsp;&lt;A href="https://www.arcgis.com/home/item.html?id=bf797eadca474f0ca76e61d2fd55d0a8"&gt;Multiple MXD exporter tool&lt;/A&gt;, a community tool based on a python script. I wonder, is it possible to add to&amp;nbsp;the code to make it alter the different extents of all the MXDs to a single fixed one in my output maps, to a&amp;nbsp;custom one of my choice? I tried playing with the loop in the code adding to it some ideas I found on the internet, based on arcpy. I had no success so far.&lt;/P&gt;&lt;P&gt;I&amp;nbsp;will be very grateful for any help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the Python script of the tool, written by&amp;nbsp;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;Vijay Paul. I removed some parts that are irrelevant. Full code available in the link above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy, os, string&lt;BR /&gt;from arcpy import env&lt;BR /&gt;overwriteOutput = True&lt;BR /&gt;mxdList = string.split(arcpy.GetParameterAsText(0), ";")&lt;BR /&gt;dest = arcpy.GetParameterAsText(1)&lt;BR /&gt;DPI = arcpy.GetParameterAsText(2)&lt;BR /&gt;ext = arcpy.GetParameterAsText(3)&lt;BR /&gt;appendPDF = arcpy.GetParameterAsText(4)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#PNG&lt;BR /&gt;if (ext == "PNG"):&lt;BR /&gt; ext = ".png"&lt;BR /&gt; for mxdType in mxdList:&lt;BR /&gt; (workspace, filename) = os.path.split(mxdType)&lt;BR /&gt; fullpath = os.path.join(workspace, filename)&lt;BR /&gt; #need to remove single quoatation&lt;BR /&gt; fullstring = fullpath.replace("'","")&lt;BR /&gt; if os.path.isfile(fullstring):&lt;BR /&gt; basename, extension = os.path.splitext(fullstring)&lt;BR /&gt; if extension.lower() == ".mxd":&lt;BR /&gt; mxd = arcpy.mapping.MapDocument(fullstring)&lt;BR /&gt; pngnum = os.path.basename(fullstring)&lt;BR /&gt; arcpy.AddMessage("Exporting Map Document:" + pngnum)&lt;BR /&gt; PNG = dest + "\\" + pngnum.replace(".mxd", ext) &lt;BR /&gt; arcpy.mapping.ExportToPNG(mxd,PNG,resolution=DPI)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if appendPDF == "true":&lt;BR /&gt; arcpy.AddMessage(appendPDF)&lt;BR /&gt; arcpy.AddMessage("Combining PDF documents")&lt;BR /&gt; arcpy.AddMessage(filenameList)&lt;BR /&gt; appendName = dest + "\\" + "merge.pdf"&lt;BR /&gt; pdfDoc = arcpy.mapping.PDFDocumentCreate(appendName)&lt;BR /&gt; for page in filenameList:&lt;BR /&gt; pagePath = dest + "\\" + page&lt;BR /&gt; pdfDoc.appendPages(pagePath)&lt;BR /&gt; pdfDoc.saveAndClose()&lt;/P&gt;&lt;P&gt;#delete variable references&lt;BR /&gt;del mxd&lt;BR /&gt;del mxdList&lt;BR /&gt;del PNG&lt;BR /&gt;del dest&lt;BR /&gt;del ext&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Sep 2020 16:19:37 GMT</pubDate>
    <dc:creator>DanMichaelan</dc:creator>
    <dc:date>2020-09-23T16:19:37Z</dc:date>
    <item>
      <title>Set output extent in multiple MXD exporter script</title>
      <link>https://community.esri.com/t5/python-questions/set-output-extent-in-multiple-mxd-exporter-script/m-p/679087#M52628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello GeoNet! Lately I started using the very useful&amp;nbsp;&lt;A href="https://www.arcgis.com/home/item.html?id=bf797eadca474f0ca76e61d2fd55d0a8"&gt;Multiple MXD exporter tool&lt;/A&gt;, a community tool based on a python script. I wonder, is it possible to add to&amp;nbsp;the code to make it alter the different extents of all the MXDs to a single fixed one in my output maps, to a&amp;nbsp;custom one of my choice? I tried playing with the loop in the code adding to it some ideas I found on the internet, based on arcpy. I had no success so far.&lt;/P&gt;&lt;P&gt;I&amp;nbsp;will be very grateful for any help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the Python script of the tool, written by&amp;nbsp;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;Vijay Paul. I removed some parts that are irrelevant. Full code available in the link above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy, os, string&lt;BR /&gt;from arcpy import env&lt;BR /&gt;overwriteOutput = True&lt;BR /&gt;mxdList = string.split(arcpy.GetParameterAsText(0), ";")&lt;BR /&gt;dest = arcpy.GetParameterAsText(1)&lt;BR /&gt;DPI = arcpy.GetParameterAsText(2)&lt;BR /&gt;ext = arcpy.GetParameterAsText(3)&lt;BR /&gt;appendPDF = arcpy.GetParameterAsText(4)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#PNG&lt;BR /&gt;if (ext == "PNG"):&lt;BR /&gt; ext = ".png"&lt;BR /&gt; for mxdType in mxdList:&lt;BR /&gt; (workspace, filename) = os.path.split(mxdType)&lt;BR /&gt; fullpath = os.path.join(workspace, filename)&lt;BR /&gt; #need to remove single quoatation&lt;BR /&gt; fullstring = fullpath.replace("'","")&lt;BR /&gt; if os.path.isfile(fullstring):&lt;BR /&gt; basename, extension = os.path.splitext(fullstring)&lt;BR /&gt; if extension.lower() == ".mxd":&lt;BR /&gt; mxd = arcpy.mapping.MapDocument(fullstring)&lt;BR /&gt; pngnum = os.path.basename(fullstring)&lt;BR /&gt; arcpy.AddMessage("Exporting Map Document:" + pngnum)&lt;BR /&gt; PNG = dest + "\\" + pngnum.replace(".mxd", ext) &lt;BR /&gt; arcpy.mapping.ExportToPNG(mxd,PNG,resolution=DPI)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if appendPDF == "true":&lt;BR /&gt; arcpy.AddMessage(appendPDF)&lt;BR /&gt; arcpy.AddMessage("Combining PDF documents")&lt;BR /&gt; arcpy.AddMessage(filenameList)&lt;BR /&gt; appendName = dest + "\\" + "merge.pdf"&lt;BR /&gt; pdfDoc = arcpy.mapping.PDFDocumentCreate(appendName)&lt;BR /&gt; for page in filenameList:&lt;BR /&gt; pagePath = dest + "\\" + page&lt;BR /&gt; pdfDoc.appendPages(pagePath)&lt;BR /&gt; pdfDoc.saveAndClose()&lt;/P&gt;&lt;P&gt;#delete variable references&lt;BR /&gt;del mxd&lt;BR /&gt;del mxdList&lt;BR /&gt;del PNG&lt;BR /&gt;del dest&lt;BR /&gt;del ext&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2020 16:19:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-output-extent-in-multiple-mxd-exporter-script/m-p/679087#M52628</guid>
      <dc:creator>DanMichaelan</dc:creator>
      <dc:date>2020-09-23T16:19:37Z</dc:date>
    </item>
  </channel>
</rss>

