<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcMap 10.2.1 Export PDF vs arcpy Export PDF scale differences? in Public Transit Questions</title>
    <link>https://community.esri.com/t5/public-transit-questions/arcmap-10-2-1-export-pdf-vs-arcpy-export-pdf-scale/m-p/535822#M64</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm experiencing differences from exporting features to PDF from within ArcMap and using a stand alone python program. Basically, I'm selecting a feature from a layer, zooming to the selected extent, changing the scale of the dataframe, and exporting the image to a pdf from PAGE_LAYOUT view- something pretty simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue that I'm having is that from within ArcMap, everything works fine. In the page layout view, everything looks as expected, and once exported, it looks great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to automate this so after building a stand alone python program, it exports like it's supposed to, however the scale is off by about 200.0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a snippet of my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;mxd = arcpy.mapping.MapDocument("C:\Path\To\MxdFile.mxd")
dataFrames = arcpy.mapping.ListDataFrames(mxd)
df = dataFrames[0]

layers = arcpy.mapping.ListLayers(mxd, "*", df)
for layer in layers:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if layer.name == "LayerIWantToUse":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
if layer.name != "LayerIWantToUse":
&amp;nbsp;&amp;nbsp;&amp;nbsp; raise Exception("Cannot find layer.")

arcpy.SelectLayerByAttribute_management(layer, "CLEAR_SELECTION")

query = "OBJECTID = 1"
layer.definitionQuery = query
arcpy.SelectLayerByAttribute_management(layer,"NEW_SELECTION", query)

df.zoomToSelectedFeatures();
df.scale = 2400.0
fileName = r"Python_2400.pdf")
arcpy.mapping.ExportToPDF(mxd, fileName, "PAGE_LAYOUT", 1056, 1632)
&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scale that it actually exports, appears to be 1:2200 instead of 1:2400 like it's supposed to. I've attached both images to show the differences.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have noticed that if I save the MXD with a different scale (1:100000 for example) and with ArcMap in "Data View", I have the scale issues. If I make sure "Layout View" is selected, change the scale to 1:2400, and save the MXD, I do not have the scale issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've seen quite a few forum posts regarding this, some saying it's a bug that should have been fixed in 10.1, but nobody with any real explanations on why there's scale issues.&lt;/P&gt;&lt;P&gt;Has anyone else encountered something similar?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Oct 2014 21:22:37 GMT</pubDate>
    <dc:creator>CoryKratz</dc:creator>
    <dc:date>2014-10-06T21:22:37Z</dc:date>
    <item>
      <title>ArcMap 10.2.1 Export PDF vs arcpy Export PDF scale differences?</title>
      <link>https://community.esri.com/t5/public-transit-questions/arcmap-10-2-1-export-pdf-vs-arcpy-export-pdf-scale/m-p/535822#M64</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm experiencing differences from exporting features to PDF from within ArcMap and using a stand alone python program. Basically, I'm selecting a feature from a layer, zooming to the selected extent, changing the scale of the dataframe, and exporting the image to a pdf from PAGE_LAYOUT view- something pretty simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue that I'm having is that from within ArcMap, everything works fine. In the page layout view, everything looks as expected, and once exported, it looks great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to automate this so after building a stand alone python program, it exports like it's supposed to, however the scale is off by about 200.0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a snippet of my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;mxd = arcpy.mapping.MapDocument("C:\Path\To\MxdFile.mxd")
dataFrames = arcpy.mapping.ListDataFrames(mxd)
df = dataFrames[0]

layers = arcpy.mapping.ListLayers(mxd, "*", df)
for layer in layers:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if layer.name == "LayerIWantToUse":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
if layer.name != "LayerIWantToUse":
&amp;nbsp;&amp;nbsp;&amp;nbsp; raise Exception("Cannot find layer.")

arcpy.SelectLayerByAttribute_management(layer, "CLEAR_SELECTION")

query = "OBJECTID = 1"
layer.definitionQuery = query
arcpy.SelectLayerByAttribute_management(layer,"NEW_SELECTION", query)

df.zoomToSelectedFeatures();
df.scale = 2400.0
fileName = r"Python_2400.pdf")
arcpy.mapping.ExportToPDF(mxd, fileName, "PAGE_LAYOUT", 1056, 1632)
&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scale that it actually exports, appears to be 1:2200 instead of 1:2400 like it's supposed to. I've attached both images to show the differences.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have noticed that if I save the MXD with a different scale (1:100000 for example) and with ArcMap in "Data View", I have the scale issues. If I make sure "Layout View" is selected, change the scale to 1:2400, and save the MXD, I do not have the scale issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've seen quite a few forum posts regarding this, some saying it's a bug that should have been fixed in 10.1, but nobody with any real explanations on why there's scale issues.&lt;/P&gt;&lt;P&gt;Has anyone else encountered something similar?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 21:22:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/arcmap-10-2-1-export-pdf-vs-arcpy-export-pdf-scale/m-p/535822#M64</guid>
      <dc:creator>CoryKratz</dc:creator>
      <dc:date>2014-10-06T21:22:37Z</dc:date>
    </item>
  </channel>
</rss>

