PDF To TIFF (Production Mapping)
Resumen
Exports an existing PDF file to a Tagged Image File Format (TIFF). If the PDF has georeference information, the TIFF can be a GeoTIFF. These TIFFs can be used as a source for heads-up digitizing and viewing in ArcMap. Both OGC and ISO standards of georeferenced PDFs are supported.
Uso
-
Output TIFF File is populated after you populate Input PDF File, with the same path and name, but with a .tif extension.
PDF Password is optional, but if the PDF is protected, it becomes required.
If the PDF consists of more than one page, PDF Page Number lists the pages in the PDF. You will get an error if you try to enter an invalid page number.
PDF Page Number can only be one page; it cannot be a range of pages.
If the PDF doesn't contain a spatial reference, PDF Map and Write GeoTIFF Tags are disabled.
Sintaxis
Parámetro | Explicación | Tipo de datos |
in_pdf_file |
The path and name of the PDF file that is going to be converted into a TIFF. | File |
out_tiff_file |
The path and name of the output TIFF file. | Raster Dataset |
pdf_password (Opcional) |
If the PDF is password protected, then the tool requires an appropriate password for processing. Different passwords can be provided based on the security setting embedded in the PDF.
| Encrypted String |
pdf_page_number (Opcional) |
The page number that contain the content you want to export to TIFF. | Long |
pdf_map (Opcional) |
Lists each unique map inside the PDF page. In a PDF file, a map is a defined container of graphics on the PDF page that has a spatial reference. A PDF map is equivalent to an ArcMap data frame in that it is the container for spatial data. A PDF map may have one or more maps. For example, a page may have a main map and an additional smaller overview or key map. If the page does contain more than one map, the default is Largest and represents the largest page area in the PDF. The PDF Map is used for setting the output spatial reference of the TIFF, if the geotiff tags setting is enabled. The PDF Map is also used to define the extent of the output TIFF, if the Clip Output to Map option is enabled. | String |
clip_option (Opcional) |
Specifies what should be clipped/extracted.
| Boolean |
resolution (Opcional) |
A number that defines the resolution of the exported TIFF in DPI (dots per inch). The default is 250. | Long |
color_mode (Opcional) |
This value specifies the number of bits used to describe color. The default is RGB_TRUE_COLOR.
| String |
tiff_compression (Opcional) |
This value represents a compression scheme. The default is LZW.
| String |
geotiff_tags (Opcional) |
If the PDF contains a spatial reference, you can choose to add GeoTIFF tags.
| Boolean |
Ejemplo de código
This sample runs the required parameters using an ISO PDF.
import arcpy
# Check out Production Mapping extension
arcpy.CheckOutExtension("foundation")
#Define variables
inPDF = r'C:\Project\export.pdf'
outTIFF = r'C:\Project\export.tif'
#Export PDF to GeoTIFF
arcpy.PDFtoTIFF_production(inPDF, outTIFF)
This sample loops through each page of a multi-page OGC PDF, exports each page with some optional parameters set, and finally builds pyramids and calculates statistics on each tif.
import arcpy
import os
# Check out Production Mapping extension
arcpy.CheckOutExtension("foundation")
# Define variables
inPDF = r'C:\Project\OGC_DDP.pdf'
outTIFF = r'C:\Project\TIFFs'
# Create PDFDocument Object from inPDF
pdf = arcpy.mapping.PDFDocumentOpen(inPDF)
# Loop through each page in the PDF and create a name based on the page number
for page in range(1, pdf.pageCount+1):
name = str(page) + ".tif"
outTIFFpath = os.path.join(outTIFF, name)
# Export each page to TIFF using 96 DPI, CMYK color mode, and JPEG compression
arcpy.PDFtoTIFF_production(inPDF, outTIFFpath, '#', str(page), '#', '#', 96, 'CMYK_TRUE_COLOR', 'JPEG')
# Build pyramids and calculate statistics on each output TIFF
arcpy.BuildPyramidsandStatistics_management(outTIFF)
print "Exported " + outTIFFpath
print "Done"