Export Report To PDF (Data Management)

Summary

Exports an ArcGIS Pro report or a report file (.rptx) to a .pdf file.

Learn more about reports

Usage

  • If a query exists in the report or report file definition, additional expressions are appended to the existing query.

  • This tool supports page range settings to export certain pages in addition to the entire report.

  • This tool supports custom page numbering options to modify start and total page numbers.

Parameters

LabelExplanationData Type
Input Report

The input report or .rptx file.

Report; File
PDF File

The output .pdf file.

File
Expression
(Optional)

A SQL expression that will be used to select a subset of records. This expression is applied in addition to any existing expressions.

SQL Expression
Resolution (DPI)
(Optional)

The resolution of the output .pdf file in dots per inch (dpi).

Long
Image Quality
(Optional)

Specifies the output image quality of the PDF. The image quality option controls the quality of exported rasterized data.

  • BestThe highest available image quality will be used. This is the default.
  • BetterHigh image quality will be used.
  • NormalA compromise between image quality and speed will be used.
  • FasterLower image quality will be used to generate the report faster.
  • FastestThe lowest image quality will be used to create the report the fastest.
String
Embed Fonts
(Optional)

Specifies whether fonts will be embedded in the output .pdf file. Font embedding allows text and markers built from font glyphs to be displayed correctly when the .pdf file is viewed on a computer that does not have the necessary fonts installed.

  • Checked—Fonts will be embedded in the output .pdf file. This is the default.
  • Unchecked—Fonts will not be embedded in the output .pdf file.
Boolean
Compress Vector Graphics
(Optional)

Specifies whether vector graphics will be compressed.

  • Checked—Vector graphics will be compressed. Use this option unless clear text is wanted for troubleshooting. This is the default.
  • Unchecked—Vector graphics will not be compressed.

Boolean
Image Compression
(Optional)

Specifies the compression scheme that will be used to compress image or raster data in the output .pdf file.

  • No image compressionImage or raster data will not be compressed.
  • Run-length encoded (RLE) compressionImage or raster data will be compressed using run-length encoded compression.
  • Deflate compressionImage or raster data will be compressed using deflate, a lossless data compression.
  • Lempel-Ziv-Welch (LZW) compressionImage or raster data will be compressed using Lempel-Ziv-Welch, a lossless data compression.
  • Joint Photographic Experts Group (JPEG) compressionImage or raster data will be compressed using JPEG, a lossy data compression.
  • Adaptive compressionImage or raster data will be compressed using adaptive compression, which will automatically select the best compression type for each image on the page. JPEG will be used for large images with many unique colors. Deflate will be used for all other images. This is the default.
String
Password Protect
(Optional)

Specifies whether a password will be needed to view the output .pdf file.

  • Checked—The output .pdf file will require a password to open.
  • Unchecked—The output .pdf file can be opened without providing a password. This is the default.

Boolean
PDF Password
(Optional)

The password that will be required to open the .pdf file.

Encrypted String
Page Range Type
(Optional)

Specifies the page range of the report that will exported.

  • All pagesAll pages will be exported. This is the default.
  • Last pageOnly the last page will be exported.
  • Odd numbered pagesOnly the odd numbered pages will be exported.
  • Even numbered pagesOnly the even numbered pages will be exported.
  • Custom page rangeA custom page range will be exported using the Custom Page Range parameter value.
String
Custom Page Range
(Optional)

The pages that will be exported when the Page Range Type parameter is set to Custom page range. You can set individual pages, ranges, or a combination of both separated by commas, such as 1, 3-5, 10.

String
Initial Page Number
(Optional)

The initial page number that will be used to create a page numbering offset to add more pages to the beginning of the report.

Long
Final Page Number
(Optional)

The page number that will be displayed on the last page of the output .pdf file.

Long
Show Selection Symbology
(Optional)

Specifies whether selection symbology will be included when exporting a report with a map frame and selected features in the source map.

  • Checked—Selection symbology will be included in the output .pdf file. This is the default.
  • Unchecked—Selection symbology will not be included in the output .pdf file.

Boolean

arcpy.management.ExportReportToPDF(in_report, out_pdf_file, {expression}, {resolution}, {image_quality}, {embed_font}, {compress_vector_graphics}, {image_compression}, {password_protect}, {pdf_password}, {page_range_type}, {custom_page_range}, {initial_page_number}, {final_page_number}, {selection_symbology})
NameExplanationData Type
in_report

The input report or .rptx file.

Report; File
out_pdf_file

The output .pdf file.

File
expression
(Optional)

A SQL expression that will be used to select a subset of records. This expression is applied in addition to any existing expressions.

SQL Expression
resolution
(Optional)

The resolution of the output .pdf file in dots per inch (dpi).

Long
image_quality
(Optional)

Specifies the output image quality of the PDF. The image quality option controls the quality of exported rasterized data.

  • BESTThe highest available image quality will be used. This is the default.
  • BETTERHigh image quality will be used.
  • NORMALA compromise between image quality and speed will be used.
  • FASTERLower image quality will be used to generate the report faster.
  • FASTESTThe lowest image quality will be used to create the report the fastest.
String
embed_font
(Optional)

Specifies whether fonts will be embedded in the output .pdf file. Font embedding allows text and markers built from font glyphs to be displayed correctly when the .pdf file is viewed on a computer that does not have the necessary fonts installed.

  • EMBED_FONTSFonts will be embedded in the output .pdf file. This is the default.
  • NO_EMBED_FONTSFonts will not be embedded in the output .pdf file.
Boolean
compress_vector_graphics
(Optional)

Specifies whether vector graphics will be compressed.

  • COMPRESS_GRAPHICSVector graphics will be compressed. Use this option unless clear text is wanted for troubleshooting. This is the default.
  • NO_COMPRESS_GRAPHICSVector graphics will not be compressed.
Boolean
image_compression
(Optional)

Specifies the compression scheme that will be used to compress image or raster data in the output .pdf file.

  • NONEImage or raster data will not be compressed.
  • RLEImage or raster data will be compressed using run-length encoded compression.
  • DEFLATEImage or raster data will be compressed using deflate, a lossless data compression.
  • LZWImage or raster data will be compressed using Lempel-Ziv-Welch, a lossless data compression.
  • JPEGImage or raster data will be compressed using JPEG, a lossy data compression.
  • ADAPTIVEImage or raster data will be compressed using adaptive compression, which will automatically select the best compression type for each image on the page. JPEG will be used for large images with many unique colors. Deflate will be used for all other images. This is the default.
String
password_protect
(Optional)

Specifies whether a password will be needed to view the output .pdf file.

  • PASSWORD_PROTECTThe output .pdf file will require a password to open.
  • NO_PASSWORD_PROTECTThe output .pdf file can be opened without providing a password. This is the default.
Boolean
pdf_password
(Optional)

The password that will be required to open the .pdf file.

Encrypted String
page_range_type
(Optional)

Specifies the page range of the report that will exported.

  • ALLAll pages will be exported. This is the default.
  • LASTOnly the last page only will be exported.
  • ODDOnly odd numbered pages will be exported.
  • EVENOnly even numbered pages will be exported.
  • CUSTOMA custom page range will be exported using the custom_page_range parameter value.
String
custom_page_range
(Optional)

The pages that will be exported when the page_range_type parameter is set to CUSTOM. You can set individual pages, ranges, or a combination of both separated by commas, such as 1, 3-5, 10.

String
initial_page_number
(Optional)

The initial page number that will be used to create a page numbering offset to add more pages to the beginning of the report.

Long
final_page_number
(Optional)

The page number that will be displayed on the last page of the output .pdf file.

Long
selection_symbology
(Optional)

Specifies whether selection symbology will be included when exporting a report with a map frame and selected features in the source map.

  • SELECTION_SYMBOLOGYSelection symbology will be included in the output .pdf file. This is the default.
  • NO_SELECTION_SYMBOLOGYSelection symbology will not be included in the output .pdf file.
Boolean

Code sample

ExportReportToPDF example 1 (Python window)

The following Python window script demonstrates how to use the ExportReportToPDF function.

import arcpy
arcpy.management.ExportReportToPDF('C:/data/sample.rptx', 'C:/data/samplePDF.pdf', 
                                   'STATEFIPS = 42', 96, 'BETTER', 'EMBED_FONTS', 
                                   'COMPRESS_GRAPHICS', 'ADAPTIVE', 
                                   'PASSWORD_PROTECT', 'password', 'CUSTOM', 
                                   '1-10')
ExportReportToPDF example 2 (stand-alone script)

Use the ExportReportToPDF function to export a report after performing a selection on the data source.

# Import system variables
import arcpy

# Set the workspace
arcpy.env.workspace = 'C:/data/cities.gdb'

# Set local variables
in_layer = 'cities'
in_report = 'US Cities Report'
out_PDF = 'C/data/cities.pdf'

# Modify the report data source by selecting only the records where 
# POP1990 < 50000
arcpy.management.SelectLayerByAttribute(in_layer, 'NEW_SELECTION', 
                                        'POP1990 < 50000')

# Export the report with the layer selection set
arcpy.management.ExportReportToPDF(in_report, out_PDF)
ExportReportToPDF example 3 (stand-alone script)

Use the arcpy.mp module in addition to the ExportReportToPDF function.

# Import system variables
import arcpy

# Identify all parcel reports in a project
aprx = arcpy.mp.ArcGISProject('C:/data/parcels/Parcels.aprx')
report = aprx.listReports('Parcels Report')[0]

# Export the report with a definition query
arcpy.management.ExportReportToPDF(report.name, 'C:/data/parcels/ParcelsPDF.pdf', 
                                   ' "LotSize" > 325 ')

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics