Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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.")
@ghost

This comment has been minimized.

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
You can’t perform that action at this time.