﻿{"id":5786,"date":"2018-07-26T01:25:12","date_gmt":"2018-07-25T23:25:12","guid":{"rendered":"http:\/\/www.sigterritoires.fr\/?p=5786"},"modified":"2018-10-17T12:59:32","modified_gmt":"2018-10-17T10:59:32","slug":"getting-started-with-arcgis-python-export-an-mxd-in-pdf-format","status":"publish","type":"post","link":"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/","title":{"rendered":"Getting started with ArcGis Python: Export an mxd in pdf format"},"content":{"rendered":"<p>Getting started\u00a0with Python on ArcGIS\u00a0is\u00a0easier\u00a0than you can think. It\u00a0is\u00a0not\u00a0required\u00a0to\u00a0master\u00a0Python to\u00a0perform a basic use\u00a0in\u00a0our\u00a0work since ArcGIS and ESRI\u00a0offer\u00a0a\u00a0complete and plenty of code examples. Reading the following Mapping Gis article (\u00a0<a href=\"https:\/\/translate.google.com\/translate?hl=en&amp;prev=_t&amp;sl=fr&amp;tl=en&amp;u=http:\/\/mappinggis.com\/2015\/10\/exportar-un-mxd-a-pdf-con-python\/\">http:\/\/mappinggis.com\/2015\/10\/exportar-un-mxd-a-pdf-con-python\/<\/a>\u00a0) has\u00a0largely\u00a0inspired\u00a0what\u00a0follows.<br \/>\nTherefore we\u00a0will\u00a0discuss\u00a0how to\u00a0generate\u00a0a\u00a0pdf\u00a0file\u00a0based on the map of an\u00a0ArcGis\u00a0project\u00a0(.mxd),without\u00a0opening\u00a0the\u00a0project\u00a0.\u00a0Let\u2019s suppose\u00a0this\u00a0document\u00a0has to be updated according to frequent updates of the data.<\/p>\n<p>We invite you\u00a0to read\u00a0the following article\u00a0\u00a0\u00a0<a href=\"https:\/\/translate.google.com\/translate?hl=en&amp;prev=_t&amp;sl=fr&amp;tl=en&amp;u=http:\/\/www.sigterritoires.fr\/index.php\/arcgis-et-python-avant-de-faire-vos-premiers-pas\/\">ArcGis\u00a0and\u00a0Python: before\u00a0taking the first steps<\/a>\u00a0\u00a0\u00a0to\u00a0see\u00a0in\u00a0more detail\u00a0the\u00a0different\u00a0options to\u00a0run\u00a0our\u00a0process\u00a0with a Python code.<br \/>\nHere we will discuss\u00a0three options: with the\u00a0command\u00a0window,\u00a0with the\u00a0ArcGis Python\u00a0console\u00a0and\u00a0with the Python console of\u00a0another\u00a0IDE.<br \/>\nLet\u2019s proceed\u00a0in\u00a0order.\u00a0First\u00a0we\u00a0must\u00a0find\u00a0the Python code that\u00a0interests\u00a0us.<!--more--><\/p>\n<h2><strong>Searching the Python code<\/strong>\u00a0<strong>with ArcGIS help<\/strong><\/h2>\n<p>Go\u00a0to\u00a0the address\u00a0\u00a0\u00a0<a href=\"https:\/\/translate.google.com\/translate?hl=en&amp;prev=_t&amp;sl=fr&amp;tl=en&amp;u=http:\/\/desktop.arcgis.com\/fr\/\">http:\/\/desktop.arcgis.com\/fr\/<\/a><\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5787\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd1\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd1.png?fit=640%2C146&amp;ssl=1\" data-orig-size=\"640,146\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd1.png?fit=640%2C146&amp;ssl=1\" class=\"alignnone size-medium wp-image-5787\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd1-300x68.png?resize=300%2C68\" alt=\"\" width=\"300\" height=\"68\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd1.png?resize=300%2C68&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd1.png?w=640&amp;ssl=1 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>In\u00a0the\u00a0search\u00a0field\u00a0type\u00a0the keywords:\u00a0\u00a0\u00a0<strong><em>mxd<\/em><\/strong>\u00a0<strong><em>to pdf<\/em><\/strong>\u00a0<strong><em>arcpy<\/em><\/strong><\/p>\n<p>In\u00a0the\u00a0search result\u00a0you\u00a0find\u00a0\u00a0\u00a0<strong>ExportToPDF<\/strong>\u00a0<strong>-Help |<\/strong>\u00a0<strong>ArcGIS for Desktop\u00a0<\/strong><\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5788\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd2.png?fit=640%2C495&amp;ssl=1\" data-orig-size=\"640,495\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd2.png?fit=640%2C495&amp;ssl=1\" class=\"alignnone size-medium wp-image-5788\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd2-300x232.png?resize=300%2C232\" alt=\"\" width=\"300\" height=\"232\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd2.png?resize=300%2C232&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd2.png?w=640&amp;ssl=1 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>By\u00a0clicking\u00a0this\u00a0link\u00a0you\u00a0will find\u00a0the\u00a0help\u00a0page\u00a0for the code we are\u00a0interested in\u00a0:\u00a0\u00a0\u00a0<a href=\"https:\/\/translate.google.com\/translate?hl=en&amp;prev=_t&amp;sl=fr&amp;tl=en&amp;u=http:\/\/desktop.arcgis.com\/fr\/desktop\/latest\/analyze\/arcpy-mapping\/exporttopdf.htm\">http:\/\/desktop.arcgis.com\/fr\/desktop\/latest\/analyze\/arcpy-mapping\/exporttopdf.htm<\/a><\/p>\n<p>You\u00a0find,\u00a0in\u00a0particular\u00a0,\u00a0two fundamental subsections\u00a0:<\/p>\n<p>The\u00a0Python\u00a0syntax\u00a0of the\u00a0command<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5789\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd3.png?fit=840%2C396&amp;ssl=1\" data-orig-size=\"840,396\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd3\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd3.png?fit=640%2C302&amp;ssl=1\" class=\"alignnone size-medium wp-image-5789\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd3-300x141.png?resize=300%2C141\" alt=\"\" width=\"300\" height=\"141\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd3.png?resize=300%2C141&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd3.png?resize=768%2C362&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd3.png?w=840&amp;ssl=1 840w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>And\u00a0code\u00a0examples<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5790\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd4\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd4.png?fit=836%2C515&amp;ssl=1\" data-orig-size=\"836,515\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd4.png?fit=640%2C394&amp;ssl=1\" class=\"alignnone size-medium wp-image-5790\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd4-300x185.png?resize=300%2C185\" alt=\"\" width=\"300\" height=\"185\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd4.png?resize=300%2C185&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd4.png?resize=768%2C473&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd4.png?w=836&amp;ssl=1 836w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>For\u00a0this\u00a0example\u00a0you\u00a0can\u00a0immediately\u00a0see\u00a0that\u00a0all\u00a0that\u2019s needed\u00a0to\u00a0execute\u00a0the\u00a0command\u00a0is\u00a0the name of the\u00a0mxd\u00a0and the name of\u00a0the\u00a0pdf\u00a0file\u00a0to\u00a0produce.<\/p>\n<h2><strong>Execution using\u00a0the<\/strong>\u00a0<strong>command<\/strong>\u00a0<strong>line<\/strong><\/h2>\n<p>Let\u2019s use as example\u00a0a\u00a0simple map with the\u00a0campsites\u00a0open\u00a0to the public as\u00a0of today.\u00a0The\u00a0layer\u00a0campsite\u00a0is\u00a0kept up to date by\u00a0another\u00a0process.\u00a0What we\u00a0want\u00a0is\u00a0to\u00a0produce\u00a0the pdf of the present day.\u00a0Here is\u00a0the\u00a0 layout\u00a0window of the mxd\u00a0document:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5792\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd5\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd5.png?fit=219%2C300&amp;ssl=1\" data-orig-size=\"219,300\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd5.png?fit=219%2C300&amp;ssl=1\" class=\"alignnone size-medium wp-image-5792\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd5-219x300.png?resize=219%2C300\" alt=\"\" width=\"219\" height=\"300\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>To\u00a0execute\u00a0the\u00a0command, we\u00a0open\u00a0a\u00a0command\u00a0prompt\u00a0window:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5793\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd6-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd6-1.png?fit=300%2C150&amp;ssl=1\" data-orig-size=\"300,150\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd6\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd6-1.png?fit=300%2C150&amp;ssl=1\" class=\"alignnone size-medium wp-image-5793\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd6-1-300x150.png?resize=300%2C150\" alt=\"\" width=\"300\" height=\"150\" \/><\/p>\n<p>You\u00a0launch\u00a0Python\u00a0by simply\u00a0typing\u00a0<strong><em> python\u00a0\u00a0<\/em><\/strong><\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5794\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd7\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd7.png?fit=300%2C153&amp;ssl=1\" data-orig-size=\"300,153\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd7\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd7.png?fit=300%2C153&amp;ssl=1\" class=\"alignnone size-medium wp-image-5794\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd7-300x153.png?resize=300%2C153\" alt=\"\" width=\"300\" height=\"153\" \/><\/p>\n<p>the\u00a0three angle brackets (&gt;&gt;&gt;)\u00a0indicate\u00a0that\u00a0you\u00a0can\u00a0enter\u00a0your\u00a0Python\u00a0command\u00a0.<\/p>\n<p>The first\u00a0order\u00a0is\u00a0to load\u00a0in\u00a0Python the ArcGis functions.\u00a0Type<\/p>\n<p><strong><em>import<\/em><\/strong>\u00a0<strong><em>arcpy\u00a0<\/em><\/strong><\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5795\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd8\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd8.png?fit=300%2C153&amp;ssl=1\" data-orig-size=\"300,153\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd8\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd8.png?fit=300%2C153&amp;ssl=1\" class=\"alignnone size-medium wp-image-5795\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd8-300x153.png?resize=300%2C153\" alt=\"\" width=\"300\" height=\"153\" \/><\/p>\n<p>This is all you have to do to be\u00a0able to\u00a0run\u00a0our\u00a0command\u00a0that\u00a0will\u00a0generate\u00a0our\u00a0pdf\u00a0file\u00a0from\u00a0the mxd.\u00a0Afterwards, we enter the\u00a0order\u00a0:<\/p>\n<p><strong><em>mxd<\/em><\/strong>\u00a0<strong><em>=<\/em><\/strong>\u00a0<strong><em>arcpy.mapping.MapDocument<\/em><\/strong>\u00a0<strong><em>(r<\/em><\/strong>\u00a0<strong><em>\u00a0<\/em><\/strong>\u00a0<strong><em>C: \\ Quimper \\<\/em><\/strong>\u00a0<strong><em>geocoding.mxd<\/em><\/strong>\u00a0<strong><em>\u00a0<\/em><\/strong>\u00a0<strong><em>\u00ab\u00a0)<\/em><\/strong><br \/>\n<strong><em>arcpy.mapping.ExportToPDF<\/em><\/strong>\u00a0<strong><em>(<\/em><\/strong>\u00a0<strong><em>mxd, r<\/em><\/strong>\u00a0<strong><em>\u00a0<\/em><\/strong>\u00a0<strong><em>\u00ab\u00a0C: \\ Quimper \\ Campings.pdf<\/em><\/strong>\u00a0<strong><em>\u00a0<\/em><\/strong>\u00a0<strong><em>\u00ab\u00a0)<\/em><\/strong><br \/>\n<strong><em>del<\/em><\/strong>\u00a0<strong><em>mxd\u00a0\u00a0<\/em><\/strong><\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5796\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd9\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd9.png?fit=300%2C151&amp;ssl=1\" data-orig-size=\"300,151\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd9\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd9.png?fit=300%2C151&amp;ssl=1\" class=\"alignnone size-medium wp-image-5796\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd9-300x151.png?resize=300%2C151\" alt=\"\" width=\"300\" height=\"151\" \/><\/p>\n<p>(you\u00a0can\u00a0copy-\u00a0paste\u00a0directly\u00a0the three\u00a0lines\u00a0into\u00a0the\u00a0window\u00a0Command\u00a0Prompt)<\/p>\n<p>and\u00a0we\u00a0get\u00a0immediately\u00a0the\u00a0pdf\u00a0file<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5797\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd10\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd10.png?fit=300%2C195&amp;ssl=1\" data-orig-size=\"300,195\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd10\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd10.png?fit=300%2C195&amp;ssl=1\" class=\"alignnone size-medium wp-image-5797\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd10-300x195.png?resize=300%2C195\" alt=\"\" width=\"300\" height=\"195\" \/><\/p>\n<p>Note\u00a0that the date\u00a0being ArcMap text\u00a0dynamic\u00a0is\u00a0filled in\u00a0with actual date.<\/p>\n<p>If\u00a0you\u00a0store the\u00a0order\u00a0lines\u00a0in\u00a0a\u00a0text file, with\u00a0an\u00a0extension.\u00a0py,\u00a0you\u00a0can\u00a0run\u00a0the\u00a0entire\u00a0order\u00a0in\u00a0a\u00a0single\u00a0command\u00a0line:<\/p>\n<p>Open\u00a0the\u00a0window\u00a0Command\u00a0Prompt,\u00a0and then\u00a0type<\/p>\n<p><strong><em>python.exe campings.py\u00a0\u00a0<\/em><\/strong><\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5798\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd11\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd11.png?fit=300%2C154&amp;ssl=1\" data-orig-size=\"300,154\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd11\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd11.png?fit=300%2C154&amp;ssl=1\" class=\"alignnone size-medium wp-image-5798\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd11-300x154.png?resize=300%2C154\" alt=\"\" width=\"300\" height=\"154\" \/><\/p>\n<p>You\u00a0get\u00a0the\u00a0same\u00a0result\u00a0in\u00a0pdf.<\/p>\n<h2><strong>Execution <\/strong><strong>using<\/strong><strong>\u00a0the\u00a0ArcGis Python\u00a0console<\/strong><\/h2>\n<p>The advantage\u00a0of executing the\u00a0Python code\u00a0from\u00a0the\u00a0ArcMap\u00a0Python console\u00a0lies\u00a0mainly\u00a0in\u00a0the benefit\u00a0from the syntactical aid.<\/p>\n<p>As\u00a0you\u00a0can\u00a0perceive\u00a0by\u00a0consulting the\u00a0syntax\u00a0of\u00a0our\u00a0command,\u00a0there\u00a0is a\u00a0whole\u00a0set\u00a0of\u00a0optional parameters.\u00a0For\u00a0example,\u00a0the\u00a0definition\u00a0of the\u00a0pdf\u00a0output.\u00a0By\u00a0default,\u00a0it\u00a0is\u00a0300dpi.\u00a0If\u00a0you\u00a0want it to be\u00a0600 dpi\u00a0you\u00a0must\u00a0add\u00a0the option\u00a0in\u00a0the\u00a0command\u00a0line<\/p>\n<p><strong><em>arcpy.mapping.ExportToPDF (<\/em><\/strong>\u00a0<strong><em>mxd, r<\/em><\/strong>\u00a0<strong><em>\u00a0<\/em><\/strong>\u00a0<strong><em>\u00ab\u00a0C: \\ Quimper \\ Campings.pdf<\/em><\/strong>\u00a0<strong><em>\u00a0<\/em><\/strong>\u00a0<strong><em>\u00ab\u00a0Resolution = 600)<\/em><\/strong><\/p>\n<p>In\u00a0this\u00a0case\u00a0it\u00a0is\u00a0easier\u00a0to use\u00a0the Python console:<\/p>\n<p>We\u00a0open\u00a0the Python console\u00a0by\u00a0clicking\u00a0in\u00a0the\u00a0ArcMap\u00a0window\u00a0the\u00a0corresponding\u00a0button<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5799\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd12\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd12.png?fit=630%2C221&amp;ssl=1\" data-orig-size=\"630,221\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd12\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd12.png?fit=630%2C221&amp;ssl=1\" class=\"alignnone size-medium wp-image-5799\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd12-300x105.png?resize=300%2C105\" alt=\"\" width=\"300\" height=\"105\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd12.png?resize=300%2C105&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd12.png?w=630&amp;ssl=1 630w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>You\u00a0do\u00a0not\u00a0have\u00a0to\u00a0enter\u00a0the\u00a0arcpy\u00a0import\u00a0line\u00a0in\u00a0the ArcMap console.<\/p>\n<p>When\u00a0you\u00a0type\u00a0the\u00a0command\u00a0\u00a0\u00a0<strong><em>arcpy.mapping.ExportToPDF<\/em><\/strong>\u00a0,\u00a0you\u00a0will see\u00a0the syntax\u00a0of\u00a0this\u00a0one\u00a0 appear in\u00a0the\u00a0right window\u00a0:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5800\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd13\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd13.png?fit=840%2C199&amp;ssl=1\" data-orig-size=\"840,199\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd13\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd13.png?fit=640%2C152&amp;ssl=1\" class=\"alignnone size-medium wp-image-5800\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd13-300x71.png?resize=300%2C71\" alt=\"\" width=\"300\" height=\"71\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd13.png?resize=300%2C71&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd13.png?resize=768%2C182&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd13.png?w=840&amp;ssl=1 840w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Once\u00a0executed\u00a0, the\u00a0command\u00a0produces\u00a0the\u00a0same\u00a0pdf\u00a0file\u00a0than\u00a0before\u00a0.<\/p>\n<h2><strong>From\u00a0the console of\u00a0another<\/strong>\u00a0<strong>IDE<\/strong><\/h2>\n<p>The\u00a0different\u00a0integrated\u00a0development\u00a0environments are,\u00a0in\u00a0theory,\u00a0intended\u00a0to be\u00a0executables.\u00a0But,\u00a0obviously,\u00a0they\u00a0hold\u00a0interpretation\u00a0consoles\u00a0equivalent\u00a0to the\u00a0ArcMap\u00a0Python console.<\/p>\n<p>For example, PyScrpter, allows you to enter and run both control lines. The difference lies on the writing help for the commands:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5801\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/getting-started-with-arcgis-python-export-an-mxd-in-pdf-format\/mxd14\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd14.png?fit=640%2C355&amp;ssl=1\" data-orig-size=\"640,355\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mxd14\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd14.png?fit=640%2C355&amp;ssl=1\" class=\"alignnone size-medium wp-image-5801\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd14-300x166.png?resize=300%2C166\" alt=\"\" width=\"300\" height=\"166\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd14.png?resize=300%2C166&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/07\/mxd14.png?w=640&amp;ssl=1 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Generally you\u00a0will have\u00a0more\u00a0features\u00a0offered\u00a0by\u00a0an\u00a0IDE than through the\u00a0ArcMap\u00a0Python console. \u00a0But if you keep on using the command line, both are equivalent. The main difference is that IDE will allow you to write, test and debug the whole Python scripts.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting started\u00a0with Python on ArcGIS\u00a0is\u00a0easier\u00a0than you can think. It\u00a0is\u00a0not\u00a0required\u00a0to\u00a0master\u00a0Python to\u00a0perform a basic use\u00a0in\u00a0our\u00a0work since ArcGIS and ESRI\u00a0offer\u00a0a\u00a0complete and plenty of code examples. Reading the following Mapping Gis article (\u00a0http:\/\/mappinggis.com\/2015\/10\/exportar-un-mxd-a-pdf-con-python\/\u00a0) has\u00a0largely\u00a0inspired\u00a0what\u00a0follows. Therefore we\u00a0will\u00a0discuss\u00a0how to\u00a0generate\u00a0a\u00a0pdf\u00a0file\u00a0based on the map&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"give_campaign_id":0,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1260],"tags":[],"class_list":["post-5786","post","type-post","status-publish","format-standard","hentry","category-non-classe-en"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p6XU0A-1vk","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/5786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/comments?post=5786"}],"version-history":[{"count":0,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/5786\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/media?parent=5786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/categories?post=5786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/tags?post=5786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}