<?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 Re: Data driven pages - exporting multiple PNG by page name in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-exporting-multiple-png-by-page/m-p/182961#M1997</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the same problem. I'm new in Python and would like to export one Data driven to Jpeg format with the page name instead of page number for name of the generated file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried the code above, with the change in red:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument("CURRENT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.dataDrivenPages.currentPageID = pageNum&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pageName = mxd.dataDrivenPages.pageRow.N_Parcelle&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.mapping.ExportToJPEG(mxd, r"C:\temp\" + pageName + ".jpeg")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But the problem for me is the line 3:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Parsing error &amp;lt;type 'exceptions.IndentationError'&amp;gt;: expected an indented block (line 3)"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Someone could help me, I'm sure i'm really near&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+++&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Jul 2013 15:27:33 GMT</pubDate>
    <dc:creator>BertrandMARTINEZ</dc:creator>
    <dc:date>2013-07-16T15:27:33Z</dc:date>
    <item>
      <title>Data driven pages - exporting multiple PNG by page name</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-exporting-multiple-png-by-page/m-p/182960#M1996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It took me a long time of searching forums to work out how to export mutliple data driven pages to a format other than PDF, using the page name in the file name (instead of the page number).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My page names also included characters that file naming won't accept (e.g "/"), and I wanted to remove spaces.&amp;nbsp; I was exporting to PNG.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the script if anyone else has the same problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument("CURRENT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; pageName = mxd.dataDrivenPages.pageRow.Name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; pageName = pageName.replace("/", "_")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; pageName = pageName.replace(" ", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; arcpy.mapping.ExportToPNG(mxd, r"C:\temp\" + pageName + ".png")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 23:55:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-exporting-multiple-png-by-page/m-p/182960#M1996</guid>
      <dc:creator>RichardKeightley</dc:creator>
      <dc:date>2013-06-13T23:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Data driven pages - exporting multiple PNG by page name</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-exporting-multiple-png-by-page/m-p/182961#M1997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the same problem. I'm new in Python and would like to export one Data driven to Jpeg format with the page name instead of page number for name of the generated file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried the code above, with the change in red:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument("CURRENT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.dataDrivenPages.currentPageID = pageNum&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pageName = mxd.dataDrivenPages.pageRow.N_Parcelle&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.mapping.ExportToJPEG(mxd, r"C:\temp\" + pageName + ".jpeg")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But the problem for me is the line 3:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Parsing error &amp;lt;type 'exceptions.IndentationError'&amp;gt;: expected an indented block (line 3)"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Someone could help me, I'm sure i'm really near&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+++&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 15:27:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-exporting-multiple-png-by-page/m-p/182961#M1997</guid>
      <dc:creator>BertrandMARTINEZ</dc:creator>
      <dc:date>2013-07-16T15:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Data driven pages - exporting multiple PNG by page name</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-exporting-multiple-png-by-page/m-p/182962#M1998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Python requires proper indentation&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
 mxd.dataDrivenPages.currentPageID = pageNum
 pageName = mxd.dataDrivenPages.pageRow.N_Parcelle
 arcpy.mapping.ExportToJPEG(mxd, r"C:\temp\" + pageName + ".jpeg")
del mxd &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:19:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-exporting-multiple-png-by-page/m-p/182962#M1998</guid>
      <dc:creator>JimCousins</dc:creator>
      <dc:date>2021-12-11T09:19:17Z</dc:date>
    </item>
  </channel>
</rss>

