Mapbook with Separate Left and Right layouts

Discussion created by maotseduck on Feb 21, 2013
Latest reply on May 31, 2013 by maotseduck
I've been working on a mapbook for awhile, and have two layouts (left.mxd and right.mxd)

I've been trying to use the script from ESRI that's supposed to mesh the two together, but I can't seem to get it to work.  Last night I started it before I left, and it looked like it was working, but when I came in this morning the map pages were basically wireframes of the actual pages (you can see the outlines of the dataframe, the scale bar, and the outlines of the various text boxes)

Can anyone help me de-bug my script or offer a better way to do this?

thanks!

import arcpy, os

# Create an output directory variable
#
outDir = r"C:\Laura GIS\maps\truck mapbooks\FINISHED"

# Create a new, empty pdf document in the specified output directory
#
finalpdf_filename = outDir + r"\FinalMB.pdf"
if os.path.exists(finalpdf_filename):
os.remove(finalpdf_filename)
finalPdf = arcpy.mapping.PDFDocumentCreate(finalpdf_filename)

# Add the title page to the pdf (skipping for now)
#
#finalPdf.appendPages(r"C:\temp\MBExample\ancillary_pages\TitlePage.pdf")
# Add the index map to the pdf
#
#finalPdf.appendPages(r"C:\temp\MBExample\maps\IndexMap.pdf")

# Create Facing Pages for the map book
# Create pages for left-hand side of the book
#
mxdPathLeft = r"C:\Laura GIS\maps\truck mapbooks\FINISHED\left.mxd"
tempMapLeft = arcpy.mapping.MapDocument(mxdPathLeft)

# Loop creates individual pdf's for odd numbered pages
#
for pgNumLeft in range(1, tempDDPLeft.pageCount + 1, 2):
temp_filename = r"C:\Laura GIS\maps\truck mapbooks\FINISHED\MB_" + \
str(pgNumLeft) + ".pdf"
if os.path.exists(temp_filename):
os.remove(temp_filename)
tempDDPLeft.exportToPDF(temp_filename, "RANGE", pgNumLeft)

# Create pages for right-hand side of the book
#
mxdPathRight = r"C:\Laura GIS\maps\truck mapbooks\FINISHED\right.mxd"
tempMapRight = arcpy.mapping.MapDocument(mxdPathRight)

# Loop creates individual pdf's for even numbered pages
#
for pgNumRight in range(2, tempDDPRight.pageCount + 1, 2):
temp_filename = r"C:\Laura GIS\maps\truck mapbooks\FINISHED\MB_" + \
str(pgNumRight) + ".pdf"
if os.path.exists(temp_filename):
os.remove(temp_filename)
tempDDPRight.exportToPDF(temp_filename, "RANGE", pgNumRight)

# Append right and left-hand pages together in proper order
#
for pgNum in range(1, tempDDPLeft.pageCount + 1):
print "Page", pgNum, "of", tempDDPLeft.pageCount
tempPDF = r"C:\Laura GIS\maps\truck mapbooks\FINISHED\MB_" + str(pgNum) + ".pdf"
finalPdf.appendPages(tempPDF)

# Update the properties of the final pdf
#
finalPdf.updateDocProperties(pdf_open_view="USE_THUMBS",
pdf_layout="SINGLE_PAGE")