summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/qrbill/qrbill-latexluaqrcode.lua
blob: b1c31c2c6449a425a1e9cb1a0a98a406d8a9821f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
qrencode = require("qrencode.lua")

function printQRcode(codestring)
	local ok, tab = qrencode.qrcode(codestring, 2)
	local count = 0
	local tabstr = ""
	local qrrows = ""
	if ok then
		for k,v in pairs(tab) do

			count = count + 1 
			for t,s in pairs(v) do
				if s > 0 then
					tabstr=tabstr.."\\qrblack"
				else
					tabstr=tabstr.."\\qrwhite"
				end
			end
			qrrows=tabstr.."\\qrnewline"..qrrows
			tabstr=""
		end	
	end
	return count, qrrows
end