AnsweredAssumed Answered

Text Element/Font Issues when Exporting to PDF with arcpy.mapping

Question asked by geonetadmin on Oct 12, 2012
Latest reply on Nov 1, 2012 by geonetadmin
Original User: lusk0001

I have an MXD set up with data driven pages and there are several text elements on the page that contain dynamic text that gets updated based on field values in the feature class.  When I export the pages to PDF through the GUI they come out great, but when I switched to using arcpy.mapping through a Python script I'm getting weird results on those text elements.  It's like all of the characters in the text elements get squished together.

See attached PDFs for examples.  The script I'm using is also included below.

Windows 7, ArcGIS 10.0 SP5

import arcpy

# Retrieve the Map Document    
mxd = arcpy.mapping.MapDocument("C:\\User\\todd\\StandardMaps\\MakePropertyMaps.mxd")
outDir = "C:\\Temp\\PropertyMaps\\"

try:
    #for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    for pageNum in range(1, 5):
        # Retrieve the current page
        mxd.dataDrivenPages.currentPageID = pageNum
        
        # Variables
        mapScale = mxd.dataDrivenPages.pageRow.MAP_SCALE
        fileName = mxd.dataDrivenPages.pageRow.PROPMAPPOLY
        outPath = outDir + str(fileName) + ".pdf"
        df = arcpy.mapping.ListDataFrames(mxd, "StanMap")[0]

        # Check the scale and update the data frame size accordingly
        if mapScale == 4800:
            df.elementWidth = 18.5
        else:
            df.elementWidth = 28.5
            
        # Export the PDF
        print "Exporting map: " + str(fileName)
        arcpy.mapping.ExportToPDF(mxd, outPath, "PAGE_LAYOUT", 640, 480, 300,\
                                  "NORMAL", "RGB", True, "NONE", "RASTERIZE_BITMAP",\
                                  False, False, "NONE", True, 75)

    # Cleanup
    del mxd
    
except:
    print arcpy.GetMessages(2)
    del mxd

Attachments

Outcomes