add scripts

This commit is contained in:
Andrey Kuvshinov
2020-04-23 14:42:01 +03:00
parent 749a0b316f
commit 9dbe78fae1
5 changed files with 37 additions and 3 deletions

19
scripts/splitpdf.sh Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
WORKDIR=~/arlemp/vhosts/anpdf/app/pub/files
PDFDIR=$WORKDIR/pdf
OUTDIR=$WORKDIR/pages
cd $PDFDIR
for file in *.pdf;
do
name="${file%.pdf}"
PGEDIR="$OUTDIR/$name"
if [ ! -d "$PGEDIR" ]; then
mkdir -p $PGEDIR
docker run --name pdftk -it --rm --user $(id -u):$(id -g) -v "$WORKDIR:/workdir$WORKDIR" -w "/workdir$WORKDIR" masterforweb/pdftk pdftk "pdf/$file" burst output "pages/${name}/${name}-%02d.pdf";
fi
done