@@ -17,7 +17,7 @@ def merge_pdfs(input_files: list, page_range: tuple, output_file: str, bookmark:
17
17
for input_file in input_files :
18
18
bookmark_name = os .path .splitext (os .path .basename (input_file ))[0 ] if bookmark else None
19
19
# pages To control which pages are appended from a particular file.
20
- merger .append (fileobj = open (input_file , 'rb' ), pages = page_range , bookmark = bookmark_name )
20
+ merger .append (fileobj = open (input_file , 'rb' ), pages = page_range , import_bookmarks = False , bookmark = bookmark_name )
21
21
# Insert the pdf at specific page
22
22
merger .write (fileobj = open (output_file , 'wb' ))
23
23
merger .close ()
@@ -46,13 +46,11 @@ def parse_args():
46
46
if __name__ == "__main__" :
47
47
# Parsing command line arguments entered by user
48
48
args = parse_args ()
49
- # convert a single str to a list
50
- input_files = [str (x ) for x in args ['input_files' ][0 ].split (',' )]
51
49
page_range = None
52
50
if args ['page_range' ]:
53
51
page_range = tuple (int (x ) for x in args ['page_range' ][0 ].split (',' ))
54
52
# call the main function
55
53
merge_pdfs (
56
- input_files = input_files , page_range = page_range ,
54
+ input_files = args [ ' input_files' ] , page_range = page_range ,
57
55
output_file = args ['output_file' ], bookmark = args ['bookmark' ]
58
56
)
0 commit comments