Print Label
Introduction
PrintLabelActivity is a label printing node used to print labels to a specified printer via the print agent service. This node supports batch printing, custom print data sources, print record saving, and other functions.
Configuration Items
| Property Name | Display Name | Type | Required | Default Value | Description |
|---|---|---|---|---|---|
| PrinterName | Printer Name | string | No | null | Printer Name |
| PrintAgentIP | Agent IP | string | No | null | Print Agent IP, use 127.0.0.1 for local print |
| PrintTemplate | Template Path | string | No | null | Print template path, e.g., D:\Template1.btw |
| PrintNumber | Print Number | int | No | 1 | Number of copies |
| RequestTimeOut | Request Timeout(s) | int | Yes | 60 | Request timeout in seconds |
| SubStringLength | Substring Length | int | Yes | 100 | Length to truncate print data strings |
Business Logic
Execution Flow
Start
│
▼
Get print data model list
│
├─► Empty → Create default model using node config
│
▼
Traverse print data models
│
├─► Check print config (Agent, Printer, Template)
│ │
│ └─► Config empty → Set result=2, return
│
├─► Verify Agent IP Address
│ │
│ └─► Invalid → Set result=2, return
│
├─► Merge extended print data sources
│
├─► Truncate overlong strings
│
└─► Call print service to execute printing
│
├─► Success → Record success
│
└─► Failure → Record failure reason
│
▼
Set print result
│
▼
Save print record on exit
│
▼
End
Result Values
| Result Value | Description |
|---|---|
| 1 | Print Success |
| 2 | Print Failure |
| 3 | Printer Connection Failure |
Flow Data Items
Input Data Items
| Data Item | Type | Description |
|---|---|---|
| PrintDataModel | List<PrintDataModel> | Print Data Model List |
| LabelPrintDataSource | Dictionary<string, string> | Extended Print Data Source |
Output Data Items
| Data Item | Type | Description |
|---|---|---|
| LabelPrintResultValue | int | Print Result (1=Success, 2=Failure, 3=Connection Failure) |
| LabelPrintDescriptionValue | string | Print Description |
Usage Example
Basic Configuration
<PrintLabelActivity Name="Print Label">
<PrinterName>Printer1</PrinterName>
<PrintAgentIP>127.0.0.1:9100</PrintAgentIP>
<PrintTemplate>D:\Templates\Label1.btw</PrintTemplate>
<PrintNumber>1</PrintNumber>
<RequestTimeOut>60</RequestTimeOut>
</PrintLabelActivity>
Batch Printing Configuration
Set multiple print tasks via flow data items:
<PrintInitializeActivity Name="Print Initialization" />
<PrintLabelActivity Name="Print Label" />
Typical Flow Configuration
Print Initialization → Print Label → Condition Branch (Success/Failure)
<PrintInitializeActivity Name="Print Initialization" />
<PrintLabelActivity Name="Print Label">
<RequestTimeOut>60</RequestTimeOut>
<SubStringLength>100</SubStringLength>
</PrintLabelActivity>
<ConditionActivity Name="Print Result Judgment">
<Condition>Flow.DataItems["LabelPrintResultValue"] == 1</Condition>
<TrueBranch>Continue Production</TrueBranch>
<FalseBranch>Exception Handling</FalseBranch>
</ConditionActivity>
Notes
- This node is currently not published (Visible = false).
- Print Agent IP must be a valid IP address.
- Print template path must exist on the print agent machine.
- Overlong strings will be truncated with ellipsis added.
- Print records are automatically saved when the node exits.