C # several methods of bar code printing

Source: Internet
Author: User

Although the title is C #, the methods described below are not only available in C #, but also in other languages.

 

To sum up the common bar code printing methods, there are many bar code printing methods, including the following:

1. Make a template for the banma printing software and save it as a. PRN file. The file format is roughly as follows:

^ XA ^ lh30, 0 ^ JMA ^ xz
~ Dg0000.grf, 04096,128,
, :::::::::::::::::::: R00000 ,:::,::::::::~ Dg001.grf, 04096,128,
, :::::: R1_0, ::: ,:::::::::::::::::::~ Dg0002.grf, 04096,128,
, :::::::::::::::::: R1_0 ,::::,::::::::::~ Dg003.grf, 04096,128,
, :::::::::::::::::::: R1_0 ,:::::::::: ^ XA
^ Mt
^ Pw1004
^ Ll1890
^ Ls0
^ Ft0, 544 ^ xg000.grf, 1, 1 ^ FS
^ Ft0, 1856 ^ xg001.grf, 1, 1 ^ FS
^ Ft0, 1792 ^ xg002.grf, 1, 1 ^ FS
^ Ft0, 1728 ^ xg003.grf, 1, 1 ^ FS
^ Ft21, 449 ^ a0n, 33,33 ^ FH \ ^ fdupc: ^ FS
^ Ft425, 450 ^ a0n, 33,33 ^ FH \ ^ fdean: ^ FS
^ By1, 3,18 ^ ft604, 1691 ^ BCN, n, n
^ FD >:{ SN1} ^ FS
^ By2, 3,30 ^ ft494, 1638 ^ BCN, n, n
^ FD >:{ Sn2} ^ FS

The Red fields in the template need to be replaced with variables. This is very simple. You only need to replace the fields, and then send the replaced template content to the printer for printing.

 

2. use barw to create a BTW template file. The file format is. BTW: Specifies a data source for a template file. There are many types of data sources, such as databases and text files. Here I use text files as an example:

First, make a template,

Temp. activecode1 and temp. activecode2 are two text files in the following format:

Acticecode1, acticecode2
K0NBHE-T0DZDR-B3QSP6, K0NBHE-T0DZDR-B3QSP7

The program writes the final data to the data source based on the data passed in at the front end. Then, it splits the data source to obtain each field and calls the print method,

 Process.Start(bartendAdd, "/NOSPLASH  /F=\"" + btw + "\" /D=\"" + sn + "\" /P /X");

 

 

3. Print through fastreport

Here we will focus on the parameter transfer and receipt issues. The others should be relatively simple. We should first create a template file. It is worth mentioning that fastreport is used. the files generated by the net designer are files suffixed with frx and fastreport. the file generated by the studio designer is a file suffixed with fr3. At that time, I was confused about the difference, and then I found out it slowly.

 

Input parameters to the report:

 

The received parameter values are as follows:

 

Preview the result after obtaining the parameter:

C # several methods of bar code printing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.