Printing and design of C ා label (bar code)

The last article talked about barcode printing, mainly through reading the template definition file (XML file), and then combining the dynamic data read from the database to generate barcode. Here is how to design the barcode template. The design process is also very simple, just a simple drag. Then click the small arrow or the command in the lower right corner, select Save to xmlfile, and then select the path to save.

The XML generated by the above design diagram will be the following.

<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<Barcode LabelWidth="639">
  <Image X="429" Y="52" Size="2268" Width="162" Height="108" BytesPerLine="24" ImageName="LOGO">
    <ImageHex ID="1" HexString="mJ018h07Ch0FC0F8gW0FE1F8gW0FC3FCgW0FC3FCgW0F83F81EgU0783F83FgW03F07FgW01E0HF8gY0" />
    <ImageHex ID="2" HexString="HF8gX01HFgY01HFh0FE04gX0FC3F8gW0307FCgY0HFCgN078K01H01HFCgM07HF8K0C01HFCgL01HFCL" />
    <ImageHex ID="3" HexString="0601HF8gL07FCM0701HF8gK01HF8M0301HFgL03FEN0380FEgL07FCN01C078078gI0HF8N01EI03HFg" />
    <ImageHex ID="4" HexString="I0HFO01EI0IF8gG01FEP0FH01IFCgG03FCP0F803IFCgG03FCP0F807IFEgG07F8P0FC07IFEgG0HFQ0" />
    <ImageHex ID="5" HexString="FC0JFEgG0HFQ0FE0JFEg01FEQ0FE0JFCg03FCQ0FE0JFCg07F8Q0FE0JF8g07F8Q0HF07IF8g0HFR0HF" />
    <ImageHex ID="6" HexString="07IFg01FER0HF03HFEg03FCQ01HFH0HF8g03FCQ01HFH038gG07F8Q03HFgK0HFR07HFgJ01FER07HFg" />
    <ImageHex ID="7" HexString="J01FCR0IFgJ03FCQ01HFEgJ07F8Q03HFEgJ0HFR07HFEgI01FER0IFEgI03FCQ03IFCgI0HF8P01JFCg" />
    <ImageHex ID="8" HexString="H01HFP07KF8gH03FCN07MFgI07F8M03MFEgI0HFM01NFCgH01FEM07NF8gH03FCL01OFgI07F8L07NFC" />
    <ImageHex ID="9" HexString="gH01HFM0OF8gH01FEL03NFCgI03FCL07MF8gJ07F8L0LFgM0HFL01KFgM01HFL03JFgN01FEL03IFCgN" />
    <ImageHex ID="10" HexString="03FEL07IFgO03FCL0IFCgO07FCL0IF8N0202H03U07FCK01IF0HF80FI0707H078J0JF8K07FCK03HFE" />
    <ImageHex ID="11" HexString="7HF83FEJ01H078I07KFK07F8K03HF8IF87FEI0FI078H01HFCIFK07F8K07HF1HFE07HF03IFE679H03" />
    <ImageHex ID="12" HexString="FCH03F8J07FCK07FE1HFH0IF01IFE679807FCH03F8J07FCK0HFE0EI0IF8K0679807FCH03F8J03FCK" />
    <ImageHex ID="13" HexString="0HFCH0181IF8K0279807HF80HF8J03FEJ01HF801F81IF80F8FH078H0MFK03FEJ01HFH01F81IF807H" />
    <ImageHex ID="14" HexString="FH078H0HF8O01HFJ03HFK01IF801FCL0FEQ0HFJ07FEH07FC1F9F8L078H0FC7IFEJ0407F8I07FE01I" />
    <ImageHex ID="15" HexString="F1F0F80E4207HF80F9KF8I0403FCI0HFC01IF1F0F81E7BCIFC0F9KF8I0601HFH01HF801IF1F0F83C" />
    <ImageHex ID="16" HexString="7BEIFC0F8O07H07F801HF8H0IF1F0F87878E7HFC0F8O07801FH03HFL01F0F878F8EK0F9F803FJ078" />
    <ImageHex ID="17" HexString="K07HFL01F0F878F0EK0F9F803FJ07EK0HFEI09F81F0F878F0E03I0F9HF31F8I07FJ01HFCI09F31F0" />
    <ImageHex ID="18" HexString="F87CF3E078H0F9IFDF8I07F8I07HFCH019F79F0F83EF3CE7B80F8IFCFJ03FEI0IF8H019E79F9F81E" />
    <ImageHex ID="19" HexString="F38E7980F8O03HF803IF8H019E79IF8H0FH0E7B80F8H06L01NFI039E79IF8K0E7B80F801F38J01NF" />
    <ImageHex ID="20" HexString="I039E79IF80HFEH07801F0FBF3EK0MFEI079E79IF81IF807801F0F3F3EK07LFCI079E79IF03IFCJ0" />
    <ImageHex ID="21" HexString="3F0H3F38K07LFCI079E79IF03IF8J03FH03FM03LF8I079F78IF01IF0IF07FQ01LFJ079F38HFEK01I" />
    <ImageHex ID="22" HexString="FC7F07IFCL0KFEJ039F307FEI0101IFC7E3KF8K07JFCJ031EH03FCI0F01IFC7E3KF8K01JF8L0EI07" />
    <ImageHex ID="23" HexString="J06H0BHF03C1KFM07HFEM06V08H01EO01HF8h08nG0" />
  </Image>
  <Eng_Num_Label Type="Fix" LabelDefine_ZPLII="^FO514,24^ADN,13,10^FDHeXieWu^FS" LabelDefine_EPL2="A514,24,0,2,1,1,N,&quot;HeXieWu&quot;" />
  <Eng_Num_Label Type="Fix" LabelDefine_ZPLII="^FO387,176^BY2^BCN,40,Y,N,N,N^FDBarCode^FS" LabelDefine_EPL2="B387,176,0,1,2,2,40,B,&quot;BarCode&quot;" />
  <Cht_Label X="429" Y="24" Size="23" Rate="1" Rotate="0" Text="first" />
</Barcode>
View Code

The printed effect is as follows

 

You can see that you can only modify the content of this XML if you want to use this tag. Next, we will talk about the usage of this control.

Register first printbarcdoe.dll , and then introduce ITBarcode.dll , add Chinese label, Japanese label, englishnumericlabel, boxandline, imagelabel, zplcommandtext, barcodetester to Form respectively. In Chinese label: CharacterSize is character size, Chinese text is Chinese string, Rate is magnification, RotateDegrees is the corner

  1. Japanese label: can only be used in Windows that supports Unicode. Where: Japanese text is a Japanese string, and other characters are the same as Chinese text
  2. In EnglishNumericLabel: LabelType: BarcodeLabel for Barcode, TextLabel for English or digital text. TextSource: there are two types of text content: FIX for fixed text, SQL for print. If the text content is not fixed, DataField should be specified. If the text content is fixed, LabelText can specify. You can also specify Label Font: LabelFont, For Barcode, you can specify its height: barcodeheight, barcodewidth: BarcodeModuleWidth. For other contents, select Default
  3. BoxAndLine: used to print Line and Box
  4. ImageLabel: used to print bmp files. Only monochrome bmp files can be printed
  5. ZPLCommandText is to input other printing commands not included above
  6. BarcodeTester is used to test whether the location of each control is appropriate and save it as an XML file. Among them, PrintBarcode is used to test Barcode, and the optional printing languages are zpli and EPL2. SaveToXmlFile saves the designed label as an XML file. When printing labels, use this XML file as the definition of label. When testing, if you want to get data from the Database, To set SqlText as an SQL statement, you need to generate and send a word library. This is mainly used for printing Chinese characters.

Please refer to the previous example code for specific printing code.

This can meet the requirements of most enterprises. But there are still limitations, such as the Chinese characters cannot be bold, and EPL cannot type QRCode

Do not know how you are in the program to achieve bar code printing? Is there anything easier?

If you have any questions, you can leave your email if you are interested in the DLL in this article.

Tags: xml Database SQL encoding

Posted on Sun, 07 Jun 2020 04:04:26 -0400 by tim