<?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: Export Data Driven Pages to PDF without a file Prefix in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404461#M31857</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nope, sure doesn't...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Feb 2015 20:01:37 GMT</pubDate>
    <dc:creator>ToddBishop</dc:creator>
    <dc:date>2015-02-04T20:01:37Z</dc:date>
    <item>
      <title>Export Data Driven Pages to PDF without a file Prefix</title>
      <link>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404459#M31855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Im trying to export data driven pages (Mapbook) and have the resulting PDF named for a/the index field.&amp;nbsp; Here's the code snippit I am working on:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="python" name="code"&gt;mport arcpy&amp;nbsp; print "Setting Map Document. . ."&amp;nbsp; mxd = arcpy.mapping.MapDocument("CURRENT")&amp;nbsp; for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pageName = mxd.dataDrivenPages.pageRow.stand_key&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Exporting page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str (mxd.dataDrivenPages.pageCount)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, r"D:\Temp\Test" + str(pageName) + ".pdf")&amp;nbsp; del mxd&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P&gt;This works just fine, but "Test" is a prefix of the filename.&amp;nbsp; If i remove the "Test" and have and make the code like this below...it doesn't work.&amp;nbsp; Just to be clear I need the individually exported PDF page to be named for the value of str(pageName)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="python" name="code"&gt;import arcpy ... print "Setting Map Document. . ." ... mxd = arcpy.mapping.MapDocument("CURRENT") ... for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): ...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum&amp;nbsp;&amp;nbsp; ...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pageName = mxd.dataDrivenPages.pageRow.stand_key&amp;nbsp; ...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Exporting page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str (mxd.dataDrivenPages.pageCount)) ...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, r"D:\Temp" + str(pageName) + ".pdf") ... del mxd&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P&gt;Should I be using something other than arcpy.mapping.ExportToPDF?&amp;nbsp; Other Solution?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;Should &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 18:57:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404459#M31855</guid>
      <dc:creator>ToddBishop</dc:creator>
      <dc:date>2015-02-04T18:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Export Data Driven Pages to PDF without a file Prefix</title>
      <link>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404460#M31856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does it work if you add a '\' in the path?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1423076898272676 jive_text_macro" jivemacro_uid="_1423076898272676"&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;arcpy.mapping.ExportToPDF(mxd, r&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue; background-color: #f6f6f6;"&gt;"D:\Temp\"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000; background-color: #f6f6f6;"&gt; + str(pageName) + &lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue; background-color: #f6f6f6;"&gt;".pdf"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000; background-color: #f6f6f6;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 19:10:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404460#M31856</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2015-02-04T19:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Export Data Driven Pages to PDF without a file Prefix</title>
      <link>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404461#M31857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nope, sure doesn't...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 20:01:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404461#M31857</guid>
      <dc:creator>ToddBishop</dc:creator>
      <dc:date>2015-02-04T20:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Export Data Driven Pages to PDF without a file Prefix</title>
      <link>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404462#M31858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, what does "it doesn't work" mean? Is there an error? If so, what is it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 20:29:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404462#M31858</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2015-02-04T20:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Export Data Driven Pages to PDF without a file Prefix</title>
      <link>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404463#M31859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works for me (resulting in '1.pdf', '2.pdf', '3.pdf', etc.):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; import os
&amp;gt;&amp;gt;&amp;gt; mxd = arcpy.mapping.MapDocument("CURRENT")
&amp;gt;&amp;gt;&amp;gt; for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
...&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum
...&amp;nbsp;&amp;nbsp;&amp;nbsp; name = str(pageNum) + ".pdf"
...&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, os.path.join("C:\junk", name))&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:25:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404463#M31859</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-11T18:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Export Data Driven Pages to PDF without a file Prefix</title>
      <link>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404464#M31860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for the &lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;brevity on my initial response.&amp;nbsp; It threw the error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Parsing error SyntaxError: EOL while scanning string literal&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Your second suggestion worked perfectly though..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Thanks much.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;todd&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 21:53:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-data-driven-pages-to-pdf-without-a-file/m-p/404464#M31860</guid>
      <dc:creator>ToddBishop</dc:creator>
      <dc:date>2015-02-04T21:53:48Z</dc:date>
    </item>
  </channel>
</rss>

