I am just starting to work with python scripts, so any help would be greatly appreciated.
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.
The code is as follows:
import arcpy, os, string
# Script arguments
Page = str(arcpy.GetParameter(0))
outPDFpath = arcpy.GetParameterAsText(1) #Working folder
finalPdf = arcpy.GetParameterAsText(2) #Existing PDF file
#Export Section Map
mxd = arcpy.mapping.MapDocument(r"CURRENT")
ddp = mxd.dataDrivenPages
ddp.currentPageID = int(Page)
tmpPdf = outPDFpath + "temp.pdf"
ddp.exportToPDF(tmpPdf, "CURRENT", resolution = 175)
finalPdf.appendPages(tmpPdf)
os.remove(tmpPdf)
del mxd, ddp
I continue to get the following error:
Traceback (most recent call last):
File "C:\~Working\tools\Scripts\AppendDDPPage.py", line 14, in <module>
finalPdf.appendPages(tmpPdf)
AttributeError: 'unicode' object has no attribute 'appendPages'
Failed to execute (ExportSinglePagefromDDP22).
Any suggestions?