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

Create a vCard (Contact) QR Code

See more QR Code Examples

Demonstrates a QR code that adds a contact to a phone when scanned. The text is a vCard, the standard format for contact details: lines between BEGIN:VCARD and END:VCARD, each ending with CRLF. A vCard is fairly long, so the symbol is larger than one holding a web address. Leave out the fields that are not needed to keep it small.

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.

'  The second argument of AppendLine is cktrue to end each line with CRLF.
set sbCard = Server.CreateObject("Chilkat.StringBuilder")
success = sbCard.AppendLine("BEGIN:VCARD",1)
success = sbCard.AppendLine("VERSION:3.0",1)
success = sbCard.AppendLine("N:Smith;Alex;;;",1)
success = sbCard.AppendLine("FN:Alex Smith",1)
success = sbCard.AppendLine("ORG:Example Company",1)
success = sbCard.AppendLine("TITLE:Sales Manager",1)
success = sbCard.AppendLine("TEL;TYPE=CELL:+1-555-0100",1)
success = sbCard.AppendLine("EMAIL:alex.smith@example.com",1)
success = sbCard.AppendLine("URL:https://www.example.com",1)
success = sbCard.AppendLine("END:VCARD",1)

set json = Server.CreateObject("Chilkat.JsonObject")
success = json.UpdateSb("payload.text",sbCard)
success = json.UpdateInt("render.moduleSize",6)
success = json.UpdateString("output.path","qa_output/qr_vcard.png")
success = json.UpdateBool("output.overwrite",1)
success = json.UpdateString("output.return","none")

set fmt = Server.CreateObject("Chilkat.Formats")
set jsonOut = Server.CreateObject("Chilkat.JsonObject")
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( "vCard length: " & sbCard.Length) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( "QR version: " & jsonOut.IntOf("symbols[0].selectedEncoding.version")) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( "modules: " & jsonOut.IntOf("symbols[0].dimensions.modulesWide") & " x " & jsonOut.IntOf("symbols[0].dimensions.modulesHigh")) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( "image: " & jsonOut.IntOf("outputs[0].width") & " x " & jsonOut.IntOf("outputs[0].height") & " pixels") & "</pre>"

'  The image written to qa_output/qr_vcard.png:

'  image

'  Sample output:

'  vCard length: 197
'  QR version: 10
'  modules: 57 x 57
'  image: 390 x 390 pixels

%>
</body>
</html>