Hi there,
Let me show you how to generate QR & Barcode in a Document
QR Code
-
Got to Studio or Click on the Magic Stick icon
-
Scroll to Template and Click + Add
-
Enter a name to the Template
-
Click Code
-
Type the QR Code as below:
{
clr.AddReference("ZXing")
clr.AddReference("System.Drawing")
from System import Convert
from ZXing import *
from System.IO import *
from System.Drawing.Imaging import ImageFormat
def printQR(content1):
content = content1.ToString()
writer = BarcodeWriter()
writer.Options.Height = 200
writer.Options.Width = 200
writer.Options.Margin = 0
writer.Format = BarcodeFormat.QR_CODE
bitmap = writer.Write(content)
memoryStream = MemoryStream()
bitmap.Save(memoryStream, ImageFormat.Jpeg)
memoryStream.Position = 0
byteBuffer = memoryStream.ToArray()
memoryStream.Close()
return Convert.ToBase64String(byteBuffer)
}
<div>
<div align="center">Generate QR Code</div>
<div align="center"><img style="border: 0.3pt solid black; width: 100px; height: 100px; padding-left: 2px;padding-top: 2px;" src="data:image/jpeg;base64,{printQR(entry['DocumentId'])}" /></div>
</div>
Note : {printQR(entry[‘DocumentId’])} this can be replaced with the field you need to display when scanning. The above code will display its Document ID
Output
Barcode
-
Got to Studio or Click on the Magic Stick icon
-
Scroll to Template and Click + Add
-
Enter a name to the Template
-
Click Code
-
Type the Code as below:
{
clr.AddReference("ZXing")
clr.AddReference("System.Drawing")
from System import Convert
from ZXing import *
from System.IO import *
from System.Drawing.Imaging import ImageFormat
content = entry['DocumentId']
writer = BarcodeWriter()
writer.Options.Height = 100
writer.Options.Width = 400
writer.Options.PureBarcode = True
writer.Format = BarcodeFormat.CODE_128
bitmap = writer.Write(content)
memoryStream = MemoryStream()
bitmap.Save(memoryStream, ImageFormat.Jpeg)
memoryStream.Position = 0
byteBuffer = memoryStream.ToArray()
memoryStream.Close()
base64String = Convert.ToBase64String(byteBuffer)
}
<div>
<div align="center">Generate Barcode</div>
<div align="center"><img height="30" src="data:image/jpeg;base64,{base64String}" /></div>
</div>
Output
Note: content = entry[‘DocumentId’] this can be replaced with the field you need to display when scanning. The above code will display its Document ID