Skip to content

Instantly share code, notes, and snippets.

@macbre
Last active December 16, 2020 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macbre/3c40dacfd4e23fb03c7695a5af75a070 to your computer and use it in GitHub Desktop.
Save macbre/3c40dacfd4e23fb03c7695a5af75a070 to your computer and use it in GitHub Desktop.
calendar
#!/bin/bash
export TMPDIR="${HOME}/.tmp"
mkdir -p $TMPDIR
FILES=$(ls *.svg | egrep '[0-9]\.')
DPI=400
# inkscape --file=12.svg --export-text-to-path --export-dpi=300 --export-pdf-version=1.5 --export-filename=pdf/12.pdf
for file in $FILES
do
dest=${file/.svg/.pdf}
echo "Converting $file to $dest ..."
inkscape --file=$file --export-text-to-path --export-dpi=${DPI} --export-pdf-version=1.5 --export-filename=pdf/$dest 2>/dev/null
done
# merge pages into a single file
FILES=$(ls pdf/*.pdf | tr "\n" ' ')
# https://askubuntu.com/questions/1041349/imagemagick-command-line-convert-limit-values
echo "Merging pages into a single file - ${FILES}..."
# convert -list resource
# cat /etc/ImageMagic-6/policy.xml
# https://github.com/ImageMagick/ImageMagick/issues/396
time convert -verbose -monitor \
-density ${DPI} \
-compress jpeg \
-quality 90 \
${FILES} \
calendar_2021.pdf
pdfinfo calendar_2021.pdf
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment