AnsweredAssumed Answered

ArcGIS Pro Export python

Question asked by CCweedcontrol on Jan 29, 2019
Latest reply on Jan 29, 2019 by Dan_Patterson

I am trying to export a project to pdf.

With arcpy.mapping i had the following and worked

import arcpy, os, sys 

mxd = arcpy.mapping.MapDocument("CURRENT")
folder = os.path.dirname(mxd.filePath) # H:/GIS_Data
fullfilename = os.path.basename(mxd.filePath) # junk.mxd
filename = os.path.splitext(fullfilename) # [junk, mxd]
name = filename[0] # junk
pdfname = name + '.pdf' # junk.pdf
outpdf = folder + "/" + pdfname # H:/GIS_Data/junk.pdf
arcpy.mapping.ExportToPDF(mxd, pdfname, "PAGE_LAYOUT",0 ,0 ,"210")

I am attempting to do this with ArcGIS Pro and have the following but having a hard time getting it started.

I get AttributeError: 'str' object has no attribute 'listLayouts' with the following.


import arcpy, os, sys 

p ="CURRENT").filePath
l = p.listLayouts()[0]
l.exportToPDF(R"C:\temp\Ex1_WA.pdf", 'CURRENT',0 ,0 ,"210")