Skip to content

Commit

Permalink
Add option to specify end in page range
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayak-mehta committed Aug 16, 2017
1 parent 861ed0b commit 9753889
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/camelot
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,15 @@ if __name__ == '__main__':
if args['--pages'] == '1':
p.append({'start': 1, 'end': 1})
else:
infile = PdfFileReader(open(filename, 'rb'), strict=False)
if args['--pages'] == 'all':
infile = PdfFileReader(open(filename, 'rb'), strict=False)
p.append({'start': 1, 'end': infile.getNumPages()})
else:
for r in args['--pages'].split(','):
if '-' in r:
a, b = r.split('-')
if b == 'end':
b = infile.getNumPages()
p.append({'start': int(a), 'end': int(b)})
else:
p.append({'start': int(r), 'end': int(r)})
Expand Down

0 comments on commit 9753889

Please sign in to comment.