ByteScout BarCode Generator SDK - C# - Print Barcode - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout BarCode Generator SDK – C# – Print Barcode

  • Home
  • /
  • Articles
  • /
  • ByteScout BarCode Generator SDK – C# – Print Barcode

How to print barcode in C# using ByteScout Barcode SDK

Tutorial on how to print barcode in C#

The sample source code below will teach you how to print barcode in C#. ByteScout Barcode SDK is the robost SDK that generates high quality barcode images and pdf. Can generate all popular types of barcodes from QR Code, Code 39, Code 128, UPC, GS1, GS-128, PDF417, Datamatrix to more exotic barcode types. Fully customizable fonts, colors, print sizes. Includes special functions to ensure output quality, and tools for adding barcodes to new or existing pdf files and images. It can print barcode in C#.

The SDK samples like this one below explain how to quickly make your application do print barcode in C# with the help of ByteScout Barcode SDK. In your C# project or application you may simply copy & paste the code and then run your app! This basic programming language sample code for C# will do the whole work for you to print barcode.

ByteScout free trial version is available for download from our website. It includes all these programming tutorials along with source code samples.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

BarcodePrinter.cs
      
using System; using System.Collections.Generic; using System.Text; using Bytescout.BarCode; using System.Drawing.Printing; using System.Windows.Forms; using System.Drawing; namespace printBarcodeCSharp2008 { class BarcodePrinter { private Barcode m_barcode = new Barcode(); private float m_widthInches; private float m_heightInches; public void Print(SymbologyType type, string value, string caption, float widthInches, float heightInches) { m_barcode.Symbology = type; m_barcode.Value = value; m_barcode.Caption = caption; m_widthInches = widthInches; m_heightInches = heightInches; PrintDocument printDoc = new PrintDocument(); printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage); PrintDialog dlgSettings = new PrintDialog(); dlgSettings.Document = printDoc; if (dlgSettings.ShowDialog() == DialogResult.OK) { printDoc.Print(); } } void printDoc_PrintPage(object sender, PrintPageEventArgs e) { Point position = new Point(100, 100); m_barcode.FitInto(new SizeF(m_widthInches, m_heightInches), UnitOfMeasure.Inch); m_barcode.Draw(e.Graphics, position); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode SDK Home Page

Explore ByteScout Barcode SDK Documentation

Explore Samples

Sign Up for ByteScout Barcode SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Program.cs
      
using System; using Bytescout.BarCode; namespace printBarcodeCSharp2008 { class Program { static void Main(string[] args) { BarcodePrinter bPrinter = new BarcodePrinter(); bPrinter.Print(SymbologyType.Code39, "0123456789", "Case Number", 3.5f, 1f); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode SDK Home Page

Explore ByteScout Barcode SDK Documentation

Explore Samples

Sign Up for ByteScout Barcode SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode SDK Home Page

Explore ByteScout Barcode SDK Documentation

Explore Samples

Sign Up for ByteScout Barcode SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next