stevekershaw
stevekershaw

Reputation: 145

How do I programatically print to a label printer in windows 7 using C#

I'm using Visual Studio 2013 (#C) and I have a SATO CL4NX label printer attached through a USB cable on Windows 7. My problem is that I have been given the task of writing a winform application that will take user input and then print it on the CL4NX printer. That means that I have to access the printer driver API and send data and receive status information from the printer.

I haven't a clue how to do this!? Never done it before! Can somebody point me in the right direction?

Thanks Steve

Upvotes: 0

Views: 6149

Answers (2)

T McKeown
T McKeown

Reputation: 12847

Most Label printers have a proprietary printing language (Zebra had ZPL and there was Intermec), my experience was to use a label design tool like Label Matrix and design the label, then put label fields in the label with text values like $DESC$ and $ADDR1$ etc... Then in the software choose your barcode printer and print to FILE. Take that file and then read it using C#, you'll have a string have the label code. replace the $ADDR1$ with the actual address values, then simply print to a TEXT print driver so the label codes are sent as raw text.

Upvotes: 1

Derek Tomes
Derek Tomes

Reputation: 4007

Take a look at the PrintDocument class.

This will allow you to pick which printer to print to (your application can remember its name). It'll allow you to set up paper size and decide where and what to print.

It'll manage talking to the print driver for you and has the advantage that it'll work with other printers as well.

Upvotes: 1

Related Questions