import arcpy from arcpy import mapping from arcpy import env import os mxdPath = arcpy.GetParameterAsText(0) # ex: r"c:\temp\ddpMap.mxd" pageNum = arcpy.GetParameter(1) # ex: 25 mxd = mapping.MapDocument(mxdPath) ddp = mxd.dataDrivenPages ddp.currentPageID = int(pageNum) # here you would pass 25; casting to int() just to be safe mapping.ExportToPDF(mxd, r"C:\test\mappage_" + str(pageNum) + ".pdf") del mxd del ddp
#.... other logic # ddp = mxd.dataDrivenPages ddp.currentPageID = int(pageNum) ddp.exportToPDF(r"c:\temp\mypage.pdf",page_range_type="CURRENT",multiple_files="PDF_SINGLE_FILE") #... other code #