PDFM과 이미지를 식별하고 ImageMagick을 사용하여 이미지를 PDF로 변환 할 수 있습니다. 작업을 마치면 pdftk로 모든 것을 조합합니다.
이것은 Bash 전용 스크립트입니다.
#!/bin/bash
# Convert arguments into list
N=0
for file in $*; do
files[$N]=$file
N=$[ $N + 1 ]
done
# Last element of list is our destination filename
N=$[ $N - 1 ]
LAST=$files[$N]
unset files[$N]
N=$[ $N - 1 ]
# Check all files in the input array, converting image types
T=0
for i in $(seq 0 $N); do
file=${files[$i]}
case ${file##*.} in
jpg|png|gif|tif)
temp="tmpfile.$T.pdf"
convert $file $temp
tmp[$T]=$temp
uses[$i]=$temp
T=$[ $T + 1 ]
# Or also: tmp=("${tmp[@]}" "$temp")
;;
pdf)
uses[$i]=$file
;;
esac
done
# Now assemble PDF files
pdftk ${uses[@]} cat output $LAST
# Destroy all temporary file names. Disabled because you never know :-)
echo "I would remove ${tmp[@]}"
# rm ${tmp[@]}
감사합니다. 대답은 Apple 기본 명령 줄에 있습니다. http://stackoverflow.com/questions/4778635/merging-png-images-into-one-pdf-file-in-unix –