AnsweredAssumed Answered

Labels not display in pdf

Question asked by hadpadmasiri on Nov 12, 2014
Latest reply on Nov 12, 2014 by Dan_Patterson

Dear Sir!

     I tried to write a python script to display labels, and export to pdf. But in pdf the labels are not display.

My script is given below. Pl give me a advice to correct it.

import arcpy

from arcpy import mapping

mxd = arcpy.mapping.MapDocument(r"J:\Gampaha\51027202\ASD.mxd")

df = arcpy.mapping.ListDataFrames(mxd, "*")[0]

LayerFile = arcpy.mapping.Layer(r"J:\Gampaha\51027202\LIS.lyr")

arcpy.mapping.AddLayer(df, LayerFile, "AUTO_ARRANGE")

df.zoomToSelectedFeatures()

ExistLayer = arcpy.mapping.ListLayers(mxd, "*", df)

if ExistLayer[0].supports("LABELCLASSES"):

  List1 = ExistLayer[0].labelClasses

  List1[0].className = "Parcelid"

  List1[0].expression = "[Parcelid]"

  List1[0].showClassLabels = True

mxd.saveACopy(r"J:\Gampaha\51027202\Pro.mxd")

arcpy.mapping.ExportToPDF(mxd, r"J:\Gampaha\51027202\Pro.pdf")

del mxd

Thanks

 

Padmasiri

Outcomes