Combine multiple PDF files with serial numbers into one.
--Python (2.7.9 here, but anything is fine.) --ghostscript (GS command below) --Sequential number pdf file ――It doesn't have to be a serial number, but if it is a serial number, the configuration is easy.
#!/usr/bin/env python
import commands,os
list = commands.getoutput("ls *.pdf").split("\n")
prm = ""
for i in range(len(list)):
prm = prm + " " + list[i]
cmd = "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=all.pdf"+prm
print cmd
commands.getoutput(cmd)
There is a for sentence in one place, but I'm sure there is an easier way ... (End.)
$ brew pull https://github.com/Homebrew/homebrew/pull/25953
$ brew install pdftk
[Reference](http://linux.just4fun.biz/?%E9%80%86%E5%BC%95%E3%81%8DUNIX%E3%82%B3%E3%83%9E%E3%83% B3% E3% 83% 89% 2F% E8% A4% 87% E6% 95% B0PDF% E3% 83% 95% E3% 82% A1% E3% 82% A4% E3% 83% AB% E3% 82% 921% E3% 81% A4% E3% 81% AEPDF% E3% 83% 95% E3% 82% A1% E3% 82% A4% E3% 83% AB% E3% 81% AB% E3% 81% BE% E3% 81% A8% E3% 82% 81% E3% 82% 8B% E6% 96% B9% E6% B3% 95% E3% 83% BBgs% E3% 82% B3% E3% 83% 9E% E3% 83% B3% E3% 83% 89)
Recommended Posts