This commit is contained in:
Geoffrey Frogeye 2020-01-21 21:39:21 +01:00
parent 5730632e5b
commit c12ae95001
3 changed files with 10 additions and 4 deletions

View file

@ -17,7 +17,7 @@ wdir_path="${orig_dir}/${wdir_file}"
if [ -d "$wdir_path" ]
then
echo "Source directory $wdir_path found"
ls "${wdir_path}/${orig_name}_"*"_og.pdf" | while read page_orig_path
ls "${wdir_path}/"*"_og.pdf" | while read page_orig_path
do
page_stmp_svg="$(echo "$page_orig_path" | sed 's|_og\.pdf$|_fg\.svg|')"
page_stmp_pdf="$(echo "$page_orig_path" | sed 's|_og\.pdf$|_fg\.pdf|')"
@ -33,9 +33,9 @@ then
fi
done
echo "Merging everything back to ${orig_path}."
pdftk "${wdir_path}/${orig_name}_"*"_fin.pdf" output "$orig_path"
pdftk "${wdir_path}/"*"_fin.pdf" output "$orig_path"
echo "Deleting temporary files."
rm "${wdir_path}/${orig_name}_"*"_fin.pdf" "${wdir_path}/${orig_name}_"*"_fg.pdf"
rm "${wdir_path}/"*"_fin.pdf" "${wdir_path}/"*"_fg.pdf"
echo "Done."
elif [ -f "$orig_path" ]
then
@ -47,7 +47,7 @@ then
echo "Creating source directory $wdir_path with original pages and template SVGs"
mkdir "$wdir_path"
pdftk "$orig_file" burst output "${wdir_path}/${orig_name}_%03d_og.pdf"
ls "${wdir_path}/${orig_name}_"*"_og.pdf" | while read page_orig_path
ls "${wdir_path}/"*"_og.pdf" | while read page_orig_path
do
page_stmp_svg="$(echo "$page_orig_path" | sed 's|_og\.pdf$|_fg\.svg|')"
echo "Processing $page_orig_path"