Andra,I've looked at your code and made a few corrections to it. The currentPageID line needs to be in the loop and I think your output filename may have caused problems. Here is code very simily to your code.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
print "Exporting Page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))
arcpy.mapping.ExportToPDF(mxd, r"C:\Temp\\" + str(pageNum) + ".pdf")
del mxd
Because when switching out photos, the size and positing may change so I further modified the code to elimiate extra looping and included the orginal size/positioning info that is reapplied to each new picture.import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Temp\Photo.mxd")
elm = arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT", "photo1")[0]
elmX = elm.elementPositionX; elmY = elm.elementPositionY
elmHeight = elm.elementHeight; elmWidth = elm.elementWidth
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
mxd.dataDrivenPages.currentPageID = pageNum
imageName = mxd.dataDrivenPages.pageRow.getValue("image4map")
elm.sourceImage = "C:\\Temp\\" + imageName
elm.elementPositionX = elmX; elm.elementPositionY = elmY
elm.elementHeight = elmHeight; elm.elementWidth = elmWidth
print "Exporting Page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))
arcpy.mapping.ExportToPDF(mxd, r"C:\Temp\\" + str(pageNum) + ".pdf")
del mxd
I hope this helps,Jeff