<?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: Export PDF Bookmarks to PDF Pages (single PDF) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/export-pdf-bookmarks-to-pdf-pages-single-pdf/m-p/675580#M52304</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ListDataFrames was not new at 10.1.&amp;nbsp; Maybe you are talking about ListBookmarks.&amp;nbsp; There are a couple of samples in the help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This first one shows you how to iterate through bookmarks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/#/ListBookmarks/00s300000060000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/#/ListBookmarks/00s300000060000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Transportation")[0]
for bkmk in arcpy.mapping.ListBookmarks(mxd, data_frame=df):
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.extent = bkmk.extent
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFile = r"C:\Project\Output\\" + bkmk.name + ".jpg"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToJPEG(mxd, outFile, df)
del mxd
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can easily change that to export to PDF.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The next script shows you how to append many PDFs into a single PDF.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/#/PDFDocument/00s30000002w000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/#/PDFDocument/00s30000002w000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os

#Set file name and remove if it already exists
pdfPath = r"C:\Project\ParcelAtlasMapBook.pdf"
if os.path.exists(pdfPath):
&amp;nbsp;&amp;nbsp;&amp;nbsp; os.remove(pdfPath)

#Create the file and append pages
pdfDoc = arcpy.mapping.PDFDocumentCreate(pdfPath)
pdfDoc.appendPages(r"C:\Project\Title.pdf")
pdfDoc.appendPages(r"C:\Project\ParcelAtlas.pdf")

#Commit changes and delete variable reference
pdfDoc.saveAndClose()
del pdfDoc
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 04:29:23 GMT</pubDate>
    <dc:creator>JeffBarrette</dc:creator>
    <dc:date>2021-12-12T04:29:23Z</dc:date>
    <item>
      <title>Export PDF Bookmarks to PDF Pages (single PDF)</title>
      <link>https://community.esri.com/t5/python-questions/export-pdf-bookmarks-to-pdf-pages-single-pdf/m-p/675579#M52303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have this script&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy
mxd = arcpy.mapping.MapDocument("I:\GIS_Workspace\MAP\Test.mxd")
mainDF = arcpy.mapping.ListDataFrames(mxd, "Layers") [0]
arcpy.RefreshActiveView();arcpy.RefreshTOC()
arcpy.mapping.ExportToPDF (mxd,"I:\GIS_Workspace\PDF\MAP.pdf")]&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...which works great if I'm just dumping out a single map without much criteria.&amp;nbsp; I've been asked to create a PDF document with multiple pages.&amp;nbsp; Each with a map corresponding to one of the bookmarks within a .mxd file.&amp;nbsp; I understand &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;arcpy.mapping.ListDataFrames(mxd, "Layers") [0]&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt; was added in ArcGIS 10.1.&amp;nbsp; I'm thinking that may hold some promise...&amp;nbsp; I've not found too much info on this in my searches...&amp;nbsp; There are more layers than just the ones needed in this .mxd, so I'd need to be able to specify which layers should apply to each bookmark (they'd all be the same for each, so hard coding would work too).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;TIA&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 22:10:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-pdf-bookmarks-to-pdf-pages-single-pdf/m-p/675579#M52303</guid>
      <dc:creator>DannyLackey</dc:creator>
      <dc:date>2014-02-26T22:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Export PDF Bookmarks to PDF Pages (single PDF)</title>
      <link>https://community.esri.com/t5/python-questions/export-pdf-bookmarks-to-pdf-pages-single-pdf/m-p/675580#M52304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ListDataFrames was not new at 10.1.&amp;nbsp; Maybe you are talking about ListBookmarks.&amp;nbsp; There are a couple of samples in the help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This first one shows you how to iterate through bookmarks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/#/ListBookmarks/00s300000060000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/#/ListBookmarks/00s300000060000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Transportation")[0]
for bkmk in arcpy.mapping.ListBookmarks(mxd, data_frame=df):
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.extent = bkmk.extent
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFile = r"C:\Project\Output\\" + bkmk.name + ".jpg"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToJPEG(mxd, outFile, df)
del mxd
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can easily change that to export to PDF.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The next script shows you how to append many PDFs into a single PDF.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/#/PDFDocument/00s30000002w000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/#/PDFDocument/00s30000002w000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os

#Set file name and remove if it already exists
pdfPath = r"C:\Project\ParcelAtlasMapBook.pdf"
if os.path.exists(pdfPath):
&amp;nbsp;&amp;nbsp;&amp;nbsp; os.remove(pdfPath)

#Create the file and append pages
pdfDoc = arcpy.mapping.PDFDocumentCreate(pdfPath)
pdfDoc.appendPages(r"C:\Project\Title.pdf")
pdfDoc.appendPages(r"C:\Project\ParcelAtlas.pdf")

#Commit changes and delete variable reference
pdfDoc.saveAndClose()
del pdfDoc
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:29:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-pdf-bookmarks-to-pdf-pages-single-pdf/m-p/675580#M52304</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-12-12T04:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Export PDF Bookmarks to PDF Pages (single PDF)</title>
      <link>https://community.esri.com/t5/python-questions/export-pdf-bookmarks-to-pdf-pages-single-pdf/m-p/675581#M52305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;ListDataFrames was not new at 10.1. Maybe you are talking about ListBookmarks. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, sorry, that is what I meant.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This info looks like what I need...&amp;nbsp; Going to attempt to put it to work...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 17:39:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-pdf-bookmarks-to-pdf-pages-single-pdf/m-p/675581#M52305</guid>
      <dc:creator>DannyLackey</dc:creator>
      <dc:date>2014-02-27T17:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Export PDF Bookmarks to PDF Pages (single PDF)</title>
      <link>https://community.esri.com/t5/python-questions/export-pdf-bookmarks-to-pdf-pages-single-pdf/m-p/675582#M52306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So, focusing on the exporttopdf piece at the moment...&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
mxd = arcpy.mapping.MapDocument(r"I:\GIS_Workspace\MAP\Test.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
for bkmk in arcpy.mapping.ListBookmarks(mxd, data_frame=df):
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.extent = bkmk.extent
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFile = r"I:\GIS_Workspace\MAP\MAP.pdf\\" + bkmk.name + ".pdf"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, outFile, df)
del mxd
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The PDF isn't coming out looking like the book mark.&amp;nbsp; The image in the PDF is quite squished together.&amp;nbsp; Also, how can I specify a specific set of layers and specific bookmarks?&amp;nbsp; As it is now, it seems to output all layers and all bookmarks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:29:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-pdf-bookmarks-to-pdf-pages-single-pdf/m-p/675582#M52306</guid>
      <dc:creator>DannyLackey</dc:creator>
      <dc:date>2021-12-12T04:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Export PDF Bookmarks to PDF Pages (single PDF)</title>
      <link>https://community.esri.com/t5/python-questions/export-pdf-bookmarks-to-pdf-pages-single-pdf/m-p/675583#M52307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;for bkmk in arcpy.mapping.ListBookmarks(mxd,"Bookmark1",df):&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, I figured out that if I replace "data_frame" with the bookmark name, I can get it to produce just that bookmark.&amp;nbsp; But I need a specific list.&amp;nbsp; Just not sure how to make it produce each specific bookmark I need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And as for specific layers to produce, using "Layers" produces all.&amp;nbsp; But I'd like to be able to specify which layers under "Layers" output.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 18:29:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-pdf-bookmarks-to-pdf-pages-single-pdf/m-p/675583#M52307</guid>
      <dc:creator>DannyLackey</dc:creator>
      <dc:date>2014-02-27T18:29:11Z</dc:date>
    </item>
  </channel>
</rss>

