The following code will print a Label with default text & QR Code image from saved image path on computer, but I need to add replace the text & QR image with a custom text & QR Image. I cannot find any examples online of the new SDK, there is a little reference on the GitHub but cant piece anything together to work.
I Installed NuGet package Dynmo.Connect.SDK
Imports DymoSDK.Implementations
Dim dymoSDKLabel As DymoSDK.Implementations.DymoLabel
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Dim SelectedPrinter As String = "DYMO LabelWriter 450"
Dim copies As Integer = 1
Dim barcodeGraphsQuality As Boolean = True
dymoSDKLabel = New DymoLabel()
dymoSDKLabel.LoadLabelFromFilePath("C:\Users\User\Documents\QR.dymo")
DymoPrinter.Instance.PrintLabel(dymoSDKLabel, SelectedPrinter, copies, barcodeGraphsQuality)
End Sub
I wanted to say that I figured out the answer to my own problem in case someone is wondering how. I created a label in Dymo Connect software program called label.dymo. I added a TextObject and a ImageObject to the label, positioned in the middle and saved the label. I installed a Free NuGet package called QRCoder and referenced it in this sample code below. The String Variable called id is coming from my database and is the row id for what was just created(last insert row id). The QrCode generates a QRCode matching my id variable and then converts it to base64string because that what format the Dymo ImageObject supports. You can replace the id variable with any number or text as you need for your project.
Imports DymoSDK.Implementations
Imports QRCoder
Dim dymoSDKLabel As DymoSDK.Implementations.DymoLabel
Dim LabelTextObject As DymoSDK.Interfaces.ILabelObject
Dim LabelQRObject As DymoSDK.Interfaces.ILabelObject
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Dim gen As New QRCodeGenerator
Dim data = gen.CreateQrCode(id, QRCodeGenerator.ECCLevel.Q)
Dim qrCode As New Base64QRCode(data)
Dim base64qrcode As String = qrCode.GetGraphic(20)
Dim SelectedPrinter As String = "DYMO LabelWriter 450"
Dim copies As Integer = 1
Dim barcodeGraphsQuality As Boolean = True
dymoSDKLabel = New DymoLabel()
dymoSDKLabel.LoadLabelFromFilePath("C:\Users\User\Documents\label.dymo")
LabelTextObject = dymoSDKLabel.GetLabelObject("TextObject")
dymoSDKLabel.UpdateLabelObject(LabelTextObject, id)
LabelQRObject = dymoSDKLabel.GetLabelObject("ImageObject")
dymoSDKLabel.UpdateLabelObject(LabelQRObject, base64qrcode)
DymoPrinter.Instance.PrintLabel(dymoSDKLabel, SelectedPrinter, copies, barcodeGraphsQuality)
End Sub