#Check for existance of the output data before running the export tool. #Export to PDF outpath = arcpy.GetParameterAsText(2) #"C:\\" arcpy.AddMessage('Outpath: ' + outpath) outfolder = arcpy.GetParameterAsText(3) arcpy.AddMessage('Outfolder: ' + outfolder) pdfLocation = os.path.join(outpath, outfolder) #"C:\\temp\\" #print "pdfLocation: " + pdfLocation arcpy.AddMessage('pdfLocation: ' + pdfLocation) pdfName = pdfLocation + "\\" + APN + '.pdf' arcpy.AddMessage('pdfName: ' + pdfName) #print "pdfName: " + pdfName if arcpy.Exists(pdfLocation): pass #print "Folder Exists" arcpy.AddMessage('Folder Exists') else: #print r"Folder does not exist. Creating Folder" arcpy.AddMessage("Folder does not exist. Creating Folder...") arcpy.CreateFolder_management(outpath, outfolder) if arcpy.Exists(pdfName): arcpy.Delete_management(pdfName) try: arcpy.mapping.ExportToPDF(mxDoc, pdfName) arcpy.AddMessage("Export complete") except: arcpy.AddError(arcpy.GetMessages(2)) ## if recordCounter > 2: ## break recordCounter +=1 #print str(recordCounter) + " Records Exported" arcpy.AddMessage(str(recordCounter) + " Records Exported") del row, rows del i
#Export to PDF outpath = "C:\\" #arcpy.GetParameterAsText(2) arcpy.AddMessage('Outpath: ' + outpath) outfolder = "temp\\" #arcpy.GetParameterAsText(3) arcpy.AddMessage('Outfolder: ' + outfolder) pdfLocation = os.path.join(outpath, outfolder) #"C:\\temp\\" arcpy.AddMessage('pdfLocation: ' + pdfLocation)
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.