<?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 script : allow overwrite validation in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/exporttopdf-script-allow-overwrite-validation/m-p/84847#M6690</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you very much! Thats perfect!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Nov 2012 16:27:35 GMT</pubDate>
    <dc:creator>MaximeDemers</dc:creator>
    <dc:date>2012-11-22T16:27:35Z</dc:date>
    <item>
      <title>ExportToPDF script : allow overwrite validation</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-script-allow-overwrite-validation/m-p/84843#M6686</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 a simple script that Export to Pdf the current Page_Layout of a mxd. I want to use it in a toolbox with a path parameter for the output. I have an error when I select an output that already exists. I suppose I have to code something about allowing overwriting in the validation of this parameter but I cant find any info about that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone can help?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 12:48:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-script-allow-overwrite-validation/m-p/84843#M6686</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2012-11-22T12:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF script : allow overwrite validation</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-script-allow-overwrite-validation/m-p/84844#M6687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You shouldn't be getting an error. It should just notify you that the file already exists and if you want to replace it. If you want you could just process it silently in the script by setting your parameter of your output PDF to a folder and specify the name in your script while handling if the pdf already exists.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: You could also just specify your parameter as input instead of output. This will allow you to take the path as a string and validate on that in your code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 14:30:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-script-allow-overwrite-validation/m-p/84844#M6687</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-11-22T14:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF script : allow overwrite validation</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-script-allow-overwrite-validation/m-p/84845#M6688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for your answer,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, even with a Parameters with Data Type: Folder, I have the same error. It said that the folder already exist. Error 000725&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I specify the folder parameter as an input, i have an error saying that the file doesnt exist.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 14:45:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-script-allow-overwrite-validation/m-p/84845#M6688</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2012-11-22T14:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF script : allow overwrite validation</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-script-allow-overwrite-validation/m-p/84846#M6689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Oh I see, I was under the impression your errors were showing up before you ran the tool. I assume in your script pdf is the variable of the path and name is the name of the pdf you want to create? Something like this should get you going.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import os import arcpy&amp;nbsp; mxd = arcpy.mapping.MapDocument("CURRENT") pdf = str(arcpy.GetParameterAsText(0)) name = str(arcpy.GetParameterAsText(1)) res = int(arcpy.GetParameterAsText(2)) quality = str(arcpy.GetParameterAsText(3)) path = os.path.join(pdf, name) if os.path.exists(path): &amp;nbsp;&amp;nbsp;&amp;nbsp; os.remove(path) arcpy.mapping.ExportToPDF(mxd, path, "Page_Layout", resolution=res, image_quality=quality)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 15:36:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-script-allow-overwrite-validation/m-p/84846#M6689</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-11-22T15:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF script : allow overwrite validation</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-script-allow-overwrite-validation/m-p/84847#M6690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you very much! Thats perfect!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 16:27:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-script-allow-overwrite-validation/m-p/84847#M6690</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2012-11-22T16:27:35Z</dc:date>
    </item>
  </channel>
</rss>

