tags are wrapped around it via these forum posts. See below. Your code suggests to me that you are running it as a stand-alone script because you are importing arcpy and NOT using the keyword CURRENT. I take it that your exported PDFs do have the correct images. If you want to run your code in the Python window and see ArcMap update from page to page while your script is running then you would need to use arcpy.RefreshActiveView(). I also suggest that you insert a time delay. Jeff import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Temp\Photo.mxd") for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): mxd.dataDrivenPages.currentPageID = pageNum imageName = mxd.dataDrivenPages.pageRow.getValue("image4map") for elm in arcpy.mapping.ListLayoutElements(mxd,"PICTURE_ELEMENT"): if elm.name == "photo1": elm.sourceImage = "C:\\Temp\\" + imageName arcpy.mapping.ExportToPDF(mxd, r"C:\Temp\\" + str(pageNum) + ".pdf") del mxd
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.