mkinvoice/qrbill.sh

40 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
mydir="$(dirname $0)"
if [ -z "${INVNO}" ]; then
echo "ERROR: INVNO must be set as ENV variable"
exit 1
fi
echo "INVNO: ${INVNO}"
# should be called with following arguments (example)
# INVNO must be set as ENV variable
# --account "CH92 0023 5235 5662 3601 G"
# --amount 123.00
# --creditor-name "nbit Informatik GmbH"
# --creditor-street "Kirchweg 2"
# --creditor-postalcode "3510"
# --creditor-city "Konolfingen"
# --extra-infos "Rechnung Nummer ${INVNO}"
# --debtor-name "Wilhelm Tell"
# --debtor-street "Marktgasse 28"
# --debtor-postalcode "9400"
# --debtor-city "Rorschach"
# --due-date "2019-10-31"
# --language "de"
qrbill "$@" --output ${mydir}/temp/${INVNO}.svg
if [ $? -ne 0 ]; then
echo "ERROR: cannot create qrbill image"
exit 2
fi
#convert ${mydir}/temp/${INVNO}.svg ${mydir}/qr-images/${INVNO}.jpg
#inkscape ${mydir}/temp/${INVNO}.svg --export-width=794 --export-height=397 --export-filename ${mydir}/qr-images/${INVNO}.png
inkscape ${mydir}/temp/${INVNO}.svg --export-dpi=300 --export-filename ${mydir}/qr-images/${INVNO}.png
#cairosvg ${mydir}/temp/${INVNO}.svg -o ${mydir}/qr-images/${INVNO}.png
if [ $? -eq 0 ]; then
rm ${mydir}/temp/${INVNO}.svg
fi