Select to view content in your preferred language

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

3058
3
10-12-2012 06:56 AM
by Anonymous User
Not applicable
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
0 Kudos
3 Replies
by Anonymous User
Not applicable
Original User: jbarrette

I'm not aware of this issue.  What would happen if you just used:

arcpy.mapping.ExportToPDF(mxd, outpath)


I wonder if it is one of the individual export parameters causing the problem.  If the problem persists, please open a ticket with support.

Jeff
0 Kudos
ToddLusk
New Contributor III
I'm not aware of this issue.  What would happen if you just used:

arcpy.mapping.ExportToPDF(mxd, outpath)


I wonder if it is one of the individual export parameters causing the problem.  If the problem persists, please open a ticket with support.

Jeff


Just to follow-up (for anyone else's benefit).  I got the same results using that method too.  I'll contact support and see what they have to say.
0 Kudos
by Anonymous User
Not applicable
Original User: lusk0001

A little more information on this issue as I've been working with Esri support.

We have narrowed down the problem to be something in the conversion to the PDF through the Python script.  When I run the script and export the maps in the EMF format, they work fine.  I had someone off-site (not in our corporate computing environment) try running the script and it worked fine too.  The only real difference between his machine and mine in the office is that I have Adobe Acrobat Standard 9 installed (he only has the Adobe Reader x installed).  However, when we tried removing Acrobat 9 from our "test" machine in-house, it didn't fix the problem.  So, now I'm beginning to wonder if it's something related to a windows update, patch, etc. that's unique to our computing environment that is causing the problem.
0 Kudos