<?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 Re: ArcPy - How to order PDFs in PDF MapBook in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-how-to-order-pdfs-in-pdf-mapbook/m-p/798796#M1960</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may be&amp;nbsp;working much to hard on this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Select your PDF's in Windows Explorer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Right click to combine all the selected PDF's&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/400780_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Then in the Combine Files dialog click on the Switch to List View.&amp;nbsp;Then sort by the modified field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-2 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/400818_Capture.PNG" style="width: 620px; height: 352px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Apr 2018 15:38:30 GMT</pubDate>
    <dc:creator>RobertBorchert</dc:creator>
    <dc:date>2018-04-06T15:38:30Z</dc:date>
    <item>
      <title>ArcPy - How to order PDFs in PDF MapBook</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-how-to-order-pdfs-in-pdf-mapbook/m-p/798795#M1959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The following code takes PDFs and appends them to a title page, creating a PDF MapBook. However, I can't figure out how to get the PDFs in the right order. I want the PDFs to be ordered by the month and year specified in the files (last 6 characters), rather than just alphabetical order of the whole file name. I am specifying the month using its numeric value (Example:&amp;nbsp;CTDiscreteSumWithin4000_Avon_2017_5&lt;STRONG&gt;),&amp;nbsp;&lt;/STRONG&gt;I don't know whether than makes things easier or harder.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\arcGIS_Shared\Python\Export\Discrete_CT"&lt;/SPAN&gt;
path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&amp;nbsp; r&lt;SPAN class="string token"&gt;"C:\arcGIS_Shared\Python\Export\Discrete_CT"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;### Create the PDF MapBook file&lt;/SPAN&gt;
CTpdfPath &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Avon_DiscreteHeatMaps.pdf'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
CTpdfDoc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;PDFDocumentCreate&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CTpdfPath&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;###List all files to be added to MapBook&lt;/SPAN&gt;
CTpdfList &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFiles&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CTDiscreteSumWithin4000_Avon*"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;### Add market title page to the newly created PDF document&lt;/SPAN&gt;
CTpdfDoc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;appendPages&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CTTitlePage.pdf"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;### Append market specific pages to the PDF&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; CTpdf &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; CTpdfList&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CTpdfDoc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;appendPages&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\arcGIS_Shared\Python\Export\Discrete_CT\%s"&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt;CTpdf&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CTpdf&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 


CTpdfDoc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;saveAndClose&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help/advice would be appreciated. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:14:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-how-to-order-pdfs-in-pdf-mapbook/m-p/798795#M1959</guid>
      <dc:creator>Business_IntelligenceSoftware</dc:creator>
      <dc:date>2021-12-12T09:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy - How to order PDFs in PDF MapBook</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-how-to-order-pdfs-in-pdf-mapbook/m-p/798796#M1960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may be&amp;nbsp;working much to hard on this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Select your PDF's in Windows Explorer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Right click to combine all the selected PDF's&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/400780_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Then in the Combine Files dialog click on the Switch to List View.&amp;nbsp;Then sort by the modified field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-2 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/400818_Capture.PNG" style="width: 620px; height: 352px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2018 15:38:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcpy-how-to-order-pdfs-in-pdf-mapbook/m-p/798796#M1960</guid>
      <dc:creator>RobertBorchert</dc:creator>
      <dc:date>2018-04-06T15:38:30Z</dc:date>
    </item>
  </channel>
</rss>

