tsc_PrinterLabel

This class represents a single Label design for printing with the optional Label Printer connected to Trimble Access.

You can generate an instance from a tsc_LabelPrinter class.

Edit the label with the functions in this class and then return the label to the tsc_LabelPrinter for printing when desired.

To be successfully printed the label must have been generated by the printer and must have had StartLabel and EndLabel called upon it.

Currently only the ZebraP4T printer is supported and this uses the ZPL2 command language.

Links to the Zebra technical references:

ZPL II Volume 1

ZPL II Volume 2

Construction

Use tsc_LabelPrinter::InstantiateNewLabel to create a new instance on the heap - this will require deletion.

Destruction

virtual ~tsc_PrinterLabel ();

Public Methods

virtual void Clear ();

Remove all data from the label.

virtual bool StartLabel (int x, int y, const char* userStartString = NULL);

Required before printing, also defines label origin for following coordinates.  If you have additional commands they can be given is userStartString.

virtual bool EndLabel ();

Required before printing.

virtual bool PrintText (const char* theText, int x, int y, const char* font);

Print text at the specified location in the designated font.  If you do not know the font string format use GetDefaultTextFont. For ZPL2 commands the 'A' is prefixed for you.

virtual bool PrintBarcode (const char* theCode, int x, int y, const char* font);

Print a Barcode at the specified location in the designated font.  If you do not know the font string format use GetDefaultBarcodeFont. For ZPL2 commands the 'B' is prefixed for you.

virtual bool PrintBox (int x, int y, int w, int h, const char* details = NULL);

Print a box at the specified coordinates, if you have additional commands they will be followed.  For ZPL2 a border thickness of 3 would be given by a details value of "t3" (the leading comma is supplied by the interface).

virtual bool PrintImage (const tsc_Image& image, int destX, int destY, const tsc_LabelImageOptions& options);

Print an image in black & white at the specified location and scale.  Use white as the background (no-print) color.  Refer to the tsc_LabelImageOptions header definition for more choices about image presentation.  For the best results using graphics designed for the printer is recommended.

virtual tsc_String GetCommandLangauge ();

Retrieve the language the label commands are expected in. Currently "ZPL2".

virtual tsc_String GetDefaultTextFont ();

A default font for those unfamiliar with the command set.

virtual tsc_String GetDefaultBarcodeFont ();

A default barcode font for those unfamiliar with the command set.

virtual unsigned int GetXPixelsPerMm ();

How many pixels per millimeter you can expect when printing in the horizontal axis. Unlike most interface units this is in millimeters not SI meters.

virtual unsigned int GetYPixelsPerMm ();

How many pixels per millimeter you can expect when printing in the vertical axis. Unlike most interface units this is in millimeters not SI meters.

Direct data access

virtual bool WriteRawData (const char* data);

Append a command to the label.

virtual tsc_String GetAllRawData ();

Retrieve a copy of the entire label.  Note that this could be very large when images are involved.

virtual void SetAllRawData (const char* nullTerminatedData);

Replace the label commands with your custom format label.  Take care as no checking is performed.