<?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: ExportToPDF Batch in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/exporttopdf-batch/m-p/647855#M50435</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Bruce - that has fixed it!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jul 2011 15:52:55 GMT</pubDate>
    <dc:creator>JoeNunn</dc:creator>
    <dc:date>2011-07-19T15:52:55Z</dc:date>
    <item>
      <title>ExportToPDF Batch</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-batch/m-p/647853#M50433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi - done a script to batch process multiple MXDs and I get this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &amp;lt;type 'exceptions.AttributeError'&amp;gt;: PageLayoutObject: Error in executing ExportToPDF&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The error seems to be due to the PDF string 'pdfname' as if I put r'C:\\temp\\test.pdf') directly in the ExportToPDF function (not in the string though!) it works. Whats the problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the script: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import glob, arcpy, os

mxdlist = glob.glob('T:\\45\\4588 EIA (London)\\Graphics\\GrDOCS\\Reports_5211\\ES\\*.mxd')

for mxd in mxdlist:
&amp;nbsp;&amp;nbsp;&amp;nbsp; m = os.path.basename(mxd)
&amp;nbsp;&amp;nbsp;&amp;nbsp; basename, ext = os.path.splitext(m)
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxdproper = arcpy.mapping.MapDocument(mxd)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print mxd
&amp;nbsp;&amp;nbsp;&amp;nbsp; print basename
&amp;nbsp;&amp;nbsp;&amp;nbsp; pdfname =&amp;nbsp; r"%s%s%s" % (r"T:\\45\\4588 EIA(London)\\Graphics\\GrDOCS\\Reports_5211\\ES\\",basename, r".pdf")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print pdfname
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxdproper, pdfname)
&amp;nbsp;&amp;nbsp;&amp;nbsp; del mxd&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:43:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-batch/m-p/647853#M50433</guid>
      <dc:creator>JoeNunn</dc:creator>
      <dc:date>2021-12-12T16:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF Batch</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-batch/m-p/647854#M50434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It might be your combination of using the 'r' to denote a raw string with the double backslashes. Try replacing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;pdfname =&amp;nbsp; r"%s%s%s" % (r"T:\\45\\4588 EIA(London)\\Graphics\\GrDOCS\\Reports_5211\\ES\\",basename, r".pdf")&lt;/PRE&gt;&lt;SPAN&gt;with&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;pdfname = os.path.join("T:\\45\\4588 EIA(London)\\Graphics\\GrDOCS\\Reports_5211\\ES\\", basename+".pdf")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2011 15:22:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-batch/m-p/647854#M50434</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2011-07-19T15:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF Batch</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-batch/m-p/647855#M50435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Bruce - that has fixed it!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2011 15:52:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-batch/m-p/647855#M50435</guid>
      <dc:creator>JoeNunn</dc:creator>
      <dc:date>2011-07-19T15:52:55Z</dc:date>
    </item>
  </channel>
</rss>

