Getting Started with BarCode Generator SDK

  • Home
  • /
  • Getting Started with BarCode Generator SDK

To view the documentation for the SDK go to Start > All Programs > Bytescout BarCode SDK and click the “Documentation” link.

The SDK comes with lot of ready-to-use source code examples for Visual Basic, C#, ASP.NET, VB6, VBScript, classic ASP, Pocket PC, Win CE.

To find source code samples, please go to “My Documents” folder, “ByteScout Samples” and “BarCode SDK”. Do not hesitate to copy and paste code snippets from samples right into your application!

The First Application

To help you get the most out of your evaluation, here is the quick guide on adding barcode generation into your application.

If you are using WinForms or ASP.NET: just open the form and find BytescoutBarCodeControl in the list of available controls and drag-n-drop it into the form.

To generate barcode image to save into a file or for other use:

  • run Visual Studio and create New Project
  • add reference to BarCode SDK using Project | Add Reference. In the Add Reference dialog select “Bytescout BarCode SDK” and click OK.
  • copy-and-paste the following code:

Visual Basic:

Imports <span data-scayt_word="Bytescout.BarCode" data-scaytid="3">Bytescout.BarCode</span>

Module <span data-scayt_word="Module1" data-scaytid="42">Module1</span>

Sub Main()
' Create new barcode
Dim barcode As New Barcode()

' Set <span data-scayt_word="symbology" data-scaytid="43">symbology</span>
<span data-scayt_word="barcode.Symbology" data-scaytid="5">barcode.Symbology</span> = <span data-scayt_word="SymbologyType.Code39" data-scaytid="7">SymbologyType.Code39</span>
' Set value
<span data-scayt_word="barcode.Value" data-scaytid="9">barcode.Value</span> = "Sample"

' Save barcode to image
<span data-scayt_word="barcode.SaveImage" data-scaytid="11">barcode.SaveImage</span>("<span data-scayt_word="result.png" data-scaytid="13">result.png</span>")

' Show image in default image viewer
<span data-scayt_word="Process.Start" data-scaytid="17">Process.Start</span>("<span data-scayt_word="result.png" data-scaytid="14">result.png</span>")
End Sub

End Module

C#:

using System;
using <span data-scayt_word="System.Collections.Generic" data-scaytid="19">System.Collections.Generic</span>;
using <span data-scayt_word="System.Text" data-scaytid="20">System.Text</span>;
using <span data-scayt_word="System.Diagnostics" data-scaytid="21">System.Diagnostics</span>;

using <span data-scayt_word="Bytescout.BarCode" data-scaytid="4">Bytescout.BarCode</span>;

<span data-scayt_word="namespace" data-scaytid="45">namespace</span> Sample
{
class Program
{
static void Main(string[] <span data-scayt_word="args" data-scaytid="46">args</span>)
{
// Create new barcode
Barcode barcode = new Barcode();

// Set <span data-scayt_word="symbology" data-scaytid="44">symbology</span>
<span data-scayt_word="barcode.Symbology" data-scaytid="6">barcode.Symbology</span> = <span data-scayt_word="SymbologyType.Code39" data-scaytid="8">SymbologyType.Code39</span>;
// Set value
<span data-scayt_word="barcode.Value" data-scaytid="10">barcode.Value</span> = "Sample";

// Save barcode to image
<span data-scayt_word="barcode.SaveImage" data-scaytid="12">barcode.SaveImage</span>("<span data-scayt_word="result.png" data-scaytid="15">result.png</span>");

// Show image in default image viewer
<span data-scayt_word="Process.Start" data-scaytid="18">Process.Start</span>("<span data-scayt_word="result.png" data-scaytid="16">result.png</span>");
}
}
}
  • press F5 to compile and run your first application!

The application generates barcode image and saves into a file

More Samples

For more source code samples on reading barcodes explore “ByteScout Samples / BarCode SDK ” folder in “My Documents”.

Evaluation version adds a reminder text below each generated barcode image.

You are welcome to purchase a license for the SDK at http://bytescout.com/buy/barcodereadersdk.html

We provide 30-Day Unconditional Money Back Guarantee for the SDK!

Have a Question?

Contact us at support@bytescout.com or use the online contact form at https://bytescout.com/support/index.php?_m=tickets&_a=submit&step=1&departmentid=2

Thanks again for evaluating BarCode SDK!

Tutorials: