<?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: Append Existing PDF Document with python in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/append-existing-pdf-document-with-python/m-p/75205#M897</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I figured it out. I need to open the PDF document first.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Page = str(arcpy.GetParameter(0))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outPDFpath = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;finalpdf_filename = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;finalPdf = arcpy.mapping.PDFDocumentOpen(finalpdf_filename)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jan 2012 18:38:05 GMT</pubDate>
    <dc:creator>JohnLay</dc:creator>
    <dc:date>2012-01-25T18:38:05Z</dc:date>
    <item>
      <title>Append Existing PDF Document with python</title>
      <link>https://community.esri.com/t5/mapping-questions/append-existing-pdf-document-with-python/m-p/75204#M896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am just starting to work with python scripts, so any help would be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to append an existing PDF document with a single page exported from a Data Drive Page MXD, but I'm having difficulty.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, os, string&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Script arguments&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Page = str(arcpy.GetParameter(0))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outPDFpath = arcpy.GetParameterAsText(1) #Working folder&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;finalPdf = arcpy.GetParameterAsText(2) #Existing PDF file &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Export Section Map&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument(r"CURRENT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ddp = mxd.dataDrivenPages&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ddp.currentPageID = int(Page)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tmpPdf = outPDFpath + "temp.pdf"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ddp.exportToPDF(tmpPdf, "CURRENT", resolution = 175)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;finalPdf.appendPages(tmpPdf)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;os.remove(tmpPdf)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd, ddp&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I continue to get the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; File "C:\~Working\tools\Scripts\AppendDDPPage.py", line 14, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; finalPdf.appendPages(tmpPdf)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: 'unicode' object has no attribute 'appendPages'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (ExportSinglePagefromDDP22).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 18:10:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/append-existing-pdf-document-with-python/m-p/75204#M896</guid>
      <dc:creator>JohnLay</dc:creator>
      <dc:date>2012-01-25T18:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Append Existing PDF Document with python</title>
      <link>https://community.esri.com/t5/mapping-questions/append-existing-pdf-document-with-python/m-p/75205#M897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I figured it out. I need to open the PDF document first.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Page = str(arcpy.GetParameter(0))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outPDFpath = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;finalpdf_filename = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;finalPdf = arcpy.mapping.PDFDocumentOpen(finalpdf_filename)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 18:38:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/append-existing-pdf-document-with-python/m-p/75205#M897</guid>
      <dc:creator>JohnLay</dc:creator>
      <dc:date>2012-01-25T18:38:05Z</dc:date>
    </item>
  </channel>
</rss>

