nithir revised this gist . Go to revision
1 file changed, 16 insertions
concat.py(file created)
| @@ -0,0 +1,16 @@ | |||
| 1 | + | #!/usr/bin/env python3 | |
| 2 | + | ||
| 3 | + | from sys import argv | |
| 4 | + | from os.path import basename | |
| 5 | + | import subprocess | |
| 6 | + | ||
| 7 | + | fichiers = [basename(x) for x in argv[1:]] | |
| 8 | + | ficout="_".join(fichiers).replace(' ','-').replace('.pdf','')+'.pdf' | |
| 9 | + | cmd = ['pdftk'] + argv[1:] + ['cat', 'output', ficout] | |
| 10 | + | ||
| 11 | + | process = subprocess.Popen(cmd, | |
| 12 | + | stdout=subprocess.PIPE, | |
| 13 | + | stderr=subprocess.PIPE) | |
| 14 | + | stdout, stderr = process.communicate() | |
| 15 | + | #print(stdout) | |
| 16 | + | #print(stderr) | |
Newer
Older