Created
September 13, 2017 22:59
-
-
Save kfatehi/5a358e39d8878d52f39cfc39656b1269 to your computer and use it in GitHub Desktop.
Generates a PDF from a barcode string for the Keyport Barcode Insert Raw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generates a PDF from a barcode string | |
# in the dimensions expected for a Keyport Barcode Insert | |
# https://www.mykeyport.com/barcode-insert | |
# You may need to set SYMBOLOGY and/or remove -c (checksum) | |
# depending on which barcode you're creating | |
SIZE="1.3x0.35" | |
UNITS="in" | |
SYMBOLOGY=${SYMBOLOGY:-"39"} | |
CODE="$1" | |
if [[ "$CODE" == "" ]]; then | |
echo "Usage: $(basename $0) '12345'" | |
exit -1 | |
else | |
rm /tmp/barcode.* | |
set -e | |
set -x | |
barcode -n -u $UNITS -o /tmp/barcode.ps -g $SIZE -e $SYMBOLOGY -b $CODE -c | |
ps2pdf /tmp/barcode.ps /tmp/barcode.pdf | |
rm /tmp/barcode.ps | |
echo "Generated /tmp/barcode.pdf" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment