linux下libreoffice对eps支持不好,再分享一下这个不错的脚本。
运行此脚本后,会将原EPS删除并重命名备份在 $HOME/local/bak 目录下。
#!/bin/bash
dir_bak=${HOME}/local/bak
dir_eps=${HOME}/local/bak/eps
if [ ! -d ${dir_bak} ]; then
mkdir -p ${dir_bak}
fi
if [ ! -d "${dir_eps}" ]; then
mkdir -p ${dir_eps}
fi
check=$(ls|grep eps)
if [ ! -z "${check}" ]; then
for fullfile in *.eps; do
filename="${fullfile%.*}"
extension="${fullfile##*.}"
# if [ ! -f ${filename}.svg ]; then
echo "${fullfile} --> ${filename}.svg"
ps2pdf -dEPSCrop ${fullfile} tmp.pdf
pdf2svg tmp.pdf ${filename}.svg
rm tmp.pdf
mv ${fullfile} ${dir_eps}
mv ${dir_eps}/${fullfile} ${dir_eps}/$(date +%y%m%d%H%M%S)_${fullfile}
# fi
done
fi
运行此脚本后,会将原EPS删除并重命名备份在 $HOME/local/bak 目录下。
#!/bin/bash
dir_bak=${HOME}/local/bak
dir_eps=${HOME}/local/bak/eps
if [ ! -d ${dir_bak} ]; then
mkdir -p ${dir_bak}
fi
if [ ! -d "${dir_eps}" ]; then
mkdir -p ${dir_eps}
fi
check=$(ls|grep eps)
if [ ! -z "${check}" ]; then
for fullfile in *.eps; do
filename="${fullfile%.*}"
extension="${fullfile##*.}"
# if [ ! -f ${filename}.svg ]; then
echo "${fullfile} --> ${filename}.svg"
ps2pdf -dEPSCrop ${fullfile} tmp.pdf
pdf2svg tmp.pdf ${filename}.svg
rm tmp.pdf
mv ${fullfile} ${dir_eps}
mv ${dir_eps}/${fullfile} ${dir_eps}/$(date +%y%m%d%H%M%S)_${fullfile}
# fi
done
fi