Multi-page pdfs running incredibly slow (from arcpy.mapping)

2908
7
03-07-2011 12:29 PM
TannerSemerad
New Contributor II
I'm using a script that exports over 700 pages and combines them into a multi-page pdf. The pdf runs incredibly slow every time I export it, regardless of the file size, or even if there are fewer pages. I have tried adjusting the resolution and image quality, but it still runs slow.

By "running slow" I mean that it takes just under a minute for the file to fully open, and it freezes for 20 or 30 seconds each time I scroll from page to page. The pdf runs this horribly on our other computers where I work as well, and they are all powerful machines.

I tried saving it as an "Optimized" pdf in Acrobat, and although it reduced the file size by a third, it didn't improve the speed. I know that the number of pages shouldn't be the issue because we have created the same multi-page pdf in the past manually without a script, and it runs fine.

Has anyone found a solution to this?
0 Kudos
7 Replies
JeffBarrette
Esri Regular Contributor
Please clarify - does this only happens when you export via a script?  If you perform the same export via the user interface (file-->export) do you experience the same performance issue?

If so, are you using:
arcpy.mapping.ExportToPDF?
or
mapDoc.dataDrivenPages.exportToPDF?

Thanks,
Jeff
0 Kudos
TannerSemerad
New Contributor II
I just tested it manually and with a script, and it appears that any multi-page pdf suffers slowdown in relation to the number of pages. I tested exporting using arcpy.mapping.ExportToPDF and appending each page to a single pdf document, as well as just choosing "Export -> All Pages" to create a pdf of all pages in Data Driven Pages. Both methods result in a slower PDF than if I had combined the pages manually using Acrobat, and the higher the number of pages, the slower the PDF.

I believe there is an inefficiency in the way that ArcMap creates multi-page pdfs, unless there is something I'm missing.
0 Kudos
OliveDodd
New Contributor
What is the difference between
arcpy.mapping.ExportToPDF?
and
mapDoc.dataDrivenPages.exportToPDF?

I am also trying to export to PDF and find the script seems to 'never finish' with 84 pages.
Also, how do I only export a page range instead of all pages.
Also, how do I export each page to a separate pdf.
Thanks
0 Kudos
JeffBarrette
Esri Regular Contributor
arcpy.mapping.ExportToPDF exports a single pdf based on the current MXD.  It does not take into consideration that the MXD is DDP enabled.

DDP.exportToPDF allows you to print multiple PDfs from a single DDP enabled map doc.

Also, how do I only export a page range instead of all pages: Use DDP.exportToPDF.  Set page_range_type="RANGE", set page_range_string to equal the pages you want printed (e.g., "1-5, 8, 10").  Read the help for details.

Also, how do I export each page to a separate pdf: Use the {multiple_files parameter}.  Read the help for details.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/DataDrivenPages/00s300000030000000/

Jeff
0 Kudos
GroundHogg
New Contributor
I tried both export methods, slow, slow, slow....until bug in my code was found -

you might check for unneccasry loops in your python script: I was getting molasses slow exports, then found that there was a loop that was looping through all my points when it should have just selected a single one in the cursor. (I had left off the actual query string and all records were selected for an update procedure on the map elements).

it still worked, but was so slow I thought about dumping the whole thing.

I realize that's not much help, but something to look for.  Now my exports are about 72 x faster (number of pages in my map book).
0 Kudos
JeffBarrette
Esri Regular Contributor
We reproduced this issue an will hopefully be able to address it in the next service pack.

It appears to be related to the output file size.  Anything over 1GB will not work or open correctly.

If you want to check its status, it is: NIM067258
0 Kudos
JeffBarrette
Esri Regular Contributor
This issue will be fixed for service pack 3.
0 Kudos