linux shell assemble PDF文件

时间:2014-08-21 19:00:54   收藏:0   阅读:227
 
daniel@daniel-mint ~/latex/linux/itext/daniel $ cat asm.sh 
header_start=0
header_len=15

xref_start=$(strings -a -t d $1 | grep -e "\bxref\b" | awk ‘{print $1}‘)
trailer_start=$(strings -a -t d $1 | grep -e "\btrailer\b" | awk ‘{print $1}‘)
#echo $xref_start
#echo $trailer_start

xref_len=$(echo "$trailer_start - $xref_start" | bc)
#echo $xref_len

header_dump=$(echo "$1" | sed -re ‘s/^(.*)\.pdf/asm\_\1\_header\.bin/g‘)
dd if=$1 of=$header_dump bs=1 skip=$header_start count=$header_len

xref_dump=$(echo "$1" | sed -re ‘s/^(.*)\.pdf/asm\_\1\_xref\.bin/g‘)
dd if=$1 of=$xref_dump bs=1 skip=$xref_start count=$xref_len

  

  

linux shell assemble PDF文件,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!