Before the company label has been developed with ZPL, a while ago the company purchased bartender software for label design. The function is big, have no say. Cut the crap and get to the point.
Requirement: The label template has been designed, and a simple program is designed to invoke the label template and print it. (Tag variables pass through the program)
The following is a simple write WinForm print program
Program Interface:
650) this.width=650; "title=" capture. JPG "style=" Float:none; "alt=" wkiom1v-fyya23cbaaejjfvmznu170.jpg "src=" http://s3.51cto.com/wyfs02/M02/6E/81/ Wkiom1v-fyya23cbaaejjfvmznu170.jpg "/>
650) this.width=650; "title=" Capture 12. JPG "style=" Float:none; "alt=" wkiol1v-gnmw98ngaacyakrutfe349.jpg "src=" http://s3.51cto.com/wyfs02/M00/6E/7D/ Wkiol1v-gnmw98ngaacyakrutfe349.jpg "/>
The code is as follows (one of the tag type's code, others omitted):
using system;using system.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.linq;using system.text;using System.windows.forms;namespace cs_label_print{ public partial class BOX_Label : Form { Public box_label () { initializecomponent (); } bartender.application btapp; bartender.format Btformat; private void btn2_click (Object sender, eventargs e) { int a = int32.parse ( This.num2.Value.ToString ());//Set the number of printed variables if (this. TXT3. text.length == 0 | | this. TXT4. text.length == 0) { messagebox.show (" No material number or qty "); } else { btformat = btapp.formats.open (@ "C:\bartenderfiles\cs\cs_package label", false, ""); btformat.printsetup.identicalcopiesoflabel = 1; // Set number of copies printed in the same sequence btformat.printsetup.numberserializedlabels = a; //set the number of sequences to print btformat.setnamedsubstringvalue ("SN", this. TXT3. Text); //passing variables to bartender templates btformat.setnamedsubstringvalue ("QTY", this. TXT4. Text); Btformat.printout (False, false); //second false sets whether to jump out of print properties when printing btformat.close (BarTender.BtSaveOptions.btSaveChanges); //Save label when exiting } } private void box_label_load (object sender, eventargs e) { btapp = new bartender.application (); this.num2.Value = 1; } private void box_label_formclosed (object sender, Formclosedeventargs e) { btapp.quit (BarTender.BtSaveOptions.btSaveChanges);// The interface exits when the bartender process exits synchronously } }}
This article from "Book to Time Side Hate less" blog, declined reprint!
C # calls the bartender service and prints the bartender label