Class WindowsPrintJob
Specifies information about how a thermal label is printed, including the printer device settings, label orientation, number of copies, etc.
Inheritance
Inherited Members
Namespace: Neodynamic.SDK.Printing
Assembly: cs.temp.dll.dll
Syntax
public class WindowsPrintJob : IDisposable
Constructors
WindowsPrintJob()
Initializes a new instance of the PrintJob class
Declaration
public WindowsPrintJob()
WindowsPrintJob(PrinterSettings)
Initializes a new instance of the PrintJob class with the specified printer settings.
Declaration
public WindowsPrintJob(PrinterSettings printerSettings)
Parameters
| Type | Name | Description |
|---|---|---|
| PrinterSettings | printerSettings | The printer settings which provides info about the target printer. |
Properties
BidiEncoding
The stirng encoding to be used in the BIDI communication. Default is UTF8.
Declaration
public Encoding BidiEncoding { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Text.Encoding |
CommandsOptimizationEnabled
Gets or sets whether optimization mechanisms are performed when generating the printer commands. Default is true.
Declaration
public bool CommandsOptimizationEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Copies
Gets or sets the number of copies of the thermal label to print. Default value is 1
Declaration
public int Copies { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
DocumentName
Gets or sets the name of the document to print. Default is an empty string.
Declaration
public string DocumentName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
DriverSettings
Gets or sets the Windows printer driver settings (a DEVMODE structure as a byte array) to apply when calling PrintAsGraphic or PrintFiles. Default is null, which means the printer's current default settings are used.
Declaration
public byte[] DriverSettings { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Byte[] |
Remarks
It lets you apply driver-specific options that are not exposed by the SDK, like cutter, media type or darkness settings. Use the GetDriverSettings or ShowDriverSettingsDialog methods to get them, and store the returned bytes to reuse them later.
The DEVMODE is specific to the printer and its driver. It must have been captured for the same printer name, otherwise an exception is thrown when printing. Capture it again if the printer driver is updated or replaced.
The SDK still sets the paper size based on the label size (when the driver supports a custom paper size) and the number of copies. Duplex is only changed when the Duplex property or ThermalLabel.IsDuplexDesign is set; otherwise the value in these settings is kept.
These settings are not used by the Print methods, which send raw commands to the printer.
When the label has ThermalLabel.CutAfterPrinting set, PrintAsGraphic splits the print in spooler jobs of ThermalLabel.BatchCut labels each (after every label if BatchCut is lower than 1). Set the driver to cut at the end of each job (e.g. through these settings) to get a cut after every batch. When a page holds several labels (LabelsPerRow greater than 1 or a sheet of labels), BatchCut counts pages.
Duplex
Gets or sets the printer setting for double-sided printing. Default is false.
Declaration
public bool Duplex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
FingerprintSettings
Gets the Fingerprint custom settings.
Declaration
public FingerprintSettings FingerprintSettings { get; }
Property Value
| Type | Description |
|---|---|
| FingerprintSettings |
MarginLeft
Gets or sets the left margin when printing a label as graphic. The unit of measure is the one specified in the ThermalLabel object. Default is -1 which means the label is printed horizontally centered.
Declaration
public double MarginLeft { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
MarginTop
Gets or sets the top margin when printing a label as graphic. The unit of measure is the one specified in the ThermalLabel object. Default is -1 which means the label is printed vertically centered.
Declaration
public double MarginTop { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
PrinterSettings
Gets or sets information about the thermal printer used for printing.
Declaration
public PrinterSettings PrinterSettings { get; set; }
Property Value
| Type | Description |
|---|---|
| PrinterSettings |
PrintOrientation
Gets or sets the page orientation used to print the thermal label. Default value is Portrait
Declaration
public PrintOrientation PrintOrientation { get; set; }
Property Value
| Type | Description |
|---|---|
| PrintOrientation |
Replicates
Gets or sets the number of replicates of the thermal label to print. Default value is 0 (zero)
Declaration
public int Replicates { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
ThermalLabel
Gets or sets the ThermalLabel object to be printed out. Default value is Null
Declaration
public ThermalLabel ThermalLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| ThermalLabel |
Methods
CloseBidiComm()
Closes a BIDI communication.
Declaration
public void CloseBidiComm()
Dispose()
Declaration
public void Dispose()
Implements
GetDriverSettings(String)
Gets the current default driver settings (DEVMODE) of the specified printer, without showing any dialog.
Declaration
public static byte[] GetDriverSettings(string printerName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | printerName | The printer name. If null or empty, the system's default printer is used. |
Returns
| Type | Description |
|---|---|
| System.Byte[] | The driver settings, which can be assigned to the DriverSettings property. |
OnDataRead(BidiCommEventArgs)
Declaration
protected void OnDataRead(BidiCommEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| BidiCommEventArgs | e |
OnError(BidiCommErrorEventArgs)
Declaration
protected void OnError(BidiCommErrorEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| BidiCommErrorEventArgs | e |
OpenBidiComm()
Opens a BIDI communication based on the PrinterSettings property.
Declaration
public void OpenBidiComm()
Print()
Starts the thermal label's printing process. Raw Commands will be sent to the specified printer.
Declaration
public void Print()
Print(List<ThermalLabel>)
Starts the printing process of the specified group of ThermalLabel objects. Raw Commands will be sent to the specified printer.
Declaration
public void Print(List<ThermalLabel> thermalLabelGroup)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ThermalLabel> | thermalLabelGroup | The group of ThermalLabel objects to print out. |
Print(ThermalLabel)
Starts the printing process of the specified ThermalLabel object. Raw Commands will be sent to the specified printer.
Declaration
public void Print(ThermalLabel thermalLabel)
Parameters
| Type | Name | Description |
|---|---|---|
| ThermalLabel | thermalLabel | The ThermalLabel object to print out. |
PrintAsGraphic()
Starts the thermal label's printing process. Graphic Commands will be sent to the specified printer.
Declaration
public void PrintAsGraphic()
PrintAsGraphic(List<ThermalLabel>)
Starts the printing process of the specified group of ThermalLabel objects. Graphic Commands will be sent to the specified printer.
Declaration
public void PrintAsGraphic(List<ThermalLabel> thermalLabelGroup)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ThermalLabel> | thermalLabelGroup | The group of ThermalLabel objects to print out. |
PrintAsGraphic(List<ThermalLabel>, Double)
Starts the printing process of the specified group of ThermalLabel with the specified scale settings. Graphic Commands will be sent to the specified printer.
Declaration
public void PrintAsGraphic(List<ThermalLabel> thermalLabelGroup, double scale)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ThermalLabel> | thermalLabelGroup | The group of ThermalLabel objects to print out. |
| System.Double | scale | The scaling factor. |
PrintAsGraphic(List<ThermalLabel>, Double, Double)
Starts the printing process of the specified group of ThermalLabel with the specified scale settings. Graphic Commands will be sent to the specified printer.
Declaration
public void PrintAsGraphic(List<ThermalLabel> thermalLabelGroup, double scaleX, double scaleY)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ThermalLabel> | thermalLabelGroup | The group of ThermalLabel objects to print out. |
| System.Double | scaleX | The scaling factor in the X direction. |
| System.Double | scaleY | The scaling factor in the Y direction. |
PrintAsGraphic(ThermalLabel)
Starts the printing process of the specified ThermalLabel object. Graphic Commands will be sent to the specified printer.
Declaration
public void PrintAsGraphic(ThermalLabel thermalLabel)
Parameters
| Type | Name | Description |
|---|---|---|
| ThermalLabel | thermalLabel | The ThermalLabel object to print out. |
PrintAsGraphic(ThermalLabel, Double)
Starts the printing process of the specified ThermalLabel object with the specified scale settings. Graphic Commands will be sent to the specified printer.
Declaration
public void PrintAsGraphic(ThermalLabel thermalLabel, double scale)
Parameters
| Type | Name | Description |
|---|---|---|
| ThermalLabel | thermalLabel | The ThermalLabel object to print out. |
| System.Double | scale | The scaling factor. |
PrintAsGraphic(ThermalLabel, Double, Double)
Starts the printing process of the specified ThermalLabel object with the specified scale settings. Graphic Commands will be sent to the specified printer.
Declaration
public void PrintAsGraphic(ThermalLabel thermalLabel, double scaleX, double scaleY)
Parameters
| Type | Name | Description |
|---|---|---|
| ThermalLabel | thermalLabel | The ThermalLabel object to print out. |
| System.Double | scaleX | The scaling factor in the X direction. |
| System.Double | scaleY | The scaling factor in the Y direction. |
PrintAsGraphic(ThermalLabel, Tuple<Double, Double>)
Starts the printing process of the specified ThermalLabel object targeting a new size. Graphic Commands will be sent to the specified printer.
Declaration
public void PrintAsGraphic(ThermalLabel thermalLabel, Tuple<double, double> targetLabelSize)
Parameters
| Type | Name | Description |
|---|---|---|
| ThermalLabel | thermalLabel | The ThermalLabel object to print out. |
| System.Tuple<System.Double, System.Double> | targetLabelSize | The target label size. The unit is the specified by the ThermalLabel object. |
PrintFiles(Byte[])
Starts the printing process of the specified files.
Declaration
public void PrintFiles(byte[] printFilesBinaryContent)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | printFilesBinaryContent | The binary content of the print files. |
ShowDriverSettingsDialog(String, IntPtr)
Shows the printer driver's properties dialog and returns the driver settings (DEVMODE) selected by the user.
Declaration
public static byte[] ShowDriverSettingsDialog(string printerName, IntPtr ownerWindowHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | printerName | The printer name. If null or empty, the system's default printer is used. |
| System.IntPtr | ownerWindowHandle | The handle of the window that owns the dialog. It can be IntPtr.Zero. |
Returns
| Type | Description |
|---|---|
| System.Byte[] | The driver settings, which can be assigned to the DriverSettings property, or null if the user cancelled the dialog. |
ShowDriverSettingsDialog(String, IntPtr, Byte[])
Shows the printer driver's properties dialog, initialized with the specified driver settings, and returns the driver settings (DEVMODE) selected by the user.
Declaration
public static byte[] ShowDriverSettingsDialog(string printerName, IntPtr ownerWindowHandle, byte[] currentSettings)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | printerName | The printer name. If null or empty, the system's default printer is used. |
| System.IntPtr | ownerWindowHandle | The handle of the window that owns the dialog. It can be IntPtr.Zero. |
| System.Byte[] | currentSettings | The driver settings shown in the dialog, e.g. a value previously returned by this method. If null, the printer's current default settings are shown. |
Returns
| Type | Description |
|---|---|
| System.Byte[] | The driver settings, which can be assigned to the DriverSettings property, or null if the user cancelled the dialog. |
Write(String)
Writes (sends) data to the target device in the BIDI communication.
Declaration
public void Write(string data)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | data | The data to be written (sent) to the target device. |
Events
DataRead
Occurs when data is received from the target device in the BIDI communication.
Declaration
public event DataReadEventHandler DataRead
Event Type
| Type | Description |
|---|---|
| DataReadEventHandler |
Error
Occurs when an error happens in the BIDI communication.
Declaration
public event ErrorEventHandler Error
Event Type
| Type | Description |
|---|---|
| ErrorEventHandler |