Created
August 18, 2015 07:47
-
-
Save cindygis/ef95bf24bd680c1b22e5 to your computer and use it in GitHub Desktop.
Converts a range of pages from a pdf to separate tiff files using the PDF to TIFF tool added at ArcGIS 10.3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# @date 18/08/2015 | |
# @author Cindy Williams | |
# | |
# Converts a range of pages from a pdf to separate tiff | |
# files using the PDF to TIFF tool added at ArcGIS 10.3. | |
# For very basic conversion, with minimal error handling. | |
# | |
# For use as a standalone script. | |
# | |
import arcpy | |
import os | |
def convertPDFtoTIFF(in_pdf, out_folder, out_tiff, start_page=1, end_page=1): | |
if start_page > end_page: | |
print("The start page number cannot exceed the end page number.") | |
else: | |
for i in range(start_page, end_page + 1): | |
out_tiff_name = os.path.join(out_folder, out_tiff + str(i) + ".tif) | |
arcpy.conversion.PDFtoTIFF(in_pdf, out_tiff_name, pdf_page_number=i) | |
print("Processed page " + str(i)) | |
pdf_in = r"C:\Some\Arb\Folder\test.pdf" | |
tif_folder = r"C:\Some\Arb\Folder\tiffs" | |
convertPDFtoTIFF(pdf_in,tif_folder, "Page_", 2,9) | |
print("Script complete.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks this was useful. You're missing a second " after the .tif extension.