Class ZPLPrinter
It represents a virtual printer emulator that can process ZPL (Zebra Programming Language) commands generating the output rendering in well known raster image and document formats like PNG, JPG, PDF and more.
Inheritance
Inherited Members
Namespace: Neodynamic.SDK.ZPLPrinter
Assembly: cs.temp.dll.dll
Syntax
public class ZPLPrinter : IDisposable
Constructors
ZPLPrinter(String, String)
Initializes a new instance of the ZPLPrinter class.
Declaration
public ZPLPrinter(string licenseOwner, string licenseKey)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | licenseOwner | The License Owner. |
| System.String | licenseKey | The License Key. |
Properties
AntiAlias
Gets or sets whether anti-aliasing rendering is enabled. Default is true;
Declaration
public bool AntiAlias { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
BackgroudImageBase64
Gets or sets the label's background image from a string in Base64 format. Image format mut be PNG or JPG.
Declaration
public string BackgroudImageBase64 { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
BackgroudImageBinary
Gets or sets the label's background image from a byte array buffer. Image format mut be PNG or JPG.
Declaration
public byte[] BackgroudImageBinary { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Byte[] |
BackgroudImageFile
Gets or sets the label's background image from a file path. Image format mut be PNG or JPG.
Declaration
public string BackgroudImageFile { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
BackgroudImageUrl
Gets or sets the label's background image from a URL. Image format mut be PNG or JPG.
Declaration
public string BackgroudImageUrl { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Description
Gets or sets the Description for this ZPLPrinter instance. Default is an empty string.
Declaration
public string Description { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Dpi
Gets or sets the printer resolution in DPI (Dots per inch) value. Default is 203.
Declaration
public float Dpi { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
Real/physical printer devices are usually 152, 203, 300 or 600 dpi. The DPI value to be set must match the value for which the ZPL commands to be processed were created.
DrawRFID
Gets or sets whether a RFID image must be drawn on the label. Default is true.
Declaration
public bool DrawRFID { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
The RFID will be drawn if any supported RFID commands are found in the label.
ForceLabelHeight
Gets or sets whether the LabelHeight property value must override the ^LL command. Default is false.
Declaration
public bool ForceLabelHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ForceLabelWidth
Gets or sets whether the LabelWidth property value must override the ^PW command. Default is false.
Declaration
public bool ForceLabelWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
LabelBackColor
Gets or sets the label's background color in hex notation. Default is #fff (White).
Declaration
public string LabelBackColor { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The Color Hex notation is as follows #[AA]RRGGBB where A, R, G, B refers to Aplha, Red, Green and Blue pixels. The following options would also be valid: #RGB or #ARGB (in this short format all channel values must be the same), #RRGGBB or #AARRGGBB. Note: # is optional and can be omitted.
LabelHeight
Gets or sets the default label width in Dots units. Default is 1218 Dots which represents 6in at 203dpi.
Declaration
public float LabelHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
LabelWidth
Gets or sets the default label width in Dots units. Default is 802 Dots which represents 4in at 203dpi.
Declaration
public float LabelWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Name
Gets or sets the Name for this ZPLPrinter instance. Default is an empty string.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
PdfMetadataAuthor
Gets or sets the PDF Metadata Author attribute.
Declaration
public string PdfMetadataAuthor { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
PdfMetadataCreator
Gets or sets the PDF Metadata Creator attribute.
Declaration
public string PdfMetadataCreator { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
PdfMetadataProducer
Gets or sets the PDF Metadata Producer attribute.
Declaration
public string PdfMetadataProducer { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
PdfMetadataSubject
Gets or sets the PDF Metadata Subject attribute.
Declaration
public string PdfMetadataSubject { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
PdfMetadataTitle
Gets or sets the PDF Metadata Title attribute.
Declaration
public string PdfMetadataTitle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
RenderOutputFormat
Gets or sets the image or document format for the output rendering process. Default is PNG.
Declaration
public RenderOutputFormat RenderOutputFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| RenderOutputFormat |
RenderOutputRotation
Gets or sets the rotation for the output rendering process. Default is None.
Declaration
public RenderOutputRotation RenderOutputRotation { get; set; }
Property Value
| Type | Description |
|---|---|
| RenderOutputRotation |
RibbonColor
Gets or sets the label's ribbon color in hex notation. Default is #000 (Black).
Declaration
public string RibbonColor { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The Color Hex notation is as follows #[AA]RRGGBB where A, R, G, B refers to Aplha, Red, Green and Blue pixels. The following options would also be valid: #RGB or #ARGB (in this short format all channel values must be the same), #RRGGBB or #AARRGGBB. Note: # is optional and can be omitted.
ThumbnailSize
Gets or sets the thumbnail size in pixel unit. Default is 0 (zero) which means thumbnail generation is disabled.
Declaration
public int ThumbnailSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
WatermarkImageBase64
Gets or sets the label's watermark image from a string in Base64 format. Image format mut be PNG or JPG.
Declaration
public string WatermarkImageBase64 { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
WatermarkImageBinary
Gets or sets the label's watermark image from a byte array buffer. Image format mut be PNG or JPG.
Declaration
public byte[] WatermarkImageBinary { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Byte[] |
WatermarkImageFile
Gets or sets the label's watermark image from a file path. Image format mut be PNG or JPG.
Declaration
public string WatermarkImageFile { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
WatermarkImageUrl
Gets or sets the label's watermark image from a URL. Image format mut be PNG or JPG.
Declaration
public string WatermarkImageUrl { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
WatermarkOpacity
Gets or sets the label's watermark image opacity level. Values range from 0 to 100.
Declaration
public int WatermarkOpacity { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
AddFont(String, Stream)
Adds a new font to the internal printer storage.
Declaration
public void AddFont(string fontName, Stream fontStream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fontName | The font name in the following format: [DRIVE:][NAME][.EXTENSION] [DRIVE:] The drive letter (R:, E:, B:, or A:). [NAME] The font name must be 1 to 8 alphanumeric characters. [.EXTENSION] The font extension must be set to |
| Stream | fontStream | The font stream. |
AddFont(String, Byte[])
Adds a new font to the internal printer storage.
Declaration
public void AddFont(string fontName, byte[] fontBuffer)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fontName | The font name in the following format: [DRIVE:][NAME][.EXTENSION] [DRIVE:] The drive letter (R:, E:, B:, or A:). [NAME] The font name must be 1 to 8 alphanumeric characters. [.EXTENSION] The font extension must be set to |
| System.Byte[] | fontBuffer | The byte array content of the font. |
AddFont(String, String)
Adds a new font to the internal printer storage.
Declaration
public void AddFont(string fontName, string fontFilePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fontName | The font name in the following format: [DRIVE:][NAME][.EXTENSION] [DRIVE:] The drive letter (R:, E:, B:, or A:). [NAME] The font name must be 1 to 8 alphanumeric characters. [.EXTENSION] The font extension must be set to |
| System.String | fontFilePath | The font file path. |
AddGraphic(String, Stream)
Adds a new graphic to the internal printer storage.
Declaration
public void AddGraphic(string graphicName, Stream graphicStream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | graphicName | The graphic name in the following format: [DRIVE:][NAME][.EXTENSION] [DRIVE:] The drive letter (R:, E:, B:, or A:). [NAME] The graphic name must be 1 to 8 alphanumeric characters. [.EXTENSION] The graphic extension must be set to |
| Stream | graphicStream | The graphic stream. Supported image formats: PNG, JPG, GIF. |
AddGraphic(String, Byte[])
Adds a new graphic to the internal printer storage.
Declaration
public void AddGraphic(string graphicName, byte[] graphicBuffer)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | graphicName | The graphic name in the following format: [DRIVE:][NAME][.EXTENSION] [DRIVE:] The drive letter (R:, E:, B:, or A:). [NAME] The graphic name must be 1 to 8 alphanumeric characters. [.EXTENSION] The graphic extension must be set to |
| System.Byte[] | graphicBuffer | The byte array content of the graphic. Supported image formats: PNG, JPG, GIF. |
AddGraphic(String, String)
Adds a new graphic to the internal printer storage.
Declaration
public void AddGraphic(string graphicName, string graphicFilePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | graphicName | The graphic name in the following format: [DRIVE:][NAME][.EXTENSION] [DRIVE:] The drive letter (R:, E:, B:, or A:). [NAME] The graphic name must be 1 to 8 alphanumeric characters. [.EXTENSION] The graphic extension must be set to |
| System.String | graphicFilePath | The graphic file path. Supported image formats: PNG, JPG, GIF. |
Dispose()
Releases all resources used by the ZPLPrinter.
Declaration
public void Dispose()
Implements
FontExists(String)
Determines whether the specified font name exists in the internal printer storage.
Declaration
public bool FontExists(string fontName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fontName | The font name. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the specified font name exists; otherwsie false. |
GetFonts()
Gets the list of fonts available in the internal printer storage.
Declaration
public List<string> GetFonts()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.String> | The list of fonts available in the internal printer storage. |
GetGraphic(String)
Gets a buffer image (in PNG format) of the specified graphic name from the internal printer storage.
Declaration
public byte[] GetGraphic(string graphicName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | graphicName | The graphic name. |
Returns
| Type | Description |
|---|---|
| System.Byte[] | a buffer image (in PNG format) if the specified graphic name exists; otherwsie null. |
GetGraphics()
Gets the list of graphics available in the internal printer storage.
Declaration
public List<string> GetGraphics()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.String> | The list of graphics available in the internal printer storage. |
GraphicExists(String)
Determines whether the specified graphic name exists in the internal printer storage.
Declaration
public bool GraphicExists(string graphicName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | graphicName | The graphic name. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the specified graphic name exists; otherwsie false. |
PowerOnReset()
Performs a power-on clearing the internal buffers for commands, fonts, and graphics.
Declaration
public void PowerOnReset()
ProcessCommands(Byte[])
Processes the ZPL commands contained into the specified array of bytes buffer.
Declaration
public List<byte[]> ProcessCommands(byte[] zplCommands)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | zplCommands | The array of bytes containing the ZPL commands to be processed. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Byte[]> | Returns the output rendering process in the format specified to RenderOutputFormat property. |
Remarks
The array of bytes containing the ZPL commands is supposed to be encoded with CodePage or Encoding 850 (Latin Character Set).
The returned list of byte arrays will contain a single array if PDF format was specified or; one or more arrays for other formats like PNG, JPG or PCX. If more than one labels are rendered and if the output format is PDF, then a single multipage file is returned. For image formats, then the list will contain as many arrays as labels.
ProcessCommands(Byte[], Encoding)
Processes the ZPL commands contained into the specified array of bytes buffer and using the specified Encoding or CodePage.
Declaration
public List<byte[]> ProcessCommands(byte[] zplCommands, Encoding textEncoding)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | zplCommands | The array of bytes containing the ZPL commands to be processed. |
| System.Text.Encoding | textEncoding | The Encoding or CodePage of the buffer content. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Byte[]> | Returns the output rendering process in the format specified to RenderOutputFormat property. |
Remarks
The returned list of byte arrays will contain a single array if PDF format was specified or; one or more arrays for other formats like PNG, JPG or PCX. If more than one labels are rendered and if the output format is PDF, then a single multipage file is returned. For image formats, then the list will contain as many arrays as labels.
ProcessCommands(String)
Processes the ZPL commands contained into the specified string.
Declaration
public List<byte[]> ProcessCommands(string zplCommands)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | zplCommands | The string containing the ZPL commands to be processed. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Byte[]> | Returns the output rendering process in the format specified to RenderOutputFormat property. |
Remarks
The string containing the ZPL commands is converted to an array of bytes prior processing it. That conversion will use CodePage or Encoding 850 (Latin Character Set).
The returned list of byte arrays will contain a single array if PDF format was specified or; one or more arrays for other formats like PNG, JPG or PCX. If more than one labels are rendered and if the output format is PDF, then a single multipage file is returned. For image formats, then the list will contain as many arrays as labels.
ProcessCommands(String, Encoding)
Processes the ZPL commands contained into the specified string and using the specified Encoding or CodePage.
Declaration
public List<byte[]> ProcessCommands(string zplCommands, Encoding textEncoding)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | zplCommands | The string containing the ZPL commands to be processed. |
| System.Text.Encoding | textEncoding | The Encoding or CodePage of the string content. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Byte[]> | Returns the output rendering process in the format specified to RenderOutputFormat property. |
Remarks
The returned list of byte arrays will contain a single array if PDF format was specified or; one or more arrays for other formats like PNG, JPG or PCX. If more than one labels are rendered and if the output format is PDF, then a single multipage file is returned. For image formats, then the list will contain as many arrays as labels.
ProcessCommandsFromFile(String)
Processes the ZPL commands contained into the specified file.
Declaration
public List<byte[]> ProcessCommandsFromFile(string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filePath | The file path containing the ZPL commands to be processed. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Byte[]> | Returns the output rendering process in the format specified to RenderOutputFormat property. |
Remarks
The default CodePage or encoding is 850 (Latin Character Set) but if the specified file has a UTF-8 BOM then UTF8 encoding will be used to process the file content.
The returned list of byte arrays will contain a single array if PDF format was specified or; one or more arrays for other formats like PNG, JPG or PCX. If more than one labels are rendered and if the output format is PDF, then a single multipage file is returned. For image formats, then the list will contain as many arrays as labels.
ProcessCommandsFromFile(String, Encoding)
Processes the ZPL commands contained into the specified file and using the specified Encoding or CodePage.
Declaration
public List<byte[]> ProcessCommandsFromFile(string filePath, Encoding fileEncoding)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filePath | The file path containing the ZPL commands to be processed. |
| System.Text.Encoding | fileEncoding | The Encoding or CodePage of the file content. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Byte[]> | Returns the output rendering process in the format specified to RenderOutputFormat property. |
Remarks
The returned list of byte arrays will contain a single array if PDF format was specified or; one or more arrays for other formats like PNG, JPG or PCX. If more than one labels are rendered and if the output format is PDF, then a single multipage file is returned. For image formats, then the list will contain as many arrays as labels.
RemoveFont(String)
Removes the specified font name from the internal printer storage.
Declaration
public bool RemoveFont(string fontName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fontName | The font name. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the font is successfully removed; otherwise false. |
RemoveGraphic(String)
Removes the specified graphic name from the internal printer storage.
Declaration
public bool RemoveGraphic(string graphicName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | graphicName | The graphic name. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the graphic is successfully removed; otherwise false. |
RenameFont(String, String)
Renames a current font name available in the internal printer storage to a new name.
Declaration
public bool RenameFont(string currentFontName, string newFontName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | currentFontName | The current font name. |
| System.String | newFontName | The new font name. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the font is successfully renamed; otherwise false. |
RenameGraphic(String, String)
Renames a current graphic name available in the internal printer storage to a new name.
Declaration
public bool RenameGraphic(string currentGraphicName, string newGraphicName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | currentGraphicName | The current graphic name. |
| System.String | newGraphicName | The new graphic name. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the graphic is successfully renamed; otherwise false. |