AnsweredAssumed Answered

ExportToPDF and scale issues

Question asked by johnckidd on Feb 5, 2016

Hello, I am having trouble with a script that I've used hundreds of times in 10.0 and 10.1 but no longer works in 10.3.

 

It is necessary for me to export the data frame instead of the entire page layout so I am passing the data frame object to the ExportToPDF function and I am providing height and width with df_export_height and df_export_width. I have always set the height to df.elementHeight / 0.004 and width to df.elementWidth / 0.004 because this ensures that the pdf document's height and width are the same as the data frame's height and width. This part still works. A data frame set to 36 inches by 48 inches will result in a 36x48 inch pdf. But the exported map appears to be zoomed out to about 1:60,000 even though I've set the df.scale to 31680. I have tried different data frame heights and widths, different scales, and different mxds  but the pdf always appears zoomed out to around double the data frame scale. This code produced pdfs with the appropriate scale before I upgraded to 10.3.

 

mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd)[0]
df.scale = 31680
dfew = df.elementWidth/0.004
dfeh = df.elementHeight/0.004
arcpy.mapping.ExportToPDF(mxd, 'C:/test.pdf', df, df_export_width=dfew, \
                          df_export_height=dfeh, resolution=250, image_quality='BETTER', \
                          jpeg_compression_quality=25, layers_attributes='NONE')

 

Thanks for any help.

Outcomes