Classic ASP Requires Chilkat v11.7.0+
Classic ASP
Generate a QR Code with the Barcode Method
See more QR Code Examples
Demonstrates the Barcode method, which is the general form of QrCode: the request names the symbology, and everything else is the same. QrCode is Barcode with the symbology already set to qr, and identical requests to the two methods give identical results. A program that will produce more than one kind of barcode can use Barcode for all of them.Chilkat Classic ASP Downloads
<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 json = Server.CreateObject("Chilkat.JsonObject")
success = json.UpdateString("symbology","qr")
success = json.UpdateString("payload.text","https://www.chilkatsoft.com/")
success = json.UpdateString("output.path","qa_output/qr_from_barcode.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.Barcode("generate",json,jsonOut)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( fmt.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "symbology: " & jsonOut.StringOf("symbols[0].symbology")) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( "QR version: " & jsonOut.IntOf("symbols[0].selectedEncoding.version")) & "</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_from_barcode.png:
'
' Barcode requires the symbology. QrCode does not.
set json2 = Server.CreateObject("Chilkat.JsonObject")
success = json2.UpdateString("payload.text","https://www.chilkatsoft.com/")
success = fmt.Barcode("generate",json2,jsonOut)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( "without a symbology: " & jsonOut.StringOf("errors[0].code") & " at " & jsonOut.StringOf("errors[0].path")) & "</pre>"
End If
' Sample output:
' symbology: qr
' QR version: 3
' image: 148 x 148 pixels
' without a symbology: missingOption at /symbology
%>
</body>
</html>