Skip to content

Instantly share code, notes, and snippets.

@cindygis
Created August 18, 2015 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cindygis/ef95bf24bd680c1b22e5 to your computer and use it in GitHub Desktop.
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.
#
# @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.")
Copy link

ghost commented Jun 11, 2017

Hi, thanks this was useful. You're missing a second " after the .tif extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment