Created
August 12, 2013 03:56
-
-
Save jeremyruppel/6208154 to your computer and use it in GitHub Desktop.
Printing a QR code from the command line.
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
#!/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