QRCode generator for clojure.
Clojure
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/clj
test/clj
.gitignore
LICENSE
README.md
changelog.txt
project.clj

README.md

clj.qrgen

A Clojure library designed to generate QRCode wrapped java QRGen.

News

  • Released 0.4.0, upgrade qrgen to 0.2.0

Usage

Dependency in leiningen:

    [clj.qrgen "0.4.0"]

Use it:

(use 'clj.qrgen)

Create a QRCode from a text then save as a temporary file:

(as-file (from "hello world"))

Created with options:

;; override size and image type
(from "hello world" :size [250 250] :image-type JPG)
;; supply charset hint to ZXING
(from "hello world" :charset "utf-8")
;; supply error correction level hint to ZXING
(from "hello world" :correction L)
;; supply any hint to ZXING
(from "hello world" :hint {CHARACTER_SET "utf-8"})

Encode contact data as vcard using defaults:

(from (vcard "John Doe"
             :email "john.doe@example.org"
			 :address "John Doe Street 1, 5678 Doestown"
			 :title "Mister"
			 :company "John Doe Inc."
			 :phonenumber "1234"
			 :website "www.example.org"))

As InputStream( as ring response):

(as-input-stream (from "hello world"))

As OutputStream:

(as-output-stream (from "hello world"))

As byte array:

(as-bytes (from "hello world"))

Suppy own file name:

(as-file (from "hello world") "QRCode.png")

Work with clojure.java.io:

(require '[clojure.java.io :as io])
(io/file (from "hello world"))
(io/output-stream (from "hello world"))
(io/input-stream (from "hello world"))
(io/copy (io/file (from "hello world")) a-output-stream)

License

Copyright © 2014 dennis zhuang.

Distributed under the Eclipse Public License version 1.0