VB.net, SDK, connect to ZD420, print/fill out label templates

Hello all!

I just bought a ZD420t label printer that we want to use in our company.

We already have a printer (other brand) that I can access via an SDK and I've written a VB.net software to load a label file and fill out the variable text fields and also QR codes.

Now I want to do that using the ZD420t. I've created labels and named the all elements I want to fill out using my VB.net software, installed the zebra.printer.sdk - but how do I open the printer (USB, NOT LAN), load the label and submit the data to the the desired elements?

I looked at the code examples, but I don't know any C language, I also don't find how to access/connect the USB printer or load a label.

(the other printer I mentioned had vb.net examples available and it was really easy to achieve results in no time)

Can anyone point me to the right direction or show me examples of how to do that?

I've already searched the community, googled for hours, but now  I am kinda desperate

Many thanks in advance,

Robert

Dmitry Prokhorov
Hello Robert,Here you can see

Hello Robert,

Here you can see an FormatUtil Interface​ usage example that is implemented on C#.Net. Using this example you can implement it in the same way on VB.Net, using same classes and methods. The only thing you need to change is to use UsbConnection class constructor instead of TcpConnection class constructor used in example. Use configured name of your printer as a parameter for UsbConnection class constructor.

Also, you can use Zebra designer to export your label format to the printer. This way you can use it later with "^XF" ZPL command to print a label.

Hope it helps.

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Robert Olschewski
Hello Dmitry!Thanks for your

Hello Dmitry!

Thanks for your reply!

Mmmh, like I said, I don't speak C# (I'm not a software engineer, all I know about programming is self-taught), but I think I got the connection part done.

I guess I have to use the printer name I find in "devices and printer" in the Windows control panel as string and open the connection.

But in your example I only see labels that have been stored on the printer. Is it possible to load them from a folder that's located on the PC?

Also, the vars dictionary: I can not use the names of the elements on a label? The element names, for example, are "text1" or "QR_serial".

I think the integer numbers (11, 12) in the example code relate to the ZPL code (FN11, FN12) and I can not use string element names.

Loading the .lbl file, replacing the text elements with the actual content and then print is not possible with the SDK?

We can not store every label on the printer, they need to be on the PC that has the connection to the printer.

Is there any solution for this?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Dmitry Prokhorov
Hello Robert!Yes, you really

Hello Robert!

Yes, you really need to use the printer name you find in "devices and printer" in the Windows control panel as string parameter value for UsbConnection constructor. You don't need to speak C#, you need just to look at it for used classes and methods. It's pretty much obvious in mentioned example code. Then you need to implement it in the same way using same classes and methods on VB.net.

In case you don't need to use label formats that are stored on printer seems there is a more simple approach for you. You need just read your .zpl file from your PC folder to some string variable and then use PrinterUtil.SendContents method​​ to send your label to printer. It also requires a value of connection string. You can refer this description of connection string format​ to create a value for your printer.

Before sending your ZPL label format to printer you will need to append ZPL commands that will set values for label elements. See ZPL programming guide​ for details​ on how to refer elements and how to set values.

So yes, it is possible to load your label file, assign some values and send it to the printer. Because printer is unable to print content of .lbl files you will need to capture ZPL code of your labels first as described in this article: Capture Printer Output to a File using the ZebraDesigner Driver .

Hope it helps.

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Robert Olschewski
Thank you, I will look into

Thank you, I will look into that

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Robert, I can help write

Hi Robert, I can help write some samples, but I'm not sure what kind of label file you have.  Can you share a version?  There are a lot of options for what kind of labels you can print so it would be useful.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Robert Olschewski
Hello Robin,thanks you for

Hello Robin,

thanks you for your reply!

Do you see the SAMPLE.LBL in the label examples folder?

It looks like

Sample

-----------

[barcode]

[rectangle]

Element name of "Sample" is Text1

Element name of the barcode is Barcode1

For example: I would like to change the word "Sample" of Text1 to "Test!" and also change the value of Barcode1 with values I enter in textboxes in my vb.net program and then print the whole thing.

Basically I am replacing a non-Zebra label printer with a ZD420t and now I have to recreate all the labels we use in at my workplace to be able to print them on the new printer (some of them also have logos/images, but these images will not be changed with the vb.net program).

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jeffrey Baker
Dmitry, can you direct me to

Dmitry, can you direct me to where I can download the SDK that includes the VB.NET DLL library?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Dmitry Prokhorov
Hello Jeffrey,I have

Hello Jeffrey,

I have installed Link OS SDK on my windows computer and I able to see following files inside of SDK root directory:

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\ConnectionPanel.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\ConnectionPanel.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\ConnectivityDemoForm.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\ConnectivityDemoForm.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\DeveloperDemoForm.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\DeveloperDemoForm.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\DiscoveryDemoForm.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\DiscoveryDemoForm.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\ImagePrintDemoForm.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\ImagePrintDemoForm.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\ListFormatsDemoForm.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\ListFormatsDemoForm.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\MagCardDemoForm.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\MagCardDemoForm.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\My Project\AssemblyInfo.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\My Project\Resources.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\PrinterStatusDemoForm.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\PrinterStatusDemoForm.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\SendFileDemoForm.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\SendFileDemoForm.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\SignatureCaptureDemoForm.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\SignatureCaptureDemoForm.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\SmartCardDemoForm.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\SmartCardDemoForm.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\StoredFormatDemoForm.Designer.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\StoredFormatDemoForm.vb

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\VbDevDemos.vbproj

windows_mobile_ce\v1.1.123\demos\src\vs2008_solution\DeveloperDemosVisualBasic\ZebraForm.vb

Those files are samples targeted for WinMobile and WinCE platforms but they are using the same Link OS SDK/API and I suppose they can be used as examples for VB.Net development on Windows PC.

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments