9

Nico Burgerhart made a fantastic script called "Batch export MXD to PDF" back in 2008. http://arcscripts.esri.com/details.asp?dbid=14872 Any ideas how to implement it in ArcGIS 10? Something using Python perhaps? Data Driven Pages does not have anything comparable that i could find.

Here's the steps in read me text file which doesn't jive with ArcGIS 10's new menu bar:

Tool: Batch export MXD to PDF
Purpose: Saves all MXDs in the selected directory to PDFs in the selected output folder
Author: Nico Burgerhart (nicoburgerhart@hotmail.com)
Date: 31 Jan. 2007
INSTALLATION NOTES
------------------
1. Open ArcMap
2. Select Tools > Macro's > Visual Basic Editor
3. Select File > Import file
4. Import BatchExportMXDToPDF.bas
5. Select File > Close and Return to ArcMap
6. Select Tools > Macro's > Macro's
7. Select the BatchExportMXDToPDF mactro
8. Click Run 
7

Export Map Document to PDF is now included in the arcpy.mapping module

Pith of code sample from Esri KB How To: Export map documents to PDF using Python:

for mxd in mxd_list:

    current_mxd = arcpy.mapping.MapDocument(os.path.join(ws, mxd))
    pdf_name = mxd[:-4] + ".pdf"
    arcpy.mapping.ExportToPDF(current_mxd, pdf_name)

For a more extended Toolbox example see Export MXD to PDF courtesy of @bteranUFA

  • Thanks Mapperz, lots of good ones there look like.... keep getting Invalid Mxd filename error for some reason when using 'Export Map Document to PDF', any ideas? screen shot: i.imgur.com/fOaGp.jpg – sirgeo Mar 11 '11 at 22:28
  • Do you have spaces or special characters in your .mxd? – Mapperz Mar 13 '11 at 2:19
  • yes.... spaces, underscores, and a hyphen. Here's a few examples: PLR11001200_1101A-BO.mxd 1101A_ LT 314.mxd 1101A_BB 300B.mxd 1101A_BO.mxd Do you think i need to take out the spaces and hyphens? i'll give it shot tomorrow morning when i go into work to do some overtime. – sirgeo Mar 13 '11 at 4:58
  • 1
    Thanks Mapperz.... It indeed works fine after removing all the spaces, underscores, and hyphens. – sirgeo Mar 13 '11 at 20:55
  • 1
    An extra link (@Mapperz's link is not working anymore) : support.esri.com/technical-article/000012420 – gisnside Sep 13 '16 at 7:56
1

Looks like this is a VBA module. If you install VBA with ArcGIS 10 you should be able to run it just the same. (VBA is still supported, but will not be in the next release.) Better approach would be to re-write this as an add-on.

  • Thanks Jakub, is there a link with step by step instructions on how to install VBA with ArcGIS 10? any suggestion on how to re-write as an add-on? – sirgeo Mar 11 '11 at 22:46
  • 1
    You will need a license file from ESRI and VBA installer is one of the items on the main installation DVD. As for the Add-In (sorry not Add On) there is a bit of learning curve with VB .NET but it's well worth the effort. Here is a link for the walkthrough: help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/… – Jakub Sisak GeoGraphics Mar 11 '11 at 23:07
1

Add the script to a toolbox, then setup two paramters by right clicking on the script tool and typing in the display named like below image and picking data type of folder like in below image: enter image description here

#Export a folder of maps to PDFs at their Map Document set sizes
#Written using ArcGIS 10 and Python 2.6.5
#by: Guest

import arcpy, os

#Read input parameter from user.
path = arcpy.GetParameterAsText(0)

#Write MXD names in folder to txt log file.
writeLog=open(path+"\FileListLog.txt","w")
for fileName in os.listdir(path):
    fullPath = os.path.join(path, fileName)
    if os.path.isfile(fullPath):
        basename, extension = os.path.splitext(fullPath)
        if extension == ".mxd":
            writeLog.write(fullPath+"\n")
            mxd = arcpy.mapping.MapDocument(fullPath)
            print fileName + "\n"
del mxd
print "Done"
writeLog.close()


exportPath =arcpy.GetParameterAsText(1)
MXDread=open(path+"\FileListLog.txt","r")
for line in MXDread:
    #Strip newline from line.
    line=line.rstrip('\n')
    if os.path.isfile(line):
        basename, extension = os.path.splitext(line)
        newName=basename.split('\\')[-1]
        if extension.lower() == ".mxd":
            print "Basename:" +newName
            mxd = arcpy.mapping.MapDocument(line)
            newPDF=exportPath+"\\"+newName+".pdf"
            print newPDF
            arcpy.mapping.ExportToPDF(mxd,newPDF)
            print line + "Export Done"
MXDread.close()
item=path+"\FileListLog.txt"
os.remove(item)
del mxd
0

Look in this set of GP tools on the ESRI Resource Center, there may be something in there for exporting to PDF in batch.

  • like minds - same link as me. – Mapperz Mar 11 '11 at 22:18
  • Thanks Chad, i keep getting Invalid Mxd filename error for some reason when using 'Export Map Document to PDF', any ideas? screen shot: i.imgur.com/fOaGp.jpg – sirgeo Mar 11 '11 at 22:45
  • @Mapperz - D'OH! My mistake! – Chad Cooper Mar 12 '11 at 14:33
  • keep getting Invalid Mxd filename error when using 'Export Map Document to PDF', any ideas? screen shot: i.imgur.com/fOaGp.jpg – sirgeo Mar 12 '11 at 16:24
0

Building on the contributions of @Guest and @bteranUFA I've put together a python script and toolbox. It exports all MXD from an input folder to an output location.

From here download ArcPlus.tbx and Scripts\ExportFolder2PDF.py and save somewhere useful, then read the usage notes if needed.

protected by Community Aug 18 '15 at 14:56

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.