Skip to content

Instantly share code, notes, and snippets.

@jeremyruppel
Created August 12, 2013 03:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyruppel/6208154 to your computer and use it in GitHub Desktop.
Save jeremyruppel/6208154 to your computer and use it in GitHub Desktop.
Printing a QR code from the command line.
#!/usr/bin/env bash
##
# The dimensions for the physical QR code, in pixels.
# The Brother QL-570 Label Printer tape is 2.44" wide
# at 72ppi, and 72 * 2.44 = 175.68, so 175 is good.
size=175x175
##
# Usage: qrcode [url]
# Summary: Prints a QR code to the [url] on the default printer.
curl https://chart.googleapis.com/chart \
--data-urlencode chs=$size \
--data-urlencode cht=qr \
--data-urlencode chl=$1 \
--data-urlencode choe=UTF-8 | lp -o media=Custom.$size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment