Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 
share|improve this question
add comment

5 Answers

up vote 5 down vote accepted

Export Map Document to PDF is now included in the arcpy.mapping sample script tools

Source Code is available to Automate/Batch MXD for Export to PDF.

share|improve this answer
    
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
add comment

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.

share|improve this answer
    
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 Mar 11 '11 at 23:07
add comment

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

share|improve this answer
    
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
add comment

This is an old version for the previous 10.0 with an VBA. What about the 10.1 version that it is no longer using VBA . I have contacted the person who has the latest scipt and it runs like a magic !

share|improve this answer
    
How about providing a link and a description instead of just saying the latest version works with 10.1? –  user3461 Sep 3 '13 at 16:09
    
I will need to see if I can get a permission from him. –  PROBERT Sep 3 '13 at 16:14
    
Any update on the latest script? –  joebob Feb 4 at 22:02
    
didn't have much time looking into it. Sorry. –  PROBERT Feb 5 at 0:03
add comment

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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