I need to export to PDF with some parameters, and I went through the help and it only explains the data frame portion. When I need the entire map or layout view. Here is what I need:

1.400 dpi resolution

2.Embed all document fonts

3.The maps are 36x48 if that matters.

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project1.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Entire Map?",)[0] #What is the zero for, frames?
arcpy.mapping.ExportToPDF(mxd, r"C:\Project\Output\Project1.pdf", df)

del mxd
  • 1
    Welcome to GIS SE, when you mean "entire map" are you referring to the layout view? – artwork21 Feb 14 '14 at 20:34

As discussed in the online help,

To export a single data frame instead of the entire page layout, pass a DataFrame object to the function's data_frame parameter.

so in your code:

df = arcpy.mapping.ListDataFrames(mxd, "Entire Map?",)[0] #What is the zero for, frames?

"Entire Map?" should be replaced with "PAGE_LAYOUT".

A variable that references a DataFrame object. Use the string/constant "PAGE_LAYOUT" to export the map document's page layout instead of an individual data frame. (The default value is PAGE_LAYOUT)

(taken directly from the online help from the "data frame" parameter).

If you are just trying to export a single data frame, then you should use the name of the data frame you want to export, typically Layers by default.

[0] refers to the first data frame that matches the criteria you set.


[0] mean you export want the first dataframe. In your case you don't need to specify the dataframe because you seem to be interested in the full layout, so you can skip this line.

here is the command with the list of parameters, in bold you can change the dpi's and ask for embedded font. :

ExportToPDF (map_document, out_pdf, {data_frame}, {df_export_width}, {df_export_height}, {resolution}, {image_quality}, {colorspace}, {compress_vectors}, {image_compression}, {picture_symbol}, {convert_markers}, {embed_fonts}, {layers_attributes}, {georef_info}, {jpeg_compression_quality})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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