Skip to content

Instantly share code, notes, and snippets.

@kfatehi
Created September 13, 2017 22:59
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 kfatehi/5a358e39d8878d52f39cfc39656b1269 to your computer and use it in GitHub Desktop.
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
#!/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