Sample code for 30+ languages & platforms
Classic ASP Requires Chilkat v11.7.0+

QR Codes for Email, Phone, SMS and Location

See more QR Code Examples

Demonstrates QR codes that start an action on a phone. A QR code only holds text, and what happens on scanning depends on the form of that text: mailto: starts an email, tel: dials a number, SMSTO: starts a text message, and geo: opens a map at a latitude and longitude. A web address opens in the browser.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

'  This example requires the Chilkat API to have been previously unlocked.
'  See Global Unlock Sample for sample code.

set fmt = Server.CreateObject("Chilkat.Formats")
set json = Server.CreateObject("Chilkat.JsonObject")
set jsonOut = Server.CreateObject("Chilkat.JsonObject")
success = json.UpdateInt("render.moduleSize",6)
success = json.UpdateBool("output.overwrite",1)
success = json.UpdateString("output.return","none")

'  An email, with the address and optionally a subject.  Spaces in the subject are written %20.
success = json.UpdateString("payload.text","mailto:support@example.com?subject=Order%2012345")
success = json.UpdateString("output.path","qa_output/qr_email.png")
success = fmt.QrCode("generate",json,jsonOut)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( fmt.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "email: version " & jsonOut.IntOf("symbols[0].selectedEncoding.version") & ", " & jsonOut.StringOf("outputs[0].path")) & "</pre>"

'  image

'  A phone number to dial, in international form.
success = json.UpdateString("payload.text","tel:+15555550100")
success = json.UpdateString("output.path","qa_output/qr_phone.png")
success = fmt.QrCode("generate",json,jsonOut)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( fmt.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "phone: version " & jsonOut.IntOf("symbols[0].selectedEncoding.version") & ", " & jsonOut.StringOf("outputs[0].path")) & "</pre>"

'  image

'  A text message: the number, then the message.
success = json.UpdateString("payload.text","SMSTO:+15555550100:Please call me back")
success = json.UpdateString("output.path","qa_output/qr_sms.png")
success = fmt.QrCode("generate",json,jsonOut)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( fmt.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "sms: version " & jsonOut.IntOf("symbols[0].selectedEncoding.version") & ", " & jsonOut.StringOf("outputs[0].path")) & "</pre>"

'  image

'  A location: latitude, then longitude, in degrees.
success = json.UpdateString("payload.text","geo:41.8781,-87.6298")
success = json.UpdateString("output.path","qa_output/qr_location.png")
success = fmt.QrCode("generate",json,jsonOut)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( fmt.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "location: version " & jsonOut.IntOf("symbols[0].selectedEncoding.version") & ", " & jsonOut.StringOf("outputs[0].path")) & "</pre>"

'  image

'  Sample output:

'  email: version 4, qa_output/qr_email.png
'  phone: version 2, qa_output/qr_phone.png
'  sms: version 3, qa_output/qr_sms.png
'  location: version 2, qa_output/qr_location.png

%>
</body>
</html>