ByteScout BarCode Generator SDK - C# - Print Barcode - ByteScout

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.

Try ByteScout Barcode SDK today: Get 60 Day Free Trial or sign up for Web API

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); } } }

Try ByteScout Barcode SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

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); } } }

Try ByteScout Barcode SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

VIDEO

ON-PREMISE VERSION

Get 60 Day Free Trial or Visit ByteScout Barcode SDK page

Explore ByteScout Barcode SDK documentation

WEB API

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next