Fallback to a page count of 1 when slate raise an Exception

This commit is contained in:
Roberto Rosario
2012-02-14 16:35:39 -04:00
parent 9f60cffd0a
commit f78b09229c

View File

@@ -30,7 +30,10 @@ class ConverterClass(ConverterBase):
# If file is a PDF open it with slate to determine the page
# count
with open(input_filepath) as fd:
pages = slate.PDF(fd)
try:
pages = slate.PDF(fd)
except:
return 1
return len(pages)
try: