I have a Python script to apply IDW interpolation over different datasets, so that the results are several rasters in format .aux.

How can I save automatically in the Python script what appears in the page layout (in my case, the GPS points and the raster map) to a PDF directly, as I would manually do going to the File section and clicking in Export Map?

It has to be easy but I am not finding the command.


Use ExportToPDF.

From the help:

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
arcpy.mapping.ExportToPDF(mxd, r"C:\Project\Output\Project.pdf")
| improve this answer | |
  • Great, thank you very much! What I finally did was take the current mxd in my screen: mxd = arcpy.mapping.MapDocument("CURRENT") and then export it arcpy.mapping.ExportToPDF(mxd, r"C:\Project\Output\Project.pdf") – IceBelt Nov 1 '19 at 8:21
  • Great @IceBelt. Please mark the answer as correct. – Emil Brundage Nov 1 '19 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.