Skip to main content

CreateExportFormat

Summary

The CreateExportFormat function creates an export format object and is used with the export method to generate the appropriate output export file.

Discussion

Once the export format object is generated, you may need to modify properties in order to properly format the desired output. To create the output export file, you need to pass the export format object into the format parameter on the export method which is available to multiple classes: BookmarkMapSeries, Layout, MapFrame, MapSeries, MapView, and Report.

Syntax

CreateExportFormat(format, {file_path})

Parameter Explanation Data Type

format

The list of supported export formats is as follows:

  • AIX—Adobe Illustrator Exchange

  • BMP—Microsoft Windows Bitmap

  • EMF—Windows Enhanced Metafile

  • EPS—Encapsulated PostScript

  • GIF—Graphic Interchange Format

  • JPEG—Joint Photographic Experts Group

  • PDF—Portable Document Format

  • PNG—Portable Network Graphics

  • SVG—Scalable Vector Graphics

  • TGA—Truevision Graphics Adapter

  • TIFF—Tagged Image File Format

String

file_path

The full system path, file name, and extension for the resulting export file.

Note:

This value does not need to be set initially but does need to be set before exporting to an output export file.

The default value is None.

String

Return value

Data Type Explanation

Object

The resulting export format object is based on the specified format value. The possible classes are: AIXFormat, BMPFormat, EMFFormat, EPSFormat, GIFFormat, JPEGFormat, PDFFormat, PNGFormat, SVGFormat, TGAFormat, and TIFFFormat.

Code sample

CreateExportFormat example

The following script first exports a layout to PDF using all default values. It then configures the PDFFormat properties to create another PDF with a smaller file size. Before the script exports a second time, it modifies the original output filePath so you can compare the file sizes of the newly generated PDFs.

p = arcpy.mp.ArcGISProject('current')
lyt = p.listLayouts()[0]

pdf = arcpy.mp.CreateExportFormat('PDF', r'C:\Temp\PDF_output1.pdf')
lyt.export(pdf)                            #Export using default value

pdf.clipToElements = True                  #Default is False
pdf.embedColorProfile = False              #Default is True
pdf.embedFonts = False                     #Default is True
pdf.georefInfo = False                     #Default is True
pdf.outputAsImage = True                   #Default is False
pdf.imageCompressionQuality = 10           #Default is 80
pdf.resolution = 50                        #Default is 96
pdf.setImageQuality('FASTEST')             #Default os BEST
pdf.setLayersAndAttributes('NONE')         #Default is LAYERS_ONLY
pdf.filePath = r'C:\Temp\PDF_output2.pdf'  #Override filePath from original

lyt.export(pdf)                            #Export to smaller PDF