forked from stlehmann/pdftools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpdfsplit.py
More file actions
executable file
·46 lines (40 loc) · 1.43 KB
/
Copy pathpdfsplit.py
File metadata and controls
executable file
·46 lines (40 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
import sys
import argparse
from pdftools import pdf_split
from pdftools.parseutil import parentparser
def process_arguments(args):
parser = argparse.ArgumentParser(
parents=[parentparser],
description="Split a PDF file in multiple documents."
)
#input
parser.add_argument('input',
type=str,
default=None,
help='input file that shall be splitted')
#output
parser.add_argument('-o',
'--output',
type=str,
default=None,
help='filename of the output files')
#stepsize
parser.add_argument('-s',
'--stepsize',
dest='stepsize',
type=int,
default=1,
help='defines how many pages are packed in each output '
' file')
#sequence
parser.add_argument('-q',
'--sequence',
dest='sequence',
nargs='+',
help='sequence of numbers describing how many pages to '
'put in each outputfile')
return parser.parse_args(args)
if __name__ == "__main__":
args = process_arguments(sys.argv[1:])
pdf_split(args.input, args.output, args.stepsize, args.sequence)