Click here to Skip to main content
15,901,505 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I need to Create a Bar Code for items using asp.net, I need to save the Bar Code Value in Sql Server.

I Want to Show the Generated Bar Code item List in Grid View.

Using Citizen Printer to the Print Bar Codes.

Please Provide me any Solution........
Posted

See the following links

C# Barcode Generator WebService

Code is simple and strait forward.
It allows you to print barcode  and also access Citizen  printer from asp.net.
 
1.       Install font which is free on .net "3 of 9 Barcode"
2.       Create an Asp.net project
3.        Add this code
 
 
public void Submit_Click(object sender, EventArgs e)
        {
            try
            {
                PrintDocument pd = new PrintDocument();
                pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
                // Set the printer name. 
                //pd.PrinterSettings.PrinterName = "file://ns5/hpoffice
                //pd.PrinterSettings.PrinterName = "Zebra New GK420t"               
                pd.Print();
            }
            catch (Exception ex)
            {
                Response.Write("Error: " + ex.ToString());
            }
        }
        void pd_PrintPage(object sender, PrintPageEventArgs ev)
        {
            Font printFont = new Font("3 of 9 Barcode", 17);
            Font printFont1 = new Font("Times New Roman", 9, FontStyle.Bold);

            SolidBrush br = new SolidBrush(Color.Black);

            ev.Graphics.DrawString("*texttodisplay*", printFont, br, 10, 65);
            ev.Graphics.DrawString("*texttodisplay*", printFont1, br, 10, 85);
           
        }
 
Share this answer
 
v2
Comments
subbuksr123 9-Dec-13 4:17am    
Thanks.

How to Print the Bar Code using Citizen Printer...
subbuksr123 12-Dec-13 4:25am    
It is not working......
Regarding Solution #1... IMHO... Do not use fonts!!!, please Avoid many future headaches by not using them. Why? because if your barcode needs to be exposed to a Barcode Verification Process then yours will not pass it the first shot for sure, if you used fonts to generate & print the barcodes. Fonts are not suitable for real barcode scenarios, period. (just what my experience says)

Instead, use many open source or commercial solutions available out there like listed here Implementation of Barcode In Vb.net 2008[^]

As for printing the barcodes you generate from ASP.NET... well, you might have some luck if using just the traditional javascript windows.print() approach (just google that term to get many entries). Ask me more on this subject if you want but provide the printer model at least.

HTH
 
Share this answer
 
 
Share this answer
 
Comments
CHill60 12-Mar-14 9:19am    
That is a link back to this same question!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900