Export/print multiple layouts

9579
8
Jump to solution
02-19-2015 04:17 PM
MikeLouwrens
Occasional Contributor III

I'm working on a project which I thought would be perfect for using (learning) ArcGIS Pro.  I have multiple map layouts created, but it appears I can only export or print them one at a time.  Is there a way to output them all in one go?  Particularly exported all into a single PDF?

Thanks,

Mike.

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

If you would like to use some Python code you probably could: Getting started with the arcpy.mp tutorial—ArcPy | ArcGIS for Professionals

Example to export 1 layout from Introduction to arcpy.mp—ArcPy | ArcGIS for Professionals :

import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Projects\YosemiteNP\Yosemite.aprx")
lyt = aprx.listLayouts("Main Attractions*")[0]
lyt.exportToPDF(r"C:\Project\YosemiteNP\Output\Yosemite.pdf", resolution = 300)

You will probably have to loop through the layouts and export it to a pdf and then merge the pdf files.

a sample can be found here: PDFDocumentCreate—ArcPy | ArcGIS for Professionals

View solution in original post

8 Replies
XanderBakker
Esri Esteemed Contributor

If you would like to use some Python code you probably could: Getting started with the arcpy.mp tutorial—ArcPy | ArcGIS for Professionals

Example to export 1 layout from Introduction to arcpy.mp—ArcPy | ArcGIS for Professionals :

import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Projects\YosemiteNP\Yosemite.aprx")
lyt = aprx.listLayouts("Main Attractions*")[0]
lyt.exportToPDF(r"C:\Project\YosemiteNP\Output\Yosemite.pdf", resolution = 300)

You will probably have to loop through the layouts and export it to a pdf and then merge the pdf files.

a sample can be found here: PDFDocumentCreate—ArcPy | ArcGIS for Professionals

MikeLouwrens
Occasional Contributor III

Xander Bakker wrote:

If you would like to use some Python code you probably could: Getting started with the arcpy.mp tutorial—ArcPy | ArcGIS for Professionals

You will probably have to loop through the layouts and export it to a pdf and then merge the pdf files.

a sample can be found here: PDFDocumentCreate—ArcPy | ArcGIS for Professionals

Hi Xander,

thanks for your reply.  I haven't attempted Python in ArcGIS Pro yet, but I will give that a try and see how I get on.

Cheers,

Mike.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Let me know if you run into some problems. I can run some tests here I necessary.

0 Kudos
MikeLouwrens
Occasional Contributor III

Thanks Xander, this does what I need.  Packaged it to make the PDFs and merge them into one as required.  Much appreciated.

Cheers,

Mike.

0 Kudos
DanHofer
New Contributor II

I need to export multiple layouts in one swoop.  I don't need them merged.  I'm not a coder.  Could I get some baby step instructions on what to do?  I'm pretty good at modifying code once I have it.   I'm brand new to ArcGIS Pro 2.0.1

Recommended courses?  The one above no longer works.

Thank you,

Dan

0 Kudos
XanderBakker
Esri Esteemed Contributor

The link that did not work should point to a new location: Tutorial: Getting started with arcpy.mp—ArcPy | ArcGIS Desktop .

Maybe something on Map Series might be interesting: Create a map series—Layouts | ArcGIS Desktop 

0 Kudos
DanHofer
New Contributor II

Thank you.  I did the tutorial: Getting Stated with Arcpy.mp like you suggested.  I made it through.  whew.

I also mistyped, each layout HAS a map series.  25 layouts with unique names and each series is about 50 pages (Our 50 States).

Any more suggestions on exporting each layouts map series (not combined).  I've googled it and I'm just not seeing anything.

0 Kudos
XanderBakker
Esri Esteemed Contributor

I just had a look to see if Map Series can be automated with arcpy in ArcGIS Pro, but it appears that it is not possible yet. See this comment: https://community.esri.com/thread/197174-export-map-series-pages#comment-704124  

Not very recommendable, but if your map is not to complex one could loop through the layouts like this:

import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Projects\YosemiteNP\Yosemite.aprx")
for lyt in aprx.listLayouts("*"):
    # loop through states
        # change the map extent based on the states
        lyt.exportToPDF(r"C:\Project\YosemiteNP\Output\SomeUnique.pdf", resolution = 300)

During the loop loop through the extents of the states and change for instance a title bases on the name of the state. 

I published a document a few years ago on how to do this (but it is in Spanish):

Python en ArcGIS Pro - CCU2015.pdf  

It starts on page 58. Page 61 shows code on how to loop through extents of features and zoom to them and page 62 shows how to create a PDF and append pages (you could for instance create a PDF per layout or a PDF per map).