Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ahsaniqbalsidiqui/1a44de1276e6383d0652c1eae0f0c751 to your computer and use it in GitHub Desktop.
Save ahsaniqbalsidiqui/1a44de1276e6383d0652c1eae0f0c751 to your computer and use it in GitHub Desktop.
This Gist contains .NET code snippets for examples of Aspose.BarCode for .NET.
This gist exceeds the recommended number of files (~10). To access all files, please clone this gist.

This Gist contains code snippets for sample code of Aspose.BarCode for .NET

// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create an image object inheriting properties from the section
Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);
// Load image data from memory stream to the image object
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.MemoryBmp;
image1.ImageInfo.OpenType = Aspose.Pdf.Generator.ImageOpenType.Memory;
image1.ImageScale = 0.5F;
System.IO.BinaryReader reader = new System.IO.BinaryReader(ms);
ms.Position = 0;
image1.ImageInfo.MemoryData = reader.ReadBytes((int)ms.Length);
// Add image to the paragraphs collection of the section and Save the Pdf
sec1.Paragraphs.Add(image1);
pdf1.Save(dataDir +"MyBarCode_out.pdf");
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Create an image object inheriting properties from the section
Dim image1 As Aspose.Pdf.Generator.Image = New Aspose.Pdf.Generator.Image(sec1)
' Load image data from memory stream to the image object
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.MemoryBmp
image1.ImageInfo.OpenType = Aspose.Pdf.Generator.ImageOpenType.Memory
image1.ImageScale = 0.5F
Dim reader As System.IO.BinaryReader = New System.IO.BinaryReader(ms)
ms.Position = 0
image1.ImageInfo.MemoryData = reader.ReadBytes(CType(ms.Length, Integer))
' Add image to the paragraphs collection of the section and Save the Pdf
sec1.Paragraphs.Add(image1)
pdf1.Save(dataDir & Convert.ToString("MyBarCode.pdf"))
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate Excel class that represents an excel file
Workbook excel1 = new Workbook();
// Add the barcode image into the pictures collection of the first worksheet of the excel file in the form of a MemoryStream, ms with upper left row=5 and
// Upper left column=5 and Save the excel file
excel1.Worksheets[0].Pictures.Add(5, 5, ms);
excel1.Save(dataDir + "MyFile_out.xls");
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate Excel class that represents an excel file
Dim excel1 As Excel = New Excel()
'Add the barcode image into the pictures collection of the first worksheet of the excel file in the form of a MemoryStream, ms with upper left row=5 and
' upper left column=5 and Save the excel file
excel1.Worksheets(0).Pictures.Add(5, 5, ms)
excel1.(dataDir & Convert.ToString("Myfile_out.xls"))
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate Excel class that represents an excel file
Workbook excel1 = new Workbook();
// Add the barcode image into the pictures collection of the first worksheet of the excel file in the form of a MemoryStream, ms with upper left row=5 and
// Upper left column=5 and Save the excel file
excel1.Worksheets[0].Pictures.Add(5, 5, ms);
excel1.Save(dataDir + "MyFile_out.xls");
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate Excel class that represents an excel file
Dim excel1 As Excel = New Excel()
' Add the barcode image into the pictures collection of the first worksheet of the excel file in the form of a MemoryStream, ms with upper left row=5 and
' Upper left column=5 and Save the excel file
excel1.Worksheets(0).Pictures.Add(5, 5, ms)
excel1.(dataDir & Convert.ToString("Myfile_out.xls"))
<configuration>
<startup>
<requiredRuntime version="v1.0.3705" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v1.0.3705">
<dependentAssembly>
<assemblyIdentity name="Regcode" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.EnterpriseServices" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CustomMarshalers" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Accessibility" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Configuration.Install" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.DirectoryServices" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Drawing.Design" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ServiceProcess" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.RegularExpressions" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Services" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Windows.Forms" publicKeyToken="b77a5c561934e089" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Xml" publicKeyToken="b77a5c561934e089" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data" publicKeyToken="b77a5c561934e089" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Design" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Drawing" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System" publicKeyToken="b77a5c561934e089" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Messaging" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="IEExecRemote" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="IEHost" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="IIEHost" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ISymWrapper" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="mscorcfg" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Management" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Remoting" publicKeyToken="b77a5c561934e089" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Serialization.Formatters.Soap" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mobile" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Vsa.Vb.CodeDOMProcessor" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="7.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft_VsaVb" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="7.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Vsa" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="7.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualBasic.Vsa" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="7.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="cscompmgd" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="7.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.JScript" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="7.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualBasic" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="7.0.3300.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualC" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="7.0.3300.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Instantiate an instance of license and set the license file through its path
Aspose.BarCode.License license = new Aspose.BarCode.License();
license.SetLicense("Aspose.BarCode.lic");
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate an instance of license and set the license file through its path
Dim license As Aspose.BarCode.License = New Aspose.BarCode.License()
license.SetLicense("Aspose.BarCode.lic")
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Instantiate an instance of license and set the license through a stream
Aspose.BarCode.License license = new Aspose.BarCode.License();
license.SetLicense(myStream);
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate an instance of license and set the license through a stream
Dim license As Aspose.BarCode.License = New Aspose.BarCode.License()
license.SetLicense(myStream)
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
public void Save(string fileName, ImageFormat fileFormat)
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Create Pdf document and Add a section to the Pdf document
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Create Pdf document and Add a section to the Pdf document
Dim pdf1 As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf()
Dim sec1 As Aspose.Pdf.Generator.Section = pdf1.Sections.Add()
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create a word document object with Aspose.Words
Document doc = new Document();
// Create builder for document object, Insert the barCode image into document and Save the word document.
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertImage(builder.BarCodeImage);
doc.Save(dataDir + "Myfile_out.doc");
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Create a word document object with Aspose.Words
Dim doc As New Document()
' Create builder for document object, Insert the barCode image into document and Save the word document.
Dim builder As New DocumentBuilder(doc)
builder.InsertImage(builder.BarCodeImage)
doc.Save(dataDir & Convert.ToString("Myfile_out.doc"))
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Instantiate linear barcode object, Set the Code text and symbology type for the barcode
BarCodeBuilder builder = new BarCodeBuilder();
builder.CodeText = "1234567";
builder.SymbologyType = Symbology.Code128;
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate linear barcode object, Set the Code text and symbology type for the barcode
Dim builder As BarCodeBuilder = New BarCodeBuilder()
builder.CodeText = "1234567"
builder.SymbologyType = Symbology.Code128
<xs:schema id="DataSet_BarCode" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="DataSet_BarCode" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="DataTable_BarCode">
<xs:complexType>
<xs:sequence>
<xs:element name="CodeText" type="xs:string" minOccurs="0" />
<xs:element name="BarCodeImage" type="xs:base64Binary" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// initialize the BarCodeReader and specify multiple symbology types using bitwise OR operator
BarCodeReader reader = new BarCodeReader(@"MultiBarCodes.bmp", BarCodeReadType.AllSupportedTypes);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("this is some test code text. \n Second line \n third line.", EncodeTypes.Pdf417)
{
// Set width and height
xDimension = 0.6f,
yDimension = 1.2f
};
// Save the Barcode image in JPEG format
barCodeBuilder.Save(dataDir + "2d-barcode_out.jpg", BarCodeImageFormat.Jpeg);
// Save the Barcode image in TIFF format
barCodeBuilder.Save(dataDir + "2d-barcode_out.tiff", BarCodeImageFormat.Tiff);
// Save the Barcode image in PNG format
barCodeBuilder.Save(dataDir + "2d-barcode_out.png", BarCodeImageFormat.Png);
// Save the Barcode image in BMP format
barCodeBuilder.Save(dataDir + "2d-barcode_out.bmp", BarCodeImageFormat.Bmp);
// Save the Barcode image in GIF format
barCodeBuilder.Save(dataDir + "2d-barcode_out.gif", BarCodeImageFormat.Gif);
// Save the Barcode image in TiffInCmyk format
barCodeBuilder.Save(dataDir + "2d-barcode_out.tiff", BarCodeImageFormat.TiffInCmyk);
// Save the Barcode image in EMF format
barCodeBuilder.Save(dataDir + "2d-barcode_out.emf", BarCodeImageFormat.Emf);
// Save the Barcode image in SVG format
barCodeBuilder.Save(dataDir + "2d-barcode_out.svg", BarCodeImageFormat.Svg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create an instance of BarCodeBuilder class
// Set the barcode text
// Set the barcode symbology
using (Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder("123456789012", Aspose.BarCode.Generation.EncodeTypes.EAN13))
{
// Generate Barcode image and store it in a Bitmap
using (System.Drawing.Bitmap barcode = builder.GenerateBarCodeImage())
{
// Load the logo/other image as Bitmap
using (System.Drawing.Bitmap picture = (System.Drawing.Bitmap)System.Drawing.Image.FromFile(@"path_to_your_picture.png"))
{
// Create a new empty image with new Calculated height &amp; width
using (System.Drawing.Bitmap output = new System.Drawing.Bitmap(System.Math.Max(barcode.Width, picture.Width), barcode.Height + picture.Height))
{
// Get the Graphics object
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(output))
{
// Clear the canvas
g.Clear(System.Drawing.Color.White);
// Draw the primary image (barcode image) on the canvas
g.DrawImage(picture, new System.Drawing.PointF(0, 0));
// Draw the second image (logo image) on the canvas inside the barcode image
g.DrawImage(barcode, new System.Drawing.PointF(0, picture.Height));
}
output.Save("output.jpg");
}
}
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("123456789", EncodeTypes.Aztec);
barCodeBuilder.Save(dataDir + "CreateAztecbarcode_out.bmp", BarCodeImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create an instance of BarCodeBuilder class
// Set the barcode text
// Set the barcode symbology
using (Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder("123456789012", Aspose.BarCode.Generation.EncodeTypes.EAN13))
{
// Generate Barcode image and store it in a Bitmap
using (System.Drawing.Bitmap barcode = builder.GenerateBarCodeImage())
{
// Load the logo/other image as Bitmap
using (System.Drawing.Bitmap picture = (System.Drawing.Bitmap)System.Drawing.Image.FromFile(@"path_to_your_picture.png"))
{
// Create a new empty image with new Calculated height &amp; width
using (System.Drawing.Bitmap output = new System.Drawing.Bitmap(System.Math.Max(barcode.Width, picture.Width), barcode.Height + picture.Height))
{
// Get the Graphics object
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(output))
{
// Clear the canvas
g.Clear(System.Drawing.Color.White);
// Draw the primary image (barcode image) on the canvas
g.DrawImage(picture, new System.Drawing.PointF(0, 0));
// Draw the second image (logo image) on the canvas inside the barcode image
g.DrawImage(barcode, new System.Drawing.PointF(0, picture.Height));
}
output.Save("output.jpg");
}
}
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create an instance of BarCodeBuilder class
// Set codetext value and EncodeType
Aspose.BarCode.BarCodeBuilder buidler = new Aspose.BarCode.BarCodeBuilder("ABCDEF123456", Aspose.BarCode.Generation.EncodeTypes.DataMatrix);
// Set the DataMatrix encoding mode to C40
buidler.DataMatrixEncodeMode = Aspose.BarCode.DataMatrixEncodeMode.C40;
// Save the barcode image
buidler.Save("dataMatrixC40.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create an instance of BarCodeBuilder class
// Set codetext value and EncodeType
Aspose.BarCode.BarCodeBuilder buidler = new Aspose.BarCode.BarCodeBuilder("ABCDEF123456", Aspose.BarCode.Generation.EncodeTypes.DataMatrix);
// Set the DataMatrix encoding mode to C40
buidler.DataMatrixEncodeMode = Aspose.BarCode.DataMatrixEncodeMode.C40;
// Save the barcode image
buidler.Save("dataMatrixC40.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("This is the data to be encoded", EncodeTypes.DataMatrix);
// Set Data Matrix EncodeMode
barCodeBuilder.DataMatrixEncodeMode = DataMatrixEncodeMode.ASCII;
barCodeBuilder.Save(dataDir + "ManagePDF417Barcode_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create an instance of BarCodeBuilder class
// Set codetext value and EncodeType
Aspose.BarCode.BarCodeBuilder buidler = new Aspose.BarCode.BarCodeBuilder("abcdef123456", Aspose.BarCode.Generation.EncodeTypes.DataMatrix);
// Set the DataMatrix encoding mode to Text encodation scheme
buidler.DataMatrixEncodeMode = Aspose.BarCode.DataMatrixEncodeMode.Text;
// Save the barcode image
buidler.Save("dataMatrixText.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
// Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.DataMatrix;
// Set Data Matrix EncodeMode
barCodeBuilder.DataMatrixEncodeMode = Aspose.BarCode.DataMatrixEncodeMode.ASCII;
// Set CodeText for barcode
barCodeBuilder.CodeText = "This is the data to be encoded";
barCodeBuilder.Save(dataDir + "ManagePDF417Barcode_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create array for storing multiple barcodes
const int nSize = 4;
string[] lstCodeText = new[] { "code-1", "code-2", "code-3", "code-4" };
const int strFileId = 1;
// Instantiate barcode object and set CodeText & Barcode Symbology
using (BarCodeBuilder builder = new BarCodeBuilder("1234567890",EncodeTypes.MacroPdf417))
{
for (int nCount = 1; nCount <= nSize; nCount++)
{
builder.CodeText = lstCodeText[nCount - 1];
// FileID should be same for all the generated bar codes
builder.MacroPdf417FileID = strFileId;
// Assign segmentID in increasing order (1,2,3,....) and Set the segments count
builder.MacroPdf417SegmentID = nCount;
builder.MacroPdf417SegmentsCount = nSize;
try
{
// Save the barcode (fileid_segmentid.png)
builder.Save(dataDir + strFileId + "_" + nCount + "_out.png", ImageFormat.Png);
Process.Start(dataDir + strFileId + "_" + nCount + "_out.png");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("123456789", EncodeTypes.DataMatrix);
// Width of each module and Save the Barcode image
barCodeBuilder.xDimension = 0.6f;
barCodeBuilder.Save(dataDir + "Datamatrixbarcode_out.bmp", BarCodeImageFormat.Bmp);
Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir + "Datamatrixbarcode_out.bmp");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create an instance of BarCodeBuilder class
// Set codetext value and EncodeType
Aspose.BarCode.BarCodeBuilder buidler = new Aspose.BarCode.BarCodeBuilder("abcdef123456", Aspose.BarCode.Generation.EncodeTypes.DataMatrix);
// Set the DataMatrix encoding mode to Text encodation scheme
buidler.DataMatrixEncodeMode = Aspose.BarCode.DataMatrixEncodeMode.Text;
// Save the barcode image
buidler.Save("dataMatrixText.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("öäüéà è", EncodeTypes.DataMatrix);
// Set Data Matrix EncodeMode to Custom and CodeText Encoding Property
barCodeBuilder.DataMatrixEncodeMode = DataMatrixEncodeMode.Custom;
barCodeBuilder.CodeTextEncoding = Encoding.UTF8;
barCodeBuilder.Save(dataDir + "CustomEncodingModeInDataMatrix_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
try
{
MemoryStream memoryStream = new MemoryStream();
// Instantiate barcode object, Set CodeText, Barcode Symbology and Text Encoding
using (BarCodeBuilder barCodeBuilder = new BarCodeBuilder())
{
BarCodeBuilder builder = new BarCodeBuilder("Слово", EncodeTypes.QR);
barCodeBuilder.CodeTextEncoding = Encoding.UTF8;
barCodeBuilder.Save(dataDir + "" + memoryStream + "_out.png", BarCodeImageFormat.Png);
}
string fileName = dataDir + "" + memoryStream + "_out.png";
using (BarCodeReader reader = new BarCodeReader(fileName, DecodeType.QR))
{
reader.SetDetectEncoding(false);
if (reader.Read())
Console.WriteLine(reader.GetCodeText(Encoding.UTF8)); //"Слово"
}
}
catch (Exception)
{}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Initialize a BarCodeBuilder class object and Set CodeText & Symbology Type
BarCodeBuilder builder = new BarCodeBuilder("12345TEXT", EncodeTypes.QR);
// Set encoding mode, Auto for Micro QR, error correction level
builder.QREncodeMode = QREncodeMode.Auto;
builder.QREncodeType = QREncodeType.Auto;
builder.QRErrorLevel = QRErrorLevel.LevelL;
// Get barcode image Bitmap and Save QR code
Bitmap lBmp = builder.GenerateBarCodeImage();
lBmp.Save(dataDir + "EncodeMicroQRCode_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Initialize a BarCodeBuilder class object
BarCodeBuilder builder = new BarCodeBuilder();
// Set its Symbology
builder.SymbologyType = Symbology.QR;
// Set encoding mode
builder.QREncodeMode = QREncodeMode.Auto;
// Set ForceQR (default) for standard QR
builder.QREncodeType = QREncodeType.ForceQR;
// Set code text
builder.CodeText = "12345TEXT";
// Set error correction level
builder.QRErrorLevel = QRErrorLevel.LevelL;
// Get barcode image Bitmap
Bitmap lBmp = builder.GenerateBarCodeImage();
// Save QR code
lBmp.Save(dataDir + "EncodeQA_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Initialize a BarCodeBuilder class object and Set CodeText & Symbology Type
BarCodeBuilder builder = new BarCodeBuilder("12345TEXT", EncodeTypes.QR)
{
// Set ForceQR (default) for standard QR and Code text
QREncodeMode = QREncodeMode.Auto,
QREncodeType = QREncodeType.ForceQR,
QRErrorLevel = QRErrorLevel.LevelL
};
// Get barcode image Bitmap and Save QR code
Bitmap lBmp = builder.GenerateBarCodeImage();
lBmp.Save(dataDir + "EncodeQA_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// initialize a BarCodeBuilder class object and Set its CodeText & Symbology Type
BarCodeBuilder builder = new BarCodeBuilder("12345TEXT", EncodeTypes.QR);
// Set encoding mode, ForceQR (default) for standard QR, ECI encoding type, error correction level
builder.QREncodeMode = QREncodeMode.ECIEncoding;
builder.QREncodeType = QREncodeType.ForceQR;
builder.ECIEncoding = ECIEncodings.UTF8;
builder.QRErrorLevel = QRErrorLevel.LevelL;
// Get barcode image Bitmap & Save QR code
Bitmap lBmp = builder.GenerateBarCodeImage();
lBmp.Save(dataDir + "EncodeQRCodEInECIMode_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
// Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.Pdf417;
// Set Pdf417 Error correction level
barCodeBuilder.Pdf417ErrorLevel = Pdf417ErrorLevel.Level8;
// Set CodeText for barcode
barCodeBuilder.CodeText = "1234567890";
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create codetext
QrExtCodetextBuilder lTextBuilder = new QrExtCodetextBuilder();
lTextBuilder.AddFNC1FirstPosition();
lTextBuilder.AddPlainCodetext("000%89%%0");
lTextBuilder.AddFNC1GroupSeparator();
lTextBuilder.AddPlainCodetext("12345<FNC1>");
// Generate codetext
string lCodetext = lTextBuilder.GetExtendedCodetext();
// Instantiate barcode object and Set Codetext & SymbologyType
BarCodeBuilder builder = new BarCodeBuilder("1234567890", EncodeTypes.QR);
// Set encoding mode, error correction level and display text
builder.QREncodeMode = QREncodeMode.ExtendedCodetext;
builder.QRErrorLevel = QRErrorLevel.LevelL;
builder.Display2DText = "My Text";
// Get barcode image Bitmap and Save QR code
Bitmap lBmp = builder.GenerateBarCodeImage();
lBmp.Save(dataDir + "FNC1FirstPositionInExtendedMode_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create codetext
QrExtCodetextBuilder lTextBuilder = new QrExtCodetextBuilder();
lTextBuilder.AddFNC1SecondPosition("12");
lTextBuilder.AddPlainCodetext("TRUE3456");
// Generate codetext
string lCodetext = lTextBuilder.GetExtendedCodetext();
// Instantiate barcode object and Set its CodeText, encoding mode, error correction level, display text and Symbology
BarCodeBuilder builder = new BarCodeBuilder(lCodetext, EncodeTypes.QR);
builder.QREncodeMode = QREncodeMode.ExtendedCodetext;
builder.QRErrorLevel = QRErrorLevel.LevelL;
builder.Display2DText = "My Text";
// Get barcode image Bitmap and Save QR code
Bitmap lBmp = builder.GenerateBarCodeImage();
lBmp.Save(dataDir + "FNC1SecondPositionInExtendedMode_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
string codeText = "The quick brown fox jumps over the lazy dog\n" + "The quick brown fox jumps over the lazy dog\n"; ;
// Instantiate barcode object and set CodeText, Symbology , and CodeLocation
BarCodeBuilder barCodeBuilder = new BarCodeBuilder(codeText, EncodeTypes.DataMatrix)
{
CodeLocation = CodeLocation.None
};
barCodeBuilder.Save(dataDir + "HideBarcodeCodeText_out.png", BarCodeImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567890", EncodeTypes.Pdf417);
// Set Pdf417 Error correction level, Compaction Mode to Text and CodeText for barcode
barCodeBuilder.Pdf417ErrorLevel = Pdf417ErrorLevel.Level8;
barCodeBuilder.Pdf417CompactionMode = Pdf417CompactionMode.Text;
barCodeBuilder.CodeText = "1234567890";
barCodeBuilder.Save(dataDir + "ManagePDF417Barcode_out.bmp", ImageFormat.Bmp);
Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir + "Datamatrixbarcode_out.bmp");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create codetext
QrExtCodetextBuilder lTextBuilder = new QrExtCodetextBuilder();
lTextBuilder.AddECICodetext(ECIEncodings.Win1251, "Will");
lTextBuilder.AddECICodetext(ECIEncodings.UTF8, "Right");
lTextBuilder.AddECICodetext(ECIEncodings.UTF16BE, "Power");
lTextBuilder.AddPlainCodetext(@"t\e\\st");
// Generate codetext
string lCodetext = lTextBuilder.GetExtendedCodetext();
// Initialize a BarCodeBuilder class object, Set CodeText, Symbology, Encoding mode, correction level and display text
BarCodeBuilder builder = new BarCodeBuilder(lCodetext, EncodeTypes.QR);
builder.QREncodeMode = QREncodeMode.ExtendedCodetext;
builder.QRErrorLevel = QRErrorLevel.LevelL;
builder.CodeText = lCodetext;
builder.Display2DText = "My Text";
Bitmap lBmp = builder.GenerateBarCodeImage();
lBmp.Save(dataDir + "MultiECIModeInExtendedMode_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
// Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.Pdf417;
// Set Pdf417 Compaction Mode to Text
barCodeBuilder.Pdf417CompactionMode = Pdf417CompactionMode.Text;
barCodeBuilder.Save(dataDir + "ManagePDF417Barcode_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
string codeText = "The quick brown fox jumps over the lazy dog\n" + "The quick brown fox jumps over the lazy dog\n";
// Instantiate barcode object, Set CodeText, Symbology and CodeLocation
BarCodeBuilder barCodeBuilder = new BarCodeBuilder(codeText, EncodeTypes.DataMatrix);
barCodeBuilder.CodeLocation = CodeLocation.None;
barCodeBuilder.Save(dataDir + "HideBarcodeCodeText_out.png", BarCodeImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Create instance of BarCodeBuilder class, Set Aspect Ratio to 3:2 or 1.5 and Save the barcode image to disk in PNG format
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567890", EncodeTypes.Pdf417);
barCodeBuilder.AspectRatio = 1.5f;
barCodeBuilder.Save(dataDir + "SetAspectRatio_out.png", BarCodeImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate BarCodeBuilder object
Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder();
// Set the Code text for the barcode
builder.CodeText = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// Set the symbology type to QR
builder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.QR;
// Set the error level
builder.QRErrorLevel = Aspose.BarCode.QRErrorLevel.LevelQ;
// Set the QR barcode version number
builder.QRVersion = Aspose.BarCode.QRVersion.Version10;
//Save the image
builder.Save("qr_version10_errorQ.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate BarCodeBuilder object
Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder();
// Set the Code text for the barcode
builder.CodeText = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// Set the symbology type to QR
builder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.QR;
// Set the error level
builder.QRErrorLevel = Aspose.BarCode.QRErrorLevel.LevelQ;
// Set the QR barcode version number
builder.QRVersion = Aspose.BarCode.QRVersion.Version10;
//Save the image
builder.Save("qr_version10_errorQ.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
// Instantiate barcode object and set Barcode CodeText & Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("123456789", EncodeTypes.Aztec)
{
// Set Error Error Correction level and Save the Barcode image
AztectErrorLevel = 10
};
barCodeBuilder.Save(dataDir + "UseAztecErrorCorrection_out.bmp", BarCodeImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();
string gtin = "898978777776665655";
string uid = "121212121212121212";
string batch = "GH768";
string expDate = "150923";
string textToEncode = gtin + uid + batch + expDate; // Or "(01)"+ gtin + "(..)"+ uid + ...
string textToDisplay = "GTIN:" + gtin + "\nUID:" + uid + "\nBatch:" + batch + "\nExp.Date:" + expDate;
// Instantiate barcode object and set N order to avoid including all the names into the codetext, the property called "Display2DText" should be used.
BarCodeBuilder builder = new BarCodeBuilder("textToEncode", EncodeTypes.DataMatrix);
builder.Display2DText = textToDisplay;
builder.CodeLocation = CodeLocation.Right;
builder.Margins = new MarginsF(0, 0, 0, 0);
// Builder.CodeTextSpace = 0; // Not recommended small space
// Save the Barcode image
builder.Save(dataDir + "codetextRightDisplay_out.png" , BarCodeImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.Code128))
{
generator.Resolution = 144;
generator.RotationAngle = 90;
generator.Save(dataDir + "rotated_dpi144.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// if you don't have required size, you can use AutoSizeMode = None and set all generator parameters by yourself
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.QR, "Aspose.BarCode sample"))
{
generator.XDimension.Pixels = 3;
generator.Margins.Left.Pixels = 20;
generator.Margins.Right.Pixels = 20;
generator.Save(dataDir + "GenerateBarcodeWithoutRestrictedBarcodeSize_out.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
//If you have restricted requirements of barcode size, then you can set AutoSizeMode = Nearest
//and required barcode size. Barcode generator will calculate all other parameters like
//xDimension, AspectRatio, etc to fit barcode into desired size.
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.QR, "Aspose.BarCode sample"))
{
generator.AutoSizeMode = AutoSizeMode.Nearest;
generator.BarCodeWidth.Pixels = 200;
generator.BarCodeHeight.Pixels = 200;
generator.Save(dataDir + "GenerateBarcodeWithRestrictedBarcodeSize_out.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.Code16K))
{
generator.AutoSizeMode = AutoSizeMode.Nearest;
generator.BarCodeWidth.Pixels = 100;
generator.CodeTextStyle.Location = CodeLocation.None;
generator.Save(dataDir + "Code16K_Nearest.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.QR, "Aspose.BarCode sample"))
{
generator.XDimension.Pixels = 3;
generator.D2.AspectRatio = 1.5f;
generator.RecalculateValues();
Console.WriteLine("Width = " + generator.BarCodeWidth.Pixels);
Console.WriteLine("Height = " + generator.BarCodeWidth.Pixels);
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.AustralianPosteParcel))
{
string codetext = generator.CodeText; //99712345678901234567890103456
}
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.EAN13))
{
string codetext = generator.CodeText; //590123412345
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.QR))
{
generator.QR.Version = QRVersion.Version18;
generator.QR.ErrorLevel = QRErrorLevel.LevelM;
generator.Save(dataDir + "qr_out.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
string CODICE = "(90)0843110730<<<<452287005001T8";
string displayedText = "(90)0843" + Environment.NewLine +
"110730<<<<" + Environment.NewLine +
"452287" + Environment.NewLine +
"005001T8" + Environment.NewLine;
using (BarCodeBuilder builder = new BarCodeBuilder(CODICE, EncodeTypes.GS1DataMatrix))
{
builder.CodeLocation = CodeLocation.Right;
builder.Display2DText = displayedText;
Bitmap barcode = builder.GenerateBarCodeImage();
barcode.Save(dataDir + "Display2DText.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.DotCode))
{
generator.DotCodeMask = 2;
Bitmap barcode = generator.GenerateBarCodeImage();
barcode.Save(dataDir + "DotCode.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.DataMatrix))
{
generator.AutoSizeMode = AutoSizeMode.Interpolation;
generator.BarCodeWidth.Millimeters = 50;
generator.BarCodeHeight.Inches = 1.3f;
Bitmap barcode = generator.GenerateBarCodeImage();
barcode.Save(dataDir + "DataMatrix.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.MaxiCode))
{
generator.MaxiCodeEncodeMode = 5;
Bitmap barcode = generator.GenerateBarCodeImage();
barcode.Save(dataDir + "MaxiCode.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.UpcaGs1DatabarCoupon))
{
generator.Save(dataDir + "UpcaGs1DatabarCoupon.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.UpcaGs1Code128Coupon))
{
generator.CodeText = "514141100906(01)88898765432109";
generator.AutoSizeMode = AutoSizeMode.Interpolation;
generator.BarCodeWidth.Pixels = 500;
generator.BarCodeHeight.Pixels = 200;
generator.Save(dataDir + "UpcaGs1Code128Coupon_Interpolation_500x200.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.QR, "Aspose.BarCode sample"))
{
generator.AutoSizeMode = AutoSizeMode.Nearest;
generator.BarCodeWidth.Millimeters = 20;
generator.BarCodeHeight.Millimeters = 20;
generator.Save(dataDir + "for_display_out.png");
generator.Resolution = 300;
generator.Save(dataDir + "for_printer_out.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Create dataset
DataSet ds = new DataSet("DataSet_BarCode");
// Insert datatable
DataTable ImageTable = new DataTable("DataTable_BarCode");
ImageTable.Columns.Add(new DataColumn("CodeText", typeof(string)));
ImageTable.Columns.Add(new DataColumn("BarCodeImage", typeof(System.Byte[])));
ds.Tables.Add(ImageTable);
// Write schema and display it
System.IO.MemoryStream ms = new System.IO.MemoryStream();
ds.WriteXmlSchema(ms);
this.TextBox1.Text = new string(System.Text.ASCIIEncoding.ASCII.GetChars(ms.GetBuffer()));
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
BarCodeReadType symbologyType = reader.GetReadType();
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
Dim strCodeText As String = reader.GetCodeText()
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
reader.Read();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
private void Form1_Load(object sender, EventArgs e)
{
// This line of code loads data into the 'DataSet1.Product' table. You can move, or remove it, as needed.
this.ProductTableAdapter.Fill(this.DataSet1.Product);
// Create an instance of BarCodeBuilder class and Set the symbology type
BarCodeBuilder builder = new BarCodeBuilder();
builder.SymbologyType = Symbology.Code128;
// Loop through all the rows in the datatable
foreach (DataSet1.ProductRow row in DataSet1.Product.Rows)
{
// Set the codetext as value of "ProductNumber" column
builder.CodeText = row.ProductNumber.ToString();
// Generate the barcode and save it in memory stream
MemoryStream ms = new MemoryStream();
builder.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
// Set the value of "BarCode" column to the memory stream. This would show the barcode image
row.BarCode = ms.GetBuffer();
}
this.reportViewer1.RefreshReport();
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Create an instance of BarCodeBuilder
BarCodeBuilder builder = new BarCodeBuilder();
// Set the symbology type, codetext
builder.SymbologyType = Symbology.Code39Standard;
builder.CodeText = "test-123";
// Get the barcode image and Save the image at the specified location
Image img = builder.BarCodeImage;
img.Save(dataDir + txtBarCodeImage.Text, System.Drawing.Imaging.ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (Bitmap lBitmap = new Bitmap(@"c:\test.jpg"))
{
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeImage(lBitmap, new Rectangle[] { new Rectangle(0, 0, lBitmap.Width, lBitmap.Height) });
while (reader.Read())
Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (Bitmap lBitmap = new Bitmap(@"c:\test.jpg"))
{
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeImage(lBitmap, new Rectangle(0, 0, lBitmap.Width, lBitmap.Height));
while (reader.Read())
Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (FileStream lStream = new FileStream(@"c:\test.jpg", FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeImage(lStream);
while (reader.Read())
Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeReader reader = new BarCodeReader(@"c:\test.jpg", DecodeType.DataMatrix))
{
reader.QualitySettings.AllowInvertImage = true;
while (reader.Read())
Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeReader reader = new BarCodeReader(@"c:\test.jpg"))
{
//set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance;
while (reader.Read())
Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeReader reader = new BarCodeReader(@"c:\test.jpg"))
{
//set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance;
//set separate options
reader.QualitySettings.AllowMedianSmoothing = true;
reader.QualitySettings.MedianSmoothingWindowSize = 5;
while (reader.Read())
Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeReader reader = new BarCodeReader(@"c:\test.jpg"))
{
//default mode is NormalQuality
//set separate options
reader.QualitySettings.AllowMedianSmoothing = true;
reader.QualitySettings.MedianSmoothingWindowSize = 5;
while (reader.Read())
Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Initialize the BarCodeReader class by passing barcode file name and barcode type as parameters
using (BarCodeReader reader = new BarCodeReader(dataDir + "datamatrix-stars.png", DecodeType.DataMatrix))
{
// Set the reader recognition mode and Manual Hint property to speed up recognition process.
reader.RecognitionMode = RecognitionMode.ManualHints;
reader.ManualHints = ManualHint.SpecialFormOfCells;
while (reader.Read())
{
Console.WriteLine(reader.GetCodeType() + ": " + reader.GetCodeText());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Initialize the BarCodeReader class by passing barcode file name and barcode type as parameters
using (BarCodeReader reader = new BarCodeReader(dataDir + "datamatrix-stars.png", DecodeType.DataMatrix))
{
// Set the reader recognition mode and Manual Hint property to speed up recognition process.
reader.RecognitionMode = RecognitionMode.ManualHints;
reader.ManualHints = ManualHint.SpecialFormOfCells;
while (reader.Read())
{
Console.WriteLine(reader.GetCodeType() + ": " + reader.GetCodeText());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Initialize the BarCodeReader class by passing barcode file name and barcode type as parameters
using (BarCodeReader reader = new BarCodeReader(dataDir + "testDotPeen.png", DecodeType.DataMatrix))
{
// Set the reader recognition mode, Manual Hint property to speed up recognition process.
reader.RecognitionMode = RecognitionMode.ManualHints;
reader.ManualHints = ManualHint.SpecialFormOfCells;
while (reader.Read())
{
Console.WriteLine(reader.GetCodeType() + ": " + reader.GetCodeText());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Instantiate BarCodeReader object
BarCodeReader reader = new BarCodeReader(dataDir + "rotatedbarcode.jpg", DecodeType.Code128);
try
{
// Read Code128 bar code and Detect bar code orientation
while (reader.Read())
{
Console.Write(Environment.NewLine + "Rotaion Angle: " + reader.GetAngle());
}
reader.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
}
Console.WriteLine(Environment.NewLine + "Barcode recognized from " + dataDir + "rotatedbarcode.jpg");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Initialize the BarCodeReader object and Set RecognitionMode
using (BarCodeReader reader = new BarCodeReader(dataDir + "code39.png", DecodeType.Code39Standard))
{
reader.RecognitionMode = RecognitionMode.MaxBarCodes;
while (reader.Read())
{
Console.WriteLine(reader.GetCodeType() + ": " + reader.GetCodeText());
Console.WriteLine("IsDeniable: " + reader.GetIsDeniable());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Generate barcode (Sample 1) Initialize BarCode builder class object
BarCodeBuilder builder1 = new BarCodeBuilder("BASE-41 ONLY ALPHA, DIGITS AND PUNCTUATION",EncodeTypes.DataMatrix)
{
// Set ECC level
DatamatrixEcc = DataMatrixEccType.Ecc050
};
builder1.Save(dataDir + "SampleBarcode1_out.png");
// Generate barcode (Sample 2) Initialize BarCode builder class object and Set ECC level.
BarCodeBuilder builder2 = new BarCodeBuilder("BASE-41 ONLY ALPHA, DIGITS AND PUNCTUATION.", EncodeTypes.DataMatrix)
{
DatamatrixEcc = DataMatrixEccType.Ecc050,
};
builder2.Save(dataDir + "SampleBarcode2_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Initialize the BarCodeReader object and Call read method
BarCodeReader reader = new BarCodeReader(dataDir + "Barcode2.png", DecodeType.AllSupportedTypes);
// To get all possible barcodes
reader.RecognitionMode = RecognitionMode.MaxBarCodes;
while (reader.Read())
{
// Display code text, symbology, detected angle, recognition percentage of the barcode
Console.WriteLine("Code Text: " + reader.GetCodeText() + " Symbology: " + reader.GetCodeType() + " Recognition percentage: " + reader.GetAngle());
// Display x and y coordinates of barcode detected
Point[] point = reader.GetRegion().Points;
Console.WriteLine("Top left coordinates: X = " + point[0].X + ", Y = " + point[0].Y);
Console.WriteLine("Bottom left coordinates: X = " + point[1].X + ", Y = " + point[1].Y);
Console.WriteLine("Bottom right coordinates: X = " + point[2].X + ", Y = " + point[2].Y);
Console.WriteLine("Top right coordinates: X = " + point[3].X + ", Y = " + point[3].Y);
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Initialize the BarCodeReader object
BarCodeReader reader = new BarCodeReader(dataDir + "Barcode2.png", DecodeType.AllSupportedTypes);
// Call read method
while (reader.Read())
{
Console.WriteLine(reader.GetCodeText() + " Type: " + reader.GetCodeType());
float percent = reader.GetRecognitionQuality();
}
reader.Close();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Initialize the BarCodeReader object and Call read method
BarCodeReader reader = new BarCodeReader(dataDir + "Barcode2.png", DecodeType.AllSupportedTypes);
while (reader.Read())
{
Console.WriteLine(reader.GetCodeText() + " Type: " + reader.GetCodeType());
float percent = reader.GetRecognitionQuality();
}
reader.Close();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Create an instance of BarCodeReader class and read barcode file
BarCodeReader barCodeReader = new BarCodeReader(dataDir + "Region.png", DecodeType.Code39Standard);
// Try to recognize all possible barcodes in the image
while (barCodeReader.Read())
{
// Get the region information
BarCodeRegion region = barCodeReader.GetRegion();
if (region != null)
{
// Display x and y coordinates of barcode detected
Point[] point = region.Points;
Console.WriteLine("Top left coordinates: X = " + point[0].X + ", Y = " + point[0].Y);
Console.WriteLine("Top right coordinates: X = " + point[1].X + ", Y = " + point[1].Y);
Console.WriteLine("Bottom right coordinates: X = " + point[2].X + ", Y = " + point[2].Y);
Console.WriteLine("Bottom left coordinates: X = " + point[3].X + ", Y = " + point[3].Y);
}
Console.WriteLine("Codetext: " + barCodeReader.GetCodeText());
}
// Close reader
barCodeReader.Close();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Create an instance of BarCodeReader and set image and symbology type to recognize
BarCodeReader barCodeReader = new BarCodeReader(dataDir + "code39.png", DecodeType.Code39Standard);
// Set grayscale image processing
barCodeReader.RecognitionMode = RecognitionMode.MaxBarCodes;
// Try to recognize all possible barcodes in the image and Display the codetext
while (barCodeReader.Read())
{
Console.WriteLine("Codetext: " + barCodeReader.GetCodeText());
}
// Close the reader
barCodeReader.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
Stopwatch watch = new Stopwatch();
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
using (BarCodeReader reader = new BarCodeReader(dataDir + "SymbologyTypebarcode.png", DecodeType.Code128))
{
// Start Stopwatch
watch.Start();
// Set RecognitionMode and ManualHints
reader.RecognitionMode = RecognitionMode.ManualHints;
reader.ManualHints = ManualHint.MedianSmoothing;
while (reader.Read())
{
Console.WriteLine(reader.GetCodeType() + ": " + reader.GetCodeText());
}
// End Stopwatch
watch.Stop();
Console.WriteLine("Time: " + watch.ElapsedMilliseconds + "ms.");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
Stopwatch watch = new Stopwatch();
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
using (BarCodeReader reader = new BarCodeReader(dataDir + "SymbologyTypebarcode.png", DecodeType.Code128))
{
// Start Stopwatch and Set RecognitionMode, ManualHints
watch.Start();
reader.RecognitionMode = RecognitionMode.ManualHints;
reader.ManualHints = ManualHint.MedianSmoothing;
while (reader.Read())
{
Console.WriteLine(reader.GetCodeType() + ": " + reader.GetCodeText());
}
// End Stopwatch
watch.Stop();
Console.WriteLine("Time: " + watch.ElapsedMilliseconds + "ms.");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Create an instance of BarCodeReader and set image and symbology type to recognize
BarCodeReader barCodeReader = new BarCodeReader(dataDir + "code39.png", DecodeType.Code39Standard);
int counter = 0;
// Read all the barcodes from the images
while (barCodeReader.Read())
{
// Display the symbology type, codetext and Get the barcode region
Console.WriteLine("BarCode Type: " + barCodeReader.GetCodeType());
Console.WriteLine("BarCode CodeText: " + barCodeReader.GetCodeText());
BarCodeRegion region = barCodeReader.GetRegion();
if (region != null)
{
// Initialize an object of type Image to get the Graphics object
Image image = Image.FromFile(dataDir + "code39.png");
// Initialize graphics object from the image
Graphics graphics = Graphics.FromImage(image);
// Draw the barcode edges, Save the image and Fill the barcode area with some color
region.DrawBarCodeEdges(graphics, new Pen(Color.Red, 1f));
image.Save(dataDir + string.Format(@"edge_{0}.png", counter++));
region.FillBarCodeRegion(graphics, Brushes.Green);
image.Save(dataDir + string.Format(@"fill_{0}.png", counter++));
}
}
barCodeReader.Close();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
Stopwatch sw = new Stopwatch();
// Start the stopwatch
sw.Start();
// Define the settings to use all of the processor cores, if not then how many to use.
BarCodeReader.ProcessorSettings.UseAllCores = false;
BarCodeReader.ProcessorSettings.UseOnlyThisCoresCount = 4;
// Perform the BarCode recognition task Initialize the BarCodeReader object
using (BarCodeReader reader = new BarCodeReader(dataDir + "code39.png", DecodeType.Code128))
{
while (reader.Read())
{
Console.WriteLine(" Code Text: " + reader.GetCodeText() + " Type: " + reader.GetCodeType());
}
}
// Stop the stopwatch
sw.Stop();
// Write the Elapsed time to console
Console.WriteLine("Elapsed: " + sw.Elapsed);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Create an instance of BarCodeReader class and specify an area to look for the barcode
BarCodeReader reader = new BarCodeReader(new Bitmap(dataDir + "ReadBarcodefromSpecificRegionofImage.png"), new Rectangle(0, 0, 100, 50), DecodeType.Pdf417);
// Read all barcodes in the provided area
while (reader.Read() == true)
{
// Display the codetext and symbology type of the barcode found
Console.WriteLine("Codetext: " + reader.GetCodeText() + " Symbology: " + reader.GetCodeType());
}
// Close the reader
reader.Close();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Create an instance of BarCodeReader class and specify an area to look for the barcode
BarCodeReader reader = new BarCodeReader(new Bitmap(dataDir + "ReadBarcodefromSpecificRegionofImage.png"), new Rectangle(0, 0, 100, 50), DecodeType.Pdf417);
// Read all barcodes in the provided area
while (reader.Read() == true)
{
// Display the codetext and symbology type of the barcode found
Console.WriteLine("Codetext: " + reader.GetCodeText() + " Symbology: " + reader.GetCodeType());
}
// Close the reader
reader.Close();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Initialize the Bitmap object
Bitmap bitmap = new Bitmap(dataDir + "Region.png");
Rectangle[] areas = new Rectangle[3];
areas[0] = new Rectangle(50, 50, 300, 300);
areas[1] = new Rectangle(400, 40, 350, 350);
areas[2] = new Rectangle(40, 500, 700, 150);
// Initialize the BarCodeReader object and load bitmap object
using (BarCodeReader reader = new BarCodeReader(bitmap, areas, DecodeType.Code39Standard))
{
while (reader.Read())
{
Console.WriteLine(reader.GetCodeType() + ": " + reader.GetCodeText());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
string strFileID = "1";
string[] strFileslist = Directory.GetFiles(dataDir + strFileID + "_*.png");
foreach (string strFile in strFileslist)
{
// We got list of all the files, now read barcodes
BarCodeReader reader = new BarCodeReader(strFile, DecodeType.MacroPdf417);
if (reader.Read() == true)
{
Console.WriteLine("File: " + strFile + " == FileID: " + reader.GetMacroPdf417FileID() + " == SegmentID: " + reader.GetMacroPdf417SegmentID() + " == CodeText: " + reader.GetCodeText());
}
// Close the reader
reader.Close();
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
try
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
string strFileID = "1";
string[] strFileslist = Directory.GetFiles(dataDir + strFileID + "_*.png");
foreach (string strFile in strFileslist)
{
// We got list of all the files, now read barcodes
BarCodeReader reader = new BarCodeReader(strFile, DecodeType.MacroPdf417);
if (reader.Read() == true)
{
Console.WriteLine("File: " + strFile + " == FileID: " + reader.GetMacroPdf417FileID() +
" == SegmentID: " + reader.GetMacroPdf417SegmentID() + " == CodeText: " + reader.GetCodeText());
}
// Close the reader
reader.Close();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
try
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Create array for storing multiple bar codes file names
string[] files = new string[] { "Barcodefrom.png", "Barcode2.png" };
// Iiterate through the bar code image files
for (int i = 0; i < files.Length; ++i)
{
// Create instance of BarCodeReader class and set symbology
using (BarCodeReader reader = new BarCodeReader(dataDir + files[i], DecodeType.MacroPdf417))
{
if (reader.Read())
{
// Get code text, file id, segment id and segment count
Console.WriteLine("File Name: " + files[i] + " Code Text: " + reader.GetCodeText());
Console.WriteLine("FileID: " + reader.GetMacroPdf417FileID());
Console.WriteLine("SegmentID: " + reader.GetMacroPdf417SegmentID());
Console.WriteLine("Segment Count: " + reader.GetMacroPdf417SegmentsCount());
}
Console.WriteLine();
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
try
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
BaseDecodeType[] objArray = new BaseDecodeType[] { DecodeType.Code39Standard, DecodeType.Pdf417 };
// Initialize the BarCodeReader, Call Read() method in a loop and Display the codetext and symbology type
BarCodeReader reader = new BarCodeReader(dataDir + "RecognizingMultipleSymbologies.png",objArray);
while (reader.Read())
{
Console.WriteLine("Codetext: " + reader.GetCodeText());
Console.WriteLine("Symbology type: " + reader.GetCodeType());
}
reader.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
try
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Create instance of BarCodeBuilder class
BarCodeReader reader = new BarCodeReader(dataDir + "SymbologyTypebarcode.png", DecodeType.Code128);
while (reader.Read())
{
// Display code text and Symbology Type
Console.WriteLine("CodeText: " + reader.GetCodeText());
Console.Write("Symbology Type: " + reader.GetCodeType());
}
reader.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
try
{
// Read file from directory with DecodeType.EAN13
BarCodeReader reader = new BarCodeReader(dataDir + "Scan.jpg", DecodeType.EAN13);
while (reader.Read())
{
// Read symbology type and code text
Console.WriteLine("Symbology Type: " + reader.GetCodeType());
Console.WriteLine("CodeText: " + reader.GetCodeText());
}
reader.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from https://www.aspose.com/purchase/default.aspx.");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Create an instance of BarCodeReader and set image and symbology type to recognize
BarCodeReader barCodeReader = new BarCodeReader(dataDir + "BarcodeOrientation.png", DecodeType.Code39Standard);
// Aspose.BarCode.BarCodeRecognition.RecognitionHints is obsolete: RecognitionHints is depricated
// Barcode orientation is detected automatically
// barCodeReader.OrientationHints = RecognitionHints.Orientation.Rotate90;
// Try to recognize all possible barcodes in the image and Display the codetext
while (barCodeReader.Read())
{
Console.WriteLine("Codetext: " + barCodeReader.GetCodeText());
}
// Close the reader
barCodeReader.Close();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
// Set border style to solid
barCodeBuilder.BorderDashStyle = Aspose.BarCode.BorderDashStyle.Solid;
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Create instance of BarCodeBuilder class and Get code text
BarCodeReader reader = new BarCodeReader(dataDir + "Scan.jpg");
while (reader.Read())
{
Console.WriteLine("CodeText: " + reader.GetCodeText());
}
reader.Close();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Initialize the BarCodeReader object and Set recognition mode and manual hints
BarCodeReader reader = new BarCodeReader(dataDir + "datamatrix-barcode.jpg", DecodeType.DataMatrix);
reader.RecognitionMode = RecognitionMode.ManualHints;
reader.ManualHints = ManualHint.InvertImage | ManualHint.IncorrectBarcodes;
// Try to recognize all possible barcodes in the image and Display the codetext
while (reader.Read())
{
Console.WriteLine("Codetext: " + reader.GetCodeText());
}
// Close the reader
reader.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set Increase the space between code text and barcode to 1 point
BarCodeBuilder barCodeBuilder = new BarCodeBuilder {CodeTextSpace = 1.0f};
barCodeBuilder.Save(dataDir + "AddSpaceInBarCodeAndText_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder builder = new BarCodeBuilder("1234567890", EncodeTypes.Code39Standard)
{
// Set auto size false, height and width
AutoSize = false,
ImageHeight = 50,
ImageWidth = 120
};
builder.Save(dataDir + "barcode-custom-size_out.jpg");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set different properties
BarCodeBuilder barCodeBuilder = new BarCodeBuilder
{
BorderDashStyle = BorderDashStyle.Solid,
Margins = new MarginsF(2f, 2f, 2f, 2f),
BorderWidth = 0.5f,
BorderVisible = true
};
barCodeBuilder.Save(dataDir + "barcodeImageborders_out.jpeg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and different properties
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567890", EncodeTypes.Code128)
{
Margins = {Left = 0.5f, Right = 0f, Top = 0f, Bottom = 0f}
};
barCodeBuilder.Save(dataDir + "barcode-image-margins_out.jpeg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set CodeText, Barcode Symbology and image quality mode to anti alias
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128)
{
ImageQuality = ImageQualityMode.AntiAlias
};
barCodeBuilder.Save(dataDir + "barcode-image-quality_out.jpeg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128)
{
// Create an instance of resolution and apply on the barcode image with customized resolution settings
Resolution = new Resolution(200f, 400f, ResolutionMode.Customized)
};
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "barcode-image-resolution_out.jpeg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
string dst = dataDir + "colorize-barcode_out.jpg";
// Instantiate barcode object and differnt properties
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128)
{
BackColor = Color.Yellow,
ForeColor = Color.Blue,
BorderColor = Color.Red,
CodeTextColor = Color.Red
};
barCodeBuilder.Save(dst, ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object
using (BarCodeBuilder builder = new BarCodeBuilder("TEXT", EncodeTypes.Pdf417))
{
builder.FilledBars = false;
builder.Save(dataDir + "ControlBarsFillingofOneDBarcodes_out.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Get the default Printer Name
PrinterSettings settings = new PrinterSettings();
string printerName = settings.PrinterName;
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567890", EncodeTypes.Code128);
// Set printer name
barCodeBuilder.PrinterName = printerName;
barCodeBuilder.Print();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set CodeText, Barcode Symbology and hide code text
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567890", EncodeTypes.QR)
{
CodeLocation = CodeLocation.None,
RotationAngleF = 90
};
barCodeBuilder.Save(dataDir + "QR-rotate_out.jpeg", BarCodeImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set CodeText, Barcode Symbology and RotationAngleF
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128) {RotationAngleF = 180};
barCodeBuilder.Save(dataDir + "barcode-image-rotate_out.jpeg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128);
barCodeBuilder.Save(dataDir + "barcode-image-format_out.jpeg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128);
// Create a memory stream object that would store barcode image in binary form
MemoryStream mStream = new MemoryStream();
// Call save method of BarCodeImage to store Png barcode image to memory stream
barCodeBuilder.BarCodeImage.Save(dataDir + mStream + "_out.png", ImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set differnt Properties
BarCodeBuilder barCodeBuilder = new BarCodeBuilder
{
CodeText = "1234567",
CodeTextAlignment = StringAlignment.Center
};
barCodeBuilder.Save(dataDir + "barcode-SetCodeAlignment_out.jpg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and Set Code text font's type and size
BarCodeBuilder barCodeBuilder = new BarCodeBuilder { CodeTextFont = new Font("Verdana", 12f) };
barCodeBuilder.Save(dataDir + "SetCodeTextFontFamilyNameAndSize_out.bmp", ImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Instantiate barcode object and set the Code text and the location for the barcode
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
barCodeBuilder.CodeText = "1234567";
barCodeBuilder.CodeLocation = CodeLocation.Above;
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object set codeText and location
BarCodeBuilder barCodeBuilder = new BarCodeBuilder {CodeText = "1234567", CodeLocation = CodeLocation.Above};
barCodeBuilder.Save(dataDir + "barcode-SetCodetextLocation_out.jpeg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder
{
CaptionAbove =
{
TextAlign = StringAlignment.Near,
Text = "Aspose.Demo",
Visible = true,
Font = new Font("Pristina", 14f),
ForeColor = Color.OrangeRed
}
};
barCodeBuilder.CaptionBelow.TextAlign = StringAlignment.Far;
barCodeBuilder.CaptionBelow.Text = "Aspose.Demo";
barCodeBuilder.CaptionBelow.Visible = true;
barCodeBuilder.CaptionBelow.Font = new Font("Pristina", 14f);
barCodeBuilder.CaptionBelow.ForeColor = Color.OrangeRed;
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "SetFontandColorSetting_out.jpeg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
barCodeBuilder.CaptionAbove.TextAlign = StringAlignment.Near;
barCodeBuilder.CaptionAbove.Text = "Aspose.Demo";
barCodeBuilder.CaptionAbove.Visible = true;
barCodeBuilder.CaptionAbove.Font = new System.Drawing.Font("Pristina", 14f);
barCodeBuilder.CaptionAbove.ForeColor = Color.OrangeRed;
barCodeBuilder.CaptionBelow.TextAlign = StringAlignment.Far;
barCodeBuilder.CaptionBelow.Text = "Aspose.Demo";
barCodeBuilder.CaptionBelow.Visible = true;
barCodeBuilder.CaptionBelow.Font = new System.Drawing.Font("Pristina", 14f);
barCodeBuilder.CaptionBelow.ForeColor = Color.OrangeRed;
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "SetFontandColorSetting.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set differnt barcode properties
BarCodeBuilder barCodeBuilder = new BarCodeBuilder
{
CodeText = "1234567",
CodeTextColor = Color.Red
};
barCodeBuilder.Save(dataDir + "barcode-SetForeColorText_out.jpg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("00850006000227", EncodeTypes.ITF14)
{
// Set Different properties
AutoSize = true,
ITF14BorderType = ITF14BorderType.FrameOut,
CodeTextFont = new Font("OCR B Std", 8.0f),
GraphicsUnit = GraphicsUnit.Millimeter,
xDimension = 0.495f,
BarHeight = 12.7f,
CodeTextSpace = 0.5f,
Resolution = new Resolution(1200.0f, 1200.0f, ResolutionMode.Customized)
};
barCodeBuilder.Save(dataDir + "ITF14_Border_Type_FrameOut_out.png", BarCodeImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("00850006000227", EncodeTypes.ITF14)
{
// Set Different properties
AutoSize = true,
ITF14BorderType = ITF14BorderType.BarOut,
CodeTextFont = new Font("OCR B Std", 8.0f),
GraphicsUnit = GraphicsUnit.Millimeter,
xDimension = 0.495f,
BarHeight = 12.7f,
CodeTextSpace = 0.5f,
Resolution = new Resolution(1200.0f, 1200.0f, ResolutionMode.Customized)
};
barCodeBuilder.Save(dataDir + "ITF14_Border_Type_Bar_out.png", BarCodeImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("00850006000227");
barCodeBuilder.AutoSize = true;
// Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.ITF14;
// Set ITF14 Barcode Border Type
barCodeBuilder.ITF14BorderType = ITF14BorderType.BarOut;
// Set Font
barCodeBuilder.CodeTextFont = new Font("OCR B Std", 8.0f);
// Set Measuring Units
barCodeBuilder.GraphicsUnit = GraphicsUnit.Millimeter;
// Set xDimension
barCodeBuilder.xDimension = 0.495f;
// Set Bars Height
barCodeBuilder.BarHeight = 12.7f;
// Specify space between characters
barCodeBuilder.CodeTextSpace = 0.5f;
// Define resolution and its mode
barCodeBuilder.Resolution = new Resolution(1200.0f, 1200.0f, ResolutionMode.Customized);
// Save the Barcode image
barCodeBuilder.Save( dataDir + "ITF14_Border_Type_BarOut.png", BarCodeImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128)
{
// Set the bar height to 3 points and measuring unit of barcode to point
BarHeight = 3.0f,
GraphicsUnit = GraphicsUnit.Point
};
barCodeBuilder.Save(dataDir + "barcode-size-unit_out.jpeg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
// Set the Code text, symbology type, supplement data for the barcode
barCodeBuilder.CodeText = "123456789123";
barCodeBuilder.SymbologyType = Symbology.EAN13;
barCodeBuilder.SupplementData = "12345";
// Set space between the supplemental barcode and main barcode
barCodeBuilder.SupplementSpace = 2.0f;
barCodeBuilder.Save("SetSupplementData_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodesImages();
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("00850006000227");
barCodeBuilder.AutoSize = true;
// Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.ITF14;
// Set ITF14 Barcode Border Type
barCodeBuilder.ITF14BorderType = ITF14BorderType.BarOut;
// Set Font
barCodeBuilder.CodeTextFont = new Font("OCR B Std", 8.0f);
// Set Measuring Units
barCodeBuilder.GraphicsUnit = GraphicsUnit.Millimeter;
// Set xDimension
barCodeBuilder.xDimension = 0.495f;
// Set Bars Height
barCodeBuilder.BarHeight = 12.7f;
// Specify space between characters
barCodeBuilder.CodeTextSpace = 0.5f;
// Define resolution and its mode
barCodeBuilder.Resolution = new Resolution(1200.0f, 1200.0f, ResolutionMode.Customized);
// Save the Barcode image
barCodeBuilder.Save(dataDir + "ITF14_Border_TypeBar_Out.png", BarCodeImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create an instance of BarCodeReader class and load an existing oncecode barcode.
using (BarCodeReader r = new BarCodeReader(dataDir + "onecode.png", DecodeType.OneCode))
{
// Set the ChecksumValidation property to Off.
r.ChecksumValidation = ChecksumValidation.Off;
while (r.Read())
{
Console.WriteLine(r.GetCodeType() + ": " + r.GetCodeText());
Console.WriteLine("CheckSum: " + r.GetCheckSum());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128)
{
CaptionAbove = {Visible = false}
};
// Create caption object. Set its text and text alignment & also make it visible
Caption caption = new Caption
{
Text = "Aspose",
TextAlign = StringAlignment.Center,
Visible = true,
Font = new Font("Pristina", 14f),
ForeColor = Color.Red
};
// Assign caption object to be displayed above the barcode
barCodeBuilder.CaptionAbove = caption;
Caption captionBelow = new Caption
{
Text = "Aspose.BarCode Caption Below",
TextAlign = StringAlignment.Center,
Visible = true,
Font = new Font("Pristina", 14f),
ForeColor = Color.OrangeRed
};
// Assign caption object to be displayed below the barcode
barCodeBuilder.CaptionBelow = captionBelow;
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "barcode-caption_out.jpg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
//Initialize reader object
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("error5.jpg", Aspose.BarCode.BarCodeRecognition.DecodeType.EAN13))
{
while (reader.Read())
{
//Get code text by passing TRUE to get the Barcode along with checksum value
Console.WriteLine("{0}: {1}", reader.GetCodeType(), reader.GetCodeText(true));
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
//Initialize reader object
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("error5.jpg", Aspose.BarCode.BarCodeRecognition.DecodeType.EAN13))
{
while (reader.Read())
{
//Get code text by passing TRUE to get the Barcode along with checksum value
System.Console.WriteLine("{0}: {1}", reader.GetCodeType(), reader.GetCodeText(true));
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
//Instantiate BarCodeBuilder object
Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder();
//Set the Code text for the barcode
builder.CodeText = "(01)98898765432106(3202)012345(15)991231";
//Set the symbology type to Code128
builder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.DatabarExpandedStacked;
//Set the cloumn property to define segments per row
builder.Columns = 6;
//Save the image
builder.Save("6segmets.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
//Instantiate BarCodeBuilder object
Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder();
//Set the Code text for the barcode
builder.CodeText = "(01)98898765432106(3202)012345(15)991231";
//Set the symbology type to Code128
builder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.DatabarExpandedStacked;
//Set the cloumn property to define segments per row
builder.Columns = 6;
//Save the image
builder.Save("6segmets.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Instantiate barcode object and Set border width
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
barCodeBuilder.BorderWidth = 0.5f;
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code39Standard)
{
// Make the checksum to be visible on the barcode
EnableChecksum = EnableChecksum.Yes
};
barCodeBuilder.Save(dataDir + "code39-checeksum_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
//Generation
//Instantiate BarCodeBuilder object
Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder();
//Set the Code text for the barcode
builder.CodeText = "1234567890";
//Set the symbology type to Code128
builder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.Codabar;
//Set the EnableChecksum property to yes
builder.EnableChecksum = Aspose.BarCode.EnableChecksum.Yes;
//Set the CodabarChecksumMode
builder.CodabarChecksumMode = Aspose.BarCode.CodabarChecksumMode.Mod10;
//Save the image on the system
builder.Save("Codabar_Mod10.png");
//Recognition
//Initialize reader object
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("Codabar_Mod10.png", Aspose.BarCode.BarCodeRecognition.DecodeType.Codabar))
{
//Set ChecksumValidation property of the reader to On
reader.ChecksumValidation = Aspose.BarCode.BarCodeRecognition.ChecksumValidation.On;
while (reader.Read())
{
//Get code text
System.Console.WriteLine("{0}:{1}", reader.GetCodeType(), reader.GetCodeText());
//Get checksum value
System.Console.WriteLine("Checksum:" + reader.GetCheckSum());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
//Generation
//Instantiate BarCodeBuilder object
Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder();
//Set the Code text for the barcode
builder.CodeText = "1234567890";
//Set the symbology type to Code128
builder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.Codabar;
//Set the EnableChecksum property to yes
builder.EnableChecksum = Aspose.BarCode.EnableChecksum.Yes;
//Set the CodabarChecksumMode
builder.CodabarChecksumMode = Aspose.BarCode.CodabarChecksumMode.Mod10;
//Save the image on the system
builder.Save("Codabar_Mod10.png");
//Recognition
//Initialize reader object
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("Codabar_Mod10.png", Aspose.BarCode.BarCodeRecognition.DecodeType.Codabar))
{
//Set ChecksumValidation property of the reader to On
reader.ChecksumValidation = Aspose.BarCode.BarCodeRecognition.ChecksumValidation.On;
while (reader.Read())
{
//Get code text
Console.WriteLine("{0}:{1}", reader.GetCodeType(), reader.GetCodeText());
//Get checksum value
Console.WriteLine("Checksum:" + reader.GetCheckSum());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create instance of BarCodeBuilder, specify codetext and symbology in the constructor
BarCodeBuilder builder = new BarCodeBuilder("11112222333344", EncodeTypes.Codabar)
{
// Set the codabar start symbol to A and stop symbol to D
CodabarStartSymbol = CodabarSymbol.A,
CodabarStopSymbol = CodabarSymbol.D
};
builder.Save(dataDir + "Coabar-start-stop-symbols_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
string dst = dataDir + "codetext-appearence_out.jpg";
// Set the symbology type to Code128
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128)
{
// Set differnt barcode properties
CodeTextAlignment = StringAlignment.Center,
CodeLocation = CodeLocation.Above,
CodeTextColor = Color.Red,
CodeTextSpace = 1.0f
};
barCodeBuilder.Save(dst, ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Generate the barcode and set code text, symbology type
BarCodeBuilder builder = new BarCodeBuilder("One thing 2 thing", EncodeTypes.Pdf417);
// Set the code text location, graphics unit and margins
builder.CodeLocation = CodeLocation.None;
builder.GraphicsUnit = GraphicsUnit.Pixel;
builder.Margins.Set(0);
// Get Bitmap with exact barcode only
Bitmap bmp = builder.GetOnlyBarCodeImage();
// Allows to set size for whole picture with barcode inside and Save image on local disk
Bitmap bitmap = builder.GetCustomSizeBarCodeImage(new Size(bmp.Width * 5, bmp.Height * 5), false);
bitmap.Save(dataDir + "CreateAndSetSizeForImageWithBarcode_out.Png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234", EncodeTypes.Code128);
barCodeBuilder.Save(dataDir + "Code128-customized_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("514141100906(8102)03", EncodeTypes.UpcaGs1Code128Coupon);
barCodeBuilder.Save(dataDir + "UpcaGs1Code128Coupon_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567890",EncodeTypes.DataMatrix);
barCodeBuilder.Save(dataDir + "datamatrix-barcode_out.jpg", BarCodeImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Generate the barcode and set code text, symbology type
BarCodeBuilder builder = new BarCodeBuilder("123456", EncodeTypes.Code128);
// Get bitmap with exact barcode only and Save image on local disk
Bitmap bmp = builder.GetOnlyBarCodeImage();
bmp.Save(dataDir + "CreateImageWithExactBarcodeOnly_out.png", ImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate BarCodeBuilder object Set the Code text & SymbologyType for the barcode
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567890", EncodeTypes.Pdf417);
barCodeBuilder.Save(dataDir + "pdf417-barcode_out.jpg", BarCodeImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
const string codetext = "被洪水困住的";
// Generate the barcode
BarCodeBuilder builder = new BarCodeBuilder(codetext, EncodeTypes.Pdf417);
// Encode the code text and Set the display text
byte[] bytes = Encoding.GetEncoding(936).GetBytes(codetext);
builder.SetBinaryCodeText(bytes);
builder.Display2DText = codetext;
builder.Save(dataDir + "CreatePdf417BarcodeWithChineseCharacters_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
const string codetext = "AYŞE" + "\n" + "Ümit" + "\n" + "Ümit@estee.com" + "\n" + "Türkiye";
// Generate the barcode
BarCodeBuilder builder = new BarCodeBuilder(codetext, EncodeTypes.Pdf417);
// Encode the code text and Set the display text
byte[] bytes = Encoding.GetEncoding(1254).GetBytes(codetext);
builder.SetBinaryCodeText(bytes);
builder.Display2DText = codetext;
builder.Save(dataDir + "CreatePdf417BarcodeWithTurkishCharacters_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Create an instance of BarCodeBuilder class
// Set barcode text
// Set encoding type
//using (Aspose.BarCode.BarCodeBuilder barCodeBuilder = new Aspose.BarCode.BarCodeBuilder("12345678", Aspose.BarCode.Generation.EncodeTypes.Postnet))
using (Aspose.BarCode.BarCodeBuilder barCodeBuilder = new Aspose.BarCode.BarCodeBuilder("12345678", Aspose.BarCode.Generation.EncodeTypes.AustraliaPost))
{
// Set barcode Dimension and height
barCodeBuilder.xDimension = 1f;
barCodeBuilder.BarHeight = 40;
// Save the barcode image
barCodeBuilder.Save("postnet.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create an instance of BarCodeBuilder class
// Set barcode text
// Set encoding type
//using (Aspose.BarCode.BarCodeBuilder barCodeBuilder = new Aspose.BarCode.BarCodeBuilder("12345678", Aspose.BarCode.Generation.EncodeTypes.Postnet))
using (Aspose.BarCode.BarCodeBuilder barCodeBuilder = new Aspose.BarCode.BarCodeBuilder("12345678", Aspose.BarCode.Generation.EncodeTypes.AustraliaPost))
{
// Set barcode Dimension and height
barCodeBuilder.xDimension = 1f;
barCodeBuilder.BarHeight = 40;
// Save the barcode image
barCodeBuilder.Save("postnet.png");
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBarCodeBuilder = new BarCodeBuilder("1234567890", EncodeTypes.QR);
barCodeBarCodeBuilder.Save(dataDir + "CreateQRbarcode_out.bmp", BarCodeImageFormat.Bmp);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("512345678900(8110)001234502239811110555",EncodeTypes.UpcaGs1DatabarCoupon)
{
// Set barcode caption and barcode
CaptionAbove = {Text = "012345-022398"}
};
barCodeBuilder.Save(dataDir + "couponUpcaDatabar_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and set Always show checksum on image
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("0123456789", EncodeTypes.Code39Standard)
{
AlwaysShowChecksum = true
};
barCodeBuilder.Save(dataDir + "DisplayChecksumCharacter_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Instantiate barcode object and Enable border to be shown in the barcode
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
barCodeBuilder.BorderVisible = true;
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Initialize the BarCodeBuilder class by passing barcode text and barcode symbology as parameters.
BarCodeBuilder builder = new BarCodeBuilder("abcdefghijklmnopqrstuvwxyzabcdef", EncodeTypes.DataMatrix)
{
// Set various different properties/variables of the barcode.
BorderVisible = true,
ImageQuality = ImageQualityMode.AntiAlias,
CodeLocation = CodeLocation.Above,
Columns = 4,
Rows = 3,
CaptionAbove = new Caption("{Caption ABOVE}")
{
TextAlign = StringAlignment.Center,
Visible = true,
ForeColor = Color.Green
}
};
// Specify caption settings.
builder.CaptionBelow = new Caption("{Caption BELOW}");
builder.CaptionBelow.TextAlign = StringAlignment.Far;
builder.CaptionBelow.Visible = true;
builder.CaptionBelow.ForeColor = Color.Yellow;
// Specify text font settings.
builder.CodeTextFont = new Font("Courier New", 24, FontStyle.Bold | FontStyle.Italic);
// Call the export to XML method to export the properties to XML file.
builder.ExportToXml(dataDir + "BarCodeBuilder.DataMatrix_out.xml");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Generate the barcode
Bitmap imgBarcode = null;
BarCodeBuilder objBarCodeBuilder = new BarCodeBuilder {EncodeType = EncodeTypes.MacroPdf417};
// Set the codetext by converting it into unicode byte array
byte[] byteArray = Encoding.Unicode.GetBytes("منحة");
objBarCodeBuilder.SetBinaryCodeText(byteArray);
imgBarcode = objBarCodeBuilder.GenerateBarCodeImage();
imgBarcode.Save(dataDir + "GenerateAndRecognizeUTF8Characters_out.png");
// Recognize the above barcode
BarCodeReader reader = new BarCodeReader(dataDir + "GenerateAndRecognizeUTF8Characters_out.png");
while (reader.Read())
{
Encoding unicode = Encoding.Unicode;
// Get the characters array from the bytes
char[] unicodeChars = new char[unicode.GetCharCount(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length)];
unicode.GetChars(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length, unicodeChars, 0);
// Build unicode string
string strCodeText = new string(unicodeChars);
Console.WriteLine(strCodeText);
}
reader.Close();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Set codetext
string codeText = "12345678";
// Initialize BarCodeBuilder
BarCodeBuilder builder = new BarCodeBuilder(codeText, Symbology.AustraliaPost);
// Set format control code to standard
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.Standard;
// Save the image to disk in PNG format
builder.Save(dataDir + "AustraliaPost-Standard_out.png");
// Set format control code to ReplyPaid
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.ReplyPaid;
// Save the image to disk in PNG format
builder.Save(dataDir + "AustraliaPost-ReplyPaid_out.png");
// Set format control code to Customer2
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.Customer2;
// Save the image to disk in PNG format
builder.Save(dataDir + "AustraliaPost-Customer2_out.png");
// Set format control code to Customer3
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.Customer3;
// Save the image to disk in PNG format
builder.Save(dataDir + "AustraliaPost-Customer3_out.png");
// Set format control code to Routing
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.Routing;
// Save the image to disk in PNG format
builder.Save(dataDir + "AustraliaPost-Routing_out.png");
// Set format control code to Redirection
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.Redirection;
// Save the image to disk in PNG format
builder.Save(dataDir + "AustraliaPost-Redirection_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Initialize BarCode builder class object and set symbology type as Aztec and set the barcode text
BarCodeBuilder builder = new BarCodeBuilder("25", Symbology.Aztec);
// Save barcode
builder.Save(dataDir + "Aztec_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create instance of BarCodeBuilder class.
BarCodeBuilder b = new BarCodeBuilder();
// Specify code text and set encode type.
b.CodeText = "CODABLOCKF 01234567890123456789012digits";
b.EncodeType = EncodeTypes.CodablockF;
// Save the image to disk in PNG format
b.BarCodeImage.Save("CodablockF_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create instance of BarCodeBuilder class.
BarCodeBuilder b = new BarCodeBuilder();
// Specify code text and set encode type.
b.CodeText = "(8012)ABC123";
b.EncodeType = EncodeTypes.GS1Code128;
// Save the image to disk in PNG format
b.BarCodeImage.Save("AI8012_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create instance of BarCodeBuilder class.
BarCodeBuilder b = new BarCodeBuilder();
// Specify code text and set encode type.
b.CodeText = "(01)03412345678900(17)010200";
b.EncodeType = EncodeTypes.GS1CodablockF;
// Save the image to disk in PNG format
b.BarCodeImage.Save("GS1CodablockF_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
Console.WriteLine("Assembly version: " + BuildVersionInfo.AssemblyVersion);
Console.WriteLine("File Version: " + BuildVersionInfo.FileVersion);
Console.WriteLine("Product: " + BuildVersionInfo.Product);
Console.WriteLine("Product Major: " + BuildVersionInfo.ProductMajor);
Console.WriteLine("Product Minor: " + BuildVersionInfo.ProductMinor);
Console.WriteLine("Release Date: " + BuildVersionInfo.ReleaseDate);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Create an instance of BarCodeBuilder class
// Set barcode text
// Set encoding type
using (Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder("1234567890", Aspose.BarCode.Generation.EncodeTypes.Code128))
{
// Set graphic unit
builder.GraphicsUnit = System.Drawing.GraphicsUnit.Pixel;
// Call GetMinimumBarCodeSize method to get the minimum size required
System.Drawing.SizeF minSize = builder.GetMinimumBarCodeSize();
// Set Auto size to false
builder.AutoSize = false;
// Set image height & width with the help of min size got from GetMinimumBarCodeSize method
builder.ImageWidth = minSize.Width;
builder.ImageHeight = minSize.Height;
// Save the barcode image
using (System.Drawing.Bitmap image = builder.BarCodeImage)
image.Save("minimumresult.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Create an instance of BarCodeBuilder class
// Set barcode text
// Set encoding type
using (Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder("1234567890", Aspose.BarCode.Generation.EncodeTypes.Code128))
{
// Set graphic unit
builder.GraphicsUnit = System.Drawing.GraphicsUnit.Pixel;
// Call GetMinimumBarCodeSize method to get the minimum size required
System.Drawing.SizeF minSize = builder.GetMinimumBarCodeSize();
// Set Auto size to false
builder.AutoSize = false;
// Set image height & width with the help of min size got from GetMinimumBarCodeSize method
builder.ImageWidth = minSize.Width;
builder.ImageHeight = minSize.Height;
// Save the barcode image
using (System.Drawing.Bitmap image = builder.BarCodeImage)
image.Save("minimumresult.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create an instance of BarCodeReader class
// Set file path
// Set the recognition type
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("1bc.png", Aspose.BarCode.BarCodeRecognition.DecodeType.Code128))
{
// Perform read operation
if (reader.Read())
{
// Create an array of Code128DataPortion class
// Call the GetCode128DataPortions method
Aspose.BarCode.BarCodeRecognition.Code128DataPortion[] code128DataPortions = reader.GetCode128DataPortions();
// Execute Loop for each Code128DataPortion instance
foreach (Aspose.BarCode.BarCodeRecognition.Code128DataPortion code128DataPortion in code128DataPortions)
{
// Display the subtype and data
System.Console.WriteLine("Code128SubType {0}", code128DataPortion.Code128SubType);
System.Console.WriteLine("Data {0}", code128DataPortion.Data);
}
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create an instance of BarCodeReader class
// Set file path
// Set the recognition type
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("1bc.png", Aspose.BarCode.BarCodeRecognition.DecodeType.Code128))
{
// Perform read operation
if (reader.Read())
{
// Create an array of Code128DataPortion class
// Call the GetCode128DataPortions method
Aspose.BarCode.BarCodeRecognition.Code128DataPortion[] code128DataPortions = reader.GetCode128DataPortions();
// Execute Loop for each Code128DataPortion instance
foreach (Aspose.BarCode.BarCodeRecognition.Code128DataPortion code128DataPortion in code128DataPortions)
{
// Display the subtype and data
Console.WriteLine("Code128SubType {0}", code128DataPortion.Code128SubType);
Console.WriteLine("Data {0}", code128DataPortion.Data);
}
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128);
// Create caption object. Set its text and text alignment & also make it visible
Caption caption = new Caption
{
Text = "Aspose.BarCode",
TextAlign = StringAlignment.Center,
Visible = true
};
// Assign caption object to be displayed above and below the barcode
barCodeBuilder.CaptionAbove = caption;
barCodeBuilder.CaptionBelow = caption;
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "ManageCaption_out.jpg", ImageFormat.Jpeg);
Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
string dstCode128 = dataDir + "code128-YDimensionChanged_out.jpg";
// Instantiate barcode object and set CodeText & Barcode Symbology
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128);
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dstCode128, ImageFormat.Jpeg);
// Set the X-Dimension for the bars of the barcode
barCodeBuilder.xDimension = 0.5f;
// Set the measuring unit of barcode to millimeter
barCodeBuilder.GraphicsUnit = GraphicsUnit.Millimeter;
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dstCode128, ImageFormat.Jpeg);
// Instantiate barcode object and set differnt barcode properties
BarCodeBuilder barCodeBuilder1 = new BarCodeBuilder("1234567", EncodeTypes.Pdf417)
{
yDimension = 4
};
// Save the image to your system and set its image format to Jpeg
barCodeBuilder1.Save(dataDir + "pdf417-YDimensionChanged_out.jpg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Instantiate barcode object and Set border margins by assigning an instance of MarginsF
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
barCodeBuilder.Margins = new Aspose.BarCode.MarginsF(2f, 2f, 2f, 2f);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Instantiate BarCodeBuilder object
BarCodeBuilder builder = new BarCodeBuilder("348503498549085409", EncodeTypes.EAN13);
try
{
// Error message will not been thrown in case of false, default value is also false and Get barcode image
builder.ThrowExceptionWhenCodeTextIncorrect = true;
Bitmap bitmap = builder.GenerateBarCodeImage();
}
catch (Exception ex)
{
Console.WriteLine("Exception must be thrown, {0}", ex.Message);
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
List<FoundBarCodes> found = new List<FoundBarCodes>();
using (BarCodeReader reader = new BarCodeReader(dataDir + "tiffImage.tif", DecodeType.Code128))
{
while (reader.Read())
found.Add(new FoundBarCodes(reader.GetCodeText(), reader.GetRegion()));
}
found.Sort(new FoundComparator());
int i = 1;
foreach (FoundBarCodes barcode in found)
{
Console.WriteLine("Codetext ( " + i + " ): " + barcode.CodeText);
Console.WriteLine("Top left coordinates: X = " + barcode.region.Points[0].X + ", Y = " + barcode.region.Points[0].Y);
Console.WriteLine("Bottom left coordinates: X = " + barcode.region.Points[1].X + ", Y = " + barcode.region.Points[1].Y);
Console.WriteLine("Bottom right coordinates: X = " + barcode.region.Points[2].X + ", Y = " + barcode.region.Points[2].Y);
Console.WriteLine("Top right coordinates: X = " + barcode.region.Points[3].X + ", Y = " + barcode.region.Points[3].Y);
Console.WriteLine();
i++;
}
}
public struct FoundBarCodes
{
public readonly string CodeText;
public readonly BarCodeRegion region;
public FoundBarCodes(string text, BarCodeRegion reg)
{
CodeText = text;
region = reg;
}
}
public class FoundComparator : IComparer<FoundBarCodes>
{
public int Compare(FoundBarCodes found1, FoundBarCodes found2)
{
Point[] found1Points = found1.region.Points;
Point[] found2Points = found2.region.Points;
Point found1XyMin = new Point(int.MaxValue, int.MaxValue);
Point found2XyMin = new Point(int.MaxValue, int.MaxValue);
foreach (Point p in found1Points)
if (p.X < found1XyMin.X && p.Y < found1XyMin.Y)
{
found1XyMin.X = p.X;
found1XyMin.Y = p.Y;
}
foreach (Point p in found2Points)
if (p.X < found2XyMin.X && p.Y < found2XyMin.Y)
{
found2XyMin.X = p.X;
found2XyMin.Y = p.Y;
}
if (found1XyMin.X < found2XyMin.X && found1XyMin.Y < found2XyMin.Y)
return -1;
if (found1XyMin.X > found2XyMin.X && found1XyMin.Y > found2XyMin.Y)
return 1;
if (found1XyMin.Y < found2XyMin.Y)
return -1;
if (found1XyMin.Y > found2XyMin.Y)
return 1;
return 0;
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
var img = Image.FromFile(dataDir + "tiffImage.tif");
int totalFrame = img.GetFrameCount(FrameDimension.Page);
// Feed the pages to BarCodeReader one by one
for (int i = 0; i < totalFrame; i++)
{
// Set the active page and feed it to the BarCodeReader
var w = img.SelectActiveFrame(FrameDimension.Page, i);
var bitmap = new Bitmap(img);
BarCodeReader reader = new BarCodeReader(bitmap, DecodeType.AllSupportedTypes);
while (reader.Read())
{
Console.WriteLine(reader.GetCodeText() + " " + reader.GetCodeType());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeReader reader = new BarCodeReader("test.png", DecodeType.MostCommonTypes))
{
while (reader.Read())
{
Console.WriteLine(reader.GetCodeType().ToString() + " " + reader.GetCodeText());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeReader reader = new BarCodeReader("test.png", DecodeType.PostalTypes))
{
while (reader.Read())
{
Console.WriteLine(reader.GetCodeType().ToString() + " " + reader.GetCodeText());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using (BarCodeReader reader = new BarCodeReader("test.png", DecodeType.Types1D))
{
while (reader.Read())
{
Console.WriteLine(reader.GetCodeType().ToString() + " " + reader.GetCodeText());
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Load barcode image and Read barcode
var reader = new BarCodeReader(dataDir + "Chinese.png", DecodeType.Pdf417);
while (reader.Read())
{
var t = reader.GetCodeBytes();
var encodingValue = Encoding.GetEncoding(1254).GetString(t);
}
reader.Close();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Load barcode image and Read barcode
var reader = new BarCodeReader(dataDir + "Turkish.png", DecodeType.Pdf417);
while (reader.Read())
{
var t = reader.GetCodeBytes();
var encodingValue = Encoding.GetEncoding(1254).GetString(t);
}
reader.Close();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create an instance of BarCodeBuilder class.
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
// Set the Code text, barcode type, and AztecSymbolMode property.
barCodeBuilder.CodeText = "25";
barCodeBuilder.SymbologyType = Symbology.Aztec;
barCodeBuilder.AztecSymbolMode = AztecSymbolMode.Rune;
barCodeBuilder.BarCodeImage.Save(dataDir + "SetAztecSymbolMode_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Instantiate barcode object and Set border style to solid
BarCodeBuilder barCodeBuilder = new BarCodeBuilder();
barCodeBuilder.BorderDashStyle = Aspose.BarCode.BorderDashStyle.Solid;
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and set differnt barcode properties
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128) { xDimension = 1f };
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "barcode-codetext_out.jpg", ImageFormat.Jpeg);
Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir + "barcode-codetext_out.jpg");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and set differnt barcode properties
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128)
{
BarHeight = 3.0f,
GraphicsUnit = GraphicsUnit.Millimeter
};
// Save the image locally and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "barcode3_out.jpg", ImageFormat.Jpeg);
// Set the bar height to 3 millimeters and Save the image locally and set its image format to Jpeg
barCodeBuilder.BarHeight = 7.0f;
barCodeBuilder.Save(dataDir + "barcode7_out.jpg", ImageFormat.Jpeg);
// Set the bar height to 3 millimeters and Save the image to disk
barCodeBuilder.BarHeight = 11.0f;
barCodeBuilder.Save(dataDir + "Code128-bar-height_out.jpg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and Set the SymbologyType and Height and Resolution for barcode
BarCodeBuilder builder = new BarCodeBuilder("(01)90013670000396(3200)15(11)150819",EncodeTypes.DatabarStackedOmniDirectional)
{
xDimension = 0.330f,
BarHeight = 27.77f,
Resolution = new Resolution(1200.0f, 1200.0f, ResolutionMode.Customized)
};
// Save the image to your system and set its image format to Jpeg
builder.Save(dataDir + "Barheight_out.png", BarCodeImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create instance of BarCodeBuilder, specify codetext symbology and encode mode
BarCodeBuilder builder = new BarCodeBuilder("test123", EncodeTypes.QR) {QREncodeMode = QREncodeMode.Auto};
builder.Save(dataDir + "QR-Encode-mode_out.jpg");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create instance of BarCodeBuilder, specify codetext and symbology in the constructor
BarCodeBuilder builder = new BarCodeBuilder("1234567890", EncodeTypes.QR);
// Set QRErrorLevel and Save the file to disk.
builder.QRErrorLevel = QRErrorLevel.LevelH;
builder.Save(dataDir + "QR-error-correction_out.jpg", BarCodeImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("123456789123", EncodeTypes.EAN13)
{
// Set the supplement data (5 Digit)
SupplementData = "12345",
SupplementSpace = 2.0f
};
barCodeBuilder.Save(dataDir + "SetSupplementData_out.jpg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Create an instance of BarCodeBuilder class and set the symbology and code text.
BarCodeBuilder builder = new BarCodeBuilder("12345", Symbology.Code39Standard);
// Set the GraphicsUnit property to Millimeter.
builder.GraphicsUnit = Aspose.BarCode.GraphicsUnit.Millimeter;
// Set the dimension and bar height
builder.xDimension = 0.22f;
builder.BarHeight = 15f;
// Set the barcode resolution.
builder.Resolution = new Resolution(72, 72, ResolutionMode.Customized);
// For .NET 2.0 and upper, to compare results, set margins like default of compact edition
builder.Margins = new MarginsF(8, 6, 4, 2);
System.Drawing.Bitmap barcodeImage = builder.GenerateBarCodeImage();
// Compact case: put to pictureBox
pictureBox1.Image = barcodeImage;
barcodeImage.Save(dataDir + "barcode_out.png", System.Drawing.Imaging.ImageFormat.Png);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Set the symbology and code text and X dimension reduction property of barcode and save barcode Image
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("blackReduction", EncodeTypes.Code128)
{
xDimension = 1.2f,
BarWidthReduction = 0.2f
};
barCodeBuilder.Save(dataDir + "SetWideNarrowRatio_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object
BarCodeBuilder bb = new BarCodeBuilder("1234567", EncodeTypes.Code128);
bb.Save(dataDir + "barcode-SpecifySymbologies_out.jpg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate barcode object and set differnt barcode properties
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128);
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "barcode-symbiology_out.jpg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Generate the barcode, Set codeText, SymbologyType and Save barcode on local disk
BarCodeBuilder builder = new BarCodeBuilder("989967121212121212", EncodeTypes.SwissPostParcel);
builder.Save(dataDir + "SwissPostParcelBarcodeWithAdditionalServiceType_out.Png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Generate the barcode and Save barcode on local
BarCodeBuilder builder = new BarCodeBuilder("RA121212122CH", EncodeTypes.SwissPostParcel);
builder.Save(dataDir + "SwissPostParcelBarcodeWithInternationalMailType_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Generate the barcode and Save barcode on local
BarCodeBuilder builder = new BarCodeBuilder("0610", EncodeTypes.SwissPostParcel);
builder.Save(dataDir + "SwissPostParcelSymbology_out.png");
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();
// Instantiate linear barcode object
BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567",EncodeTypes.Code39Standard);
// Set the wide to narrow ratio for the barcode
barCodeBuilder.WideNarrowRatio = 3.0f;
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "barcode_ratio_3_out.jpg", ImageFormat.Jpeg);
// Set the wide to narrow ratio for the barcode
barCodeBuilder.WideNarrowRatio = 5.0f;
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "barcode_ratio_5_out.jpg", ImageFormat.Jpeg);
// Set the wide to narrow ratio for the barcode
barCodeBuilder.WideNarrowRatio = 7.0f;
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "barcode_ratio_7_out.jpg", ImageFormat.Jpeg);
// Set the wide to narrow ratio for the barcode
barCodeBuilder.WideNarrowRatio = 9.0f;
// Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir + "code39-wide-narrow-ratio_out.jpg", ImageFormat.Jpeg);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Create an instance of BarCodeBuilder
BarCodeBuilder builder = new BarCodeBuilder();
// Set the symbology type, codetext
builder.SymbologyType = Symbology.Code39Standard;
builder.CodeText = "test-123";
// Get the barcode image and Place the image on the Picturebox control
Image img = builder.BarCodeImage;
pictureBox1.Image = img;
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
private void previewButton_Click(object sender, System.EventArgs e)
{
printPreviewDialog1.Document=printDocument1;
printPreviewDialog1.ShowDialog();
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
private void printButton_Click(object sender, System.EventArgs e)
{
printDocument1.Print();
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(barCodeControl1.BarCodeImage, 350, 40);
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Create an instance of BarCodeReader
BarCodeReader reader = new BarCodeReader(txtBarCodeImage.Text, BarCodeReadType.Code39Standard);
// Set the symbology type to Code39Standard
// Recognize the barcode
string strMessage = "";
// Get codetext and symbology types of all the barcodes recognized
while(reader.Read())
{
strMessage += "CodeText: " + reader.getCodeText() + "\nSymbology Type: " + reader.getReadType().ToString() + "\n";
}
reader.Close();
MessageBox.Show(strMessage);
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Create barcode builder
Aspose.BarCode.BarCodeBuilder bb;
bb = new Aspose.BarCode.BarCodeBuilder();
bb.CodeText = codeText;
bb.BorderVisible = false;
bb.BarHeight = 15f;
bb.SymbologyType = Aspose.BarCode.Symbology.Code128;
bb.xDimension = 0.6f;
bb.Resolution.DpiX = 300f;
bb.Resolution.DpiY = 300f;
// Save barcode image to stream
System.IO.MemoryStream ms;
ms = new System.IO.MemoryStream();
bb.BarCodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
// Create DataSet_BarCode
DataSet_BarCode ds = new DataSet_BarCode();
DataRow dr = ds.Tables["DataTable_BarCode"].NewRow();
dr["CodeText"] = codeText;
dr["BarCodeImage"] = ms.GetBuffer();
ds.Tables["DataTable_BarCode"].Rows.Add(dr);
CrystalReport1 barcodeReport = new CrystalReport1();
barcodeReport.SetDataSource(ds);
this.CrystalReportViewer1.ReportSource = barcodeReport;
this.CrystalReportViewer1.DataBind();
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
void RetrieveFromDB()
{
SqlConnection con = null;
try
{
con = new SqlConnection(connectionString);
string sqlStatement = "SELECT * FROM barcodes";
SqlDataAdapter adapter = new SqlDataAdapter(sqlStatement, con);
DataTable dt = new DataTable("barcodes");
adapter.Fill(dt);
BarCodeControl bcc = new BarCodeControl();
bcc.CodeText = dt.Rows[0]["codetext"].ToString();
bcc.SymbologyType = (Symbology)Enum.Parse(typeof(Symbology), dt.Rows[0]["symbology"].ToString(), true);
panel1.Controls.Add(bcc);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
if (con != null)
con.Close();
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
void StoreInDB()
{
SqlConnection con = null;
string sql = "INSERT INTO barcodes(codetext,symbology) VALUES(@Codetext,@Symbology)";
try
{
con = new SqlConnection(connectionString);
con.Open();
SqlCommand sqlInsert = new SqlCommand();
sqlInsert.Connection = con;
sqlInsert.CommandText = sql;
sqlInsert.Parameters.Add("@Codetext", this.barCodeControl1.CodeText);
sqlInsert.Parameters.Add("@Symbology", barCodeControl1.SymbologyType.ToString());
sqlInsert.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
if (con != null)
con.Close();
}
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
SaveFileDialog fd = new SaveFileDialog();
if (fd.ShowDialog() == DialogResult.OK)
{
txtBarCodeImage.Text = fd.FileName;
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
// Open file dialog to browse and select the file
OpenFileDialog fd = new OpenFileDialog();
if (fd.ShowDialog() == DialogResult.OK)
{
// Set the file path
txtBarCodeImage.Text = fd.FileName;
// Create a bitmap and assign it to the Picturebox control
Bitmap bmp = new Bitmap(txtBarCodeImage.Text);
pictureBox1.Image = bmp;
}
// For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
String barcode = null;
MemoryStream stream = new MemoryStream();
// Save barcode in stream object
barcodeName.Save(stream, ImageFormat.Png);
// Create an instance of BarCodeReader and set image and symbology type to recognize
BarCodeReader reader = new BarCodeReader(stream, BarCodeReadType.Code39Extended);
// Try to recognize barcode in the image
if (reader.Read())
barcode = "Code Text: " + reader.GetCodeText() + " Symbology: " + reader.GetReadType();
// Close the reader and Display the codetext
reader.Close();
MessageBox.Show(barcode);
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Initialize the BarCodeReader and specify multiple symbology types using bitwise OR operator
Dim reader As BarCodeReader = New BarCodeReader("MultiBarCodes.bmp", BarCodeReadType.AllSupportedTypes)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.Pdf417
' Width of each module
barCodeBuilder.xDimension = 0.6F
' Height of each module
barCodeBuilder.yDimension = 1.2F
barCodeBuilder.CodeText = "this is some test code text. " & vbLf & " Second line " & vbLf & " third line."
' Save the Barcode image
barCodeBuilder.Save(dataDir & Convert.ToString("2d-barcode_out.jpg"), BarCodeImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.Aztec
' Set CodeText
barCodeBuilder.CodeText = "123456789"
' Save the Barcode image
barCodeBuilder.Save(dataDir & Convert.ToString("CreateAztecbarcode_out.bmp"), BarCodeImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.DataMatrix
' Set Data Matrix EncodeMode
barCodeBuilder.DataMatrixEncodeMode = Aspose.BarCode.DataMatrixEncodeMode.ASCII
' Set CodeText for barcode
barCodeBuilder.CodeText = "This is the data to be encoded"
barCodeBuilder.Save(dataDir & Convert.ToString("ManagePDF417Barcode_out.bmp"), ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Create array for storing multiple barcodes
Const nSize As Integer = 4
Dim lstCodeText As String() = New String() {"code-1", "code-2", "code-3", "code-4"}
Const strFileId As Integer = 1
' Create instance of BarCodeBuilder class and set symbology
Using builder As New BarCodeBuilder()
For nCount As Integer = 1 To nSize
builder.SymbologyType = Symbology.MacroPdf417
builder.CodeText = lstCodeText(nCount - 1)
' FileID should be same for all the generated bar codes
builder.MacroPdf417FileID = strFileId
' Assign segmentID in increasing order (1,2,3,....)
builder.MacroPdf417SegmentID = nCount
' Set the segments count
builder.MacroPdf417SegmentsCount = nSize
' Save the barcode
builder.Save(strFileId.ToString() + "_" & nCount & "_out.png", ImageFormat.Png)
Process.Start(strFileId.ToString + "_" & nCount & "_out.png")
Next
End Using
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.DataMatrix
' Width of each module
barCodeBuilder.xDimension = 0.6F
' Set CodeText
barCodeBuilder.CodeText = "123456789"
' Save the Barcode image
barCodeBuilder.Save(dataDir & Convert.ToString("Datamatrixbarcode_out.bmp"), BarCodeImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.DataMatrix
' Set Data Matrix EncodeMode to Custom
barCodeBuilder.DataMatrixEncodeMode = DataMatrixEncodeMode.[Custom]
' Set CodeText Encoding Property
barCodeBuilder.CodeTextEncoding = Encoding.UTF8
' Set CodeText for barcode
barCodeBuilder.CodeText = "öäüéà è"
barCodeBuilder.Save(dataDir & Convert.ToString("CustomEncodingModeInDataMatrix_out.bmp"), ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
Try
Dim memoryStream As New MemoryStream()
' Instantiate barcode object
Using barCodeBuilder As New BarCodeBuilder()
' Set CodeText
barCodeBuilder.CodeText = "Слово"
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.QR
' Set Text Encoding
barCodeBuilder.CodeTextEncoding = Encoding.UTF8
' Save the Barcode image
barCodeBuilder.Save(dataDir & "" & DirectCast(memoryStream, Object) & "_out.png", BarCodeImageFormat.Png)
End Using
Dim fileName As String = (dataDir & Convert.ToString("")) + DirectCast(memoryStream, Object) + "_out.png"
Using reader As New BarCodeReader(fileName, DecodeType.QR)
reader.SetDetectEncoding(False)
If reader.Read() Then
Console.WriteLine(reader.GetCodeText(Encoding.UTF8))
'"Слово"
End If
End Using
Catch generatedExceptionName As Exception
End Try
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Initialize a BarCodeBuilder class object
Dim builder As New BarCodeBuilder()
' Set its Symbology
builder.SymbologyType = Symbology.QR
' Set encoding mode
builder.QREncodeMode = QREncodeMode.Auto
' Set Auto for Micro QR
builder.QREncodeType = QREncodeType.Auto
' Set code text
builder.CodeText = "12345TEXT"
' Set error correction level
builder.QRErrorLevel = QRErrorLevel.LevelL
' Get barcode image Bitmap
Dim lBmp As Bitmap = builder.GenerateBarCodeImage()
' Save QR code
lBmp.Save(dataDir & Convert.ToString("EncodeMicroQRCode_out.bmp"), ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Initialize a BarCodeBuilder class object
Dim builder As New BarCodeBuilder()
' Set its Symbology
builder.SymbologyType = Symbology.QR
' Set encoding mode
builder.QREncodeMode = QREncodeMode.Auto
' Set ForceQR (default) for standard QR
builder.QREncodeType = QREncodeType.ForceQR
' Set code text
builder.CodeText = "12345TEXT"
' Set error correction level
builder.QRErrorLevel = QRErrorLevel.LevelL
' Get barcode image Bitmap
Dim lBmp As Bitmap = builder.GenerateBarCodeImage()
' Save QR code
lBmp.Save(dataDir & Convert.ToString("EncodeQA_out.bmp"), ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Initialize a BarCodeBuilder class object
Dim builder As New BarCodeBuilder()
' Set its Symbology
builder.SymbologyType = Symbology.QR
' Set encoding mode
builder.QREncodeMode = QREncodeMode.ECIEncoding
' Set ForceQR (default) for standard QR
builder.QREncodeType = QREncodeType.ForceQR
' Set ECI encoding type
builder.ECIEncoding = ECIEncodings.UTF8
' Set code text
builder.CodeText = "12345TEXT"
' Set error correction level
builder.QRErrorLevel = QRErrorLevel.LevelL
' Get barcode image Bitmap
Dim lBmp As Bitmap = builder.GenerateBarCodeImage()
' Save QR code
lBmp.Save(dataDir & Convert.ToString("EncodeQRCodEInECIMode_out.bmp"), ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.Pdf417
' Set Pdf417 Error correction level
barCodeBuilder.Pdf417ErrorLevel = Pdf417ErrorLevel.Level8
' Set CodeText for barcode
barCodeBuilder.CodeText = "1234567890"
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Create codetext
Dim lTextBuilder As New QrExtCodetextBuilder()
lTextBuilder.AddFNC1FirstPosition()
lTextBuilder.AddPlainCodetext("000%89%%0")
lTextBuilder.AddFNC1GroupSeparator()
lTextBuilder.AddPlainCodetext("12345<FNC1>")
' Generate codetext
Dim lCodetext As String = lTextBuilder.GetExtendedCodetext()
' Instantiate barcode object
Dim builder As New BarCodeBuilder()
' Set its Symbology
builder.SymbologyType = Symbology.QR
' Set encoding mode
builder.QREncodeMode = QREncodeMode.ExtendedCodetext
' Set error correction level
builder.QRErrorLevel = QRErrorLevel.LevelL
' Set code text
builder.CodeText = lCodetext
' Set display text
builder.Display2DText = "My Text"
' Get barcode image Bitmap
Dim lBmp As Bitmap = builder.GenerateBarCodeImage()
' Save QR code
lBmp.Save(dataDir & Convert.ToString("FNC1FirstPositionInExtendedMode_out.bmp"), ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Create codetext
Dim lTextBuilder As New QrExtCodetextBuilder()
lTextBuilder.AddFNC1SecondPosition("12")
lTextBuilder.AddPlainCodetext("TRUE3456")
' Generate codetext
Dim lCodetext As String = lTextBuilder.GetExtendedCodetext()
' Instantiate barcode object
Dim builder As New BarCodeBuilder()
' Set its Symbology
builder.SymbologyType = Symbology.QR
' Set encoding mode
builder.QREncodeMode = QREncodeMode.ExtendedCodetext
' Set error correction level
builder.QRErrorLevel = QRErrorLevel.LevelL
' Set code text
builder.CodeText = lCodetext
' Set display text
builder.Display2DText = "My Text"
' Get barcode image Bitmap
Dim lBmp As Bitmap = builder.GenerateBarCodeImage()
' Save QR code
lBmp.Save(dataDir & Convert.ToString("FNC1SecondPositionInExtendedMode.bmp"), ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set CodeText
barCodeBuilder.CodeText = "The quick brown fox jumps over the lazy dog" & vbLf + "The quick brown fox jumps over the lazy dog" & vbLf
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.DataMatrix
' Set Barcode CodeLocation
barCodeBuilder.CodeLocation = CodeLocation.None
' Save the Barcode image
barCodeBuilder.Save(dataDir & Convert.ToString("HideBarcodeCodeText_out.png"), BarCodeImageFormat.Png)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.Pdf417
' Set Pdf417 Error correction level
barCodeBuilder.Pdf417ErrorLevel = Pdf417ErrorLevel.Level8
' Set Pdf417 Compaction Mode to Text
barCodeBuilder.Pdf417CompactionMode = Pdf417CompactionMode.Text
' Set CodeText for barcode
barCodeBuilder.CodeText = "1234567890"
barCodeBuilder.Save(dataDir & Convert.ToString("ManagePDF417Barcode_out.bmp"), ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Create codetext
Dim lTextBuilder As New QrExtCodetextBuilder()
lTextBuilder.AddECICodetext(ECIEncodings.Win1251, "Will")
lTextBuilder.AddECICodetext(ECIEncodings.UTF8, "Right")
lTextBuilder.AddECICodetext(ECIEncodings.UTF16BE, "Power")
lTextBuilder.AddPlainCodetext("t\e\\st")
' Generate codetext
Dim lCodetext As String = lTextBuilder.GetExtendedCodetext()
' Initialize a BarCodeBuilder class object
Dim builder As New BarCodeBuilder()
' Set its Symbology
builder.SymbologyType = Symbology.QR
' Set encoding mode
builder.QREncodeMode = QREncodeMode.ExtendedCodetext
' Set error correction level
builder.QRErrorLevel = QRErrorLevel.LevelL
' Set code text
builder.CodeText = lCodetext
' Set display text
builder.Display2DText = "My Text"
' Get barcode image Bitmap
Dim lBmp As Bitmap = builder.GenerateBarCodeImage()
' Save QR code
lBmp.Save(dataDir & Convert.ToString("MultiECIModeInExtendedMode_out.bmp"), ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.Pdf417
' Set Pdf417 Compaction Mode to Text
barCodeBuilder.Pdf417CompactionMode = Pdf417CompactionMode.Text
barCodeBuilder.Save(dataDir & Convert.ToString("ManagePDF417Barcode_out.bmp"), ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set CodeText
barCodeBuilder.CodeText = "The quick brown fox jumps over the lazy dog" & vbLf + "The quick brown fox jumps over the lazy dog" & vbLf
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.DataMatrix
' Set Barcode CodeLocation
barCodeBuilder.CodeLocation = CodeLocation.None
' Save the Barcode image
barCodeBuilder.Save(Convert.ToString("HideBarcodeCodeText_out.png"), BarCodeImageFormat.Png)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Create instance of BarCodeBuilder class
Dim builder As New BarCodeBuilder("1234567890", Symbology.Pdf417)
' Set Aspect Ratio to 3:2 or 1.5
builder.AspectRatio = 1.5F
' Save the barcode image to disk in PNG format
builder.Save(Convert.ToString("SetAspectRatio_out.png"), BarCodeImageFormat.Png)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.Aztec
' Set Error Error Correction level
barCodeBuilder.AztectErrorLevel = 10
' Set CodeText
barCodeBuilder.CodeText = "123456789"
' Save the Barcode image
barCodeBuilder.Save(dataDir & Convert.ToString("UseAztecErrorCorrection_out.bmp"), BarCodeImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
Dim gtin As String = "898978777776665655"
Dim uid As String = "121212121212121212"
Dim batch As String = "GH768"
Dim expDate As String = "150923"
Dim textToEncode As String = Convert.ToString(Convert.ToString(gtin & uid) & batch) & expDate
' Or "(01)"+ gtin + "(..)"+ uid + ...
Dim textToDisplay As String = Convert.ToString((Convert.ToString((Convert.ToString((Convert.ToString("GTIN:") & gtin) + vbLf & "UID:") & uid) + vbLf & "Batch:") & batch) + vbLf & "Exp.Date:") & expDate
' Instantiate barcode object
Dim builder As New BarCodeBuilder(textToEncode, Symbology.DataMatrix)
' N order to avoid including all the names into the codetext, the property called "Display2DText" should be used.
builder.Display2DText = textToDisplay
builder.CodeLocation = CodeLocation.Right
builder.Margins = New MarginsF(0, 0, 0, 0)
' Builder.CodeTextSpace = 0 // not recommended small space
' Save the Barcode image
builder.Save(dataDir & Convert.ToString("codetextRightDisplay_out.png"), BarCodeImageFormat.Png)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Create dataset
Dim ds As DataSet
ds = New DataSet("DataSet_BarCode")
' Insert datatable
Dim dt As DataTable
dt = New DataTable("DataTable_BarCode")
dt.Columns.Add(New DataColumn("CodeText", GetType(String)))
dt.Columns.Add(New DataColumn("BarCodeImage", GetType(System.Byte())))
ds.Tables.Add(dt)
' Write schema and display it
Dim ms As System.IO.MemoryStream
ms = New System.IO.MemoryStream
ds.WriteXmlSchema(ms)
Me.TextBox1.Text = New String(System.Text.ASCIIEncoding.ASCII.GetChars(ms.GetBuffer()))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
reader.Read()
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
' This line of code loads data into the 'DataSet1.Product' table. You can move, or remove it, as needed.
Me.ProductTableAdapter.Fill(Me.DataSet1.Product)
' Create an instance of BarCodeBuilder class
Dim builder As BarCodeBuilder = New BarCodeBuilder()
' Set the symbology type
builder.SymbologyType = Symbology.Code128
' Loop through all the rows in the datatable
For Each row As DataSet1.ProductRow In DataSet1.Product.Rows
' Set the codetext as value of "ProductNumber" column
builder.CodeText = row.ProductNumber.ToString()
' Generate the barcode and save it in memory stream
Dim ms As MemoryStream = New MemoryStream()
builder.Save(ms, System.Drawing.Imaging.ImageFormat.Png)
' Set the value of "BarCode" column to the memory stream. This would show the barcode image
row.BarCode = ms.GetBuffer()
Next row
Me.reportViewer1.RefreshReport()
End Sub
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Create an instance of BarCodeBuilder
Dim builder As New BarCodeBuilder()
' Set the symbology type and codetext
builder.SymbologyType = Symbology.Code39Standard
builder.CodeText = "test-123"
' Get the barcode image and Save the image at the specified location
Dim img As Image = builder.BarCodeImage
img.Save(dataDir + txtBarCodeImage.Text, System.Drawing.Imaging.ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Initialize the BarCodeReader class by passing barcode file name and barcode type as parameters
Using reader As New BarCodeReader(dataDir & Convert.ToString("datamatrix-stars.png"), DecodeType.DataMatrix)
' Set the reader recognition mode and Manual Hint property to speed up recognition process.
reader.RecognitionMode = RecognitionMode.ManualHints
reader.ManualHints = ManualHint.SpecialFormOfCells
While reader.Read()
Console.WriteLine("GetCodeType" & reader.GetCodeType().ToString() & ": " & reader.GetCodeText())
End While
End Using
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Instantiate BarCodeReader object
Dim reader As New BarCodeReader(dataDir & Convert.ToString("rotatedbarcode.jpg"), DecodeType.Code128)
Try
' Read Code128 bar code
While reader.Read()
' Detect bar code orientation
System.Console.Write(Environment.NewLine + "Rotaion Angle: " + reader.GetAngle())
End While
reader.Close()
End Try
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Initialize the BarCodeReader object
Using reader As New BarCodeReader(Convert.ToString("code39.png"), DecodeType.Code39Standard)
' Set RecognitionMode
reader.RecognitionMode = RecognitionMode.MaxBarCodes
While reader.Read()
Console.WriteLine(reader.GetCodeType())
Console.WriteLine(reader.GetCodeType())
Console.WriteLine("IsDeniable: " & reader.GetIsDeniable().ToString())
End While
End Using
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Generate barcode (Sample 1) Initialize BarCode builder class object
Dim builder1 As New BarCodeBuilder()
' Set symbology type as DataMatrix, ECC level, code text for barcode
builder1.SymbologyType = Symbology.DataMatrix
builder1.DatamatrixEcc = DataMatrixEccType.Ecc050
builder1.CodeText = "BASE-41 ONLY ALPHA, DIGITS AND PUNCTUATION."
builder1.Save(dataDir & Convert.ToString("SampleBarcode1.png"))
' Generate barcode (Sample 2) Initialize BarCode builder class object
Dim builder2 As New BarCodeBuilder()
' Set symbology type as DataMatrix, ECC level, code text for barcode
builder2.SymbologyType = Symbology.DataMatrix
builder2.DatamatrixEcc = DataMatrixEccType.Ecc050
builder2.CodeText = "BASE-41 ONLY ALPHA, DIGITS AND PUNCTUATION."
builder2.Save(dataDir & Convert.ToString("SampleBarcode2.png"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Initialize the BarCodeReader object
Dim reader As New BarCodeReader(dataDir & Convert.ToString("Barcode2.png"), DecodeType.AllSupportedTypes)
' Call read memthod
reader.Read()
' Now get all possible barcodes
Dim barcodes As BarCodeReader.PossibleBarCode() = reader.GetAllPossibleBarCodes()
For Each barcode As BarCodeReader.PossibleBarCode In barcodes
' Display code text, symbology, detected angle, recognition percentage of the barcode
Console.WriteLine("Code Text: " & barcode.Codetext.ToString() & " Symbology: " & barcode.BarCodeReadType.ToString() & " Recognition percentage: " + barcode.Angle)
' Display x and y coordinates of barcode detected
Dim point As System.Drawing.Point() = barcode.Region.Points
Console.WriteLine("Top left coordinates: X = " + point(0).X + ", Y = " + point(0).Y)
Console.WriteLine("Bottom left coordinates: X = " + point(1).X + ", Y = " + point(1).Y)
Console.WriteLine("Bottom right coordinates: X = " + point(2).X + ", Y = " + point(2).Y)
Console.WriteLine("Top right coordinates: X = " + point(3).X + ", Y = " + point(3).Y)
Next
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Initialize the BarCodeReader object
Dim reader As New BarCodeReader(dataDir & Convert.ToString("Barcode2.png"), DecodeType.AllSupportedTypes)
' Call read method
While reader.Read()
Console.WriteLine("GetCodeText : " & reader.GetCodeText().ToString() + " Type: " + reader.GetCodeType().ToString())
Dim percent As Single = reader.GetRecognitionQuality()
End While
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Create an instance of BarCodeReader class and read barcode file
Dim barCodeReader As New BarCodeReader(dataDir & Convert.ToString("Region.png"), DecodeType.Code39Standard)
' Try to recognize all possible barcodes in the image
While barCodeReader.Read()
' Get the region information
Dim region As BarCodeRegion = barCodeReader.GetRegion()
If region IsNot Nothing Then
' Display x and y coordinates of barcode detected
Dim point As Point() = region.Points
Console.WriteLine("Top left coordinates: X = " + point(0).X.ToString() + ", Y = " + point(0).Y.ToString())
Console.WriteLine("Top right coordinates: X = " + point(1).X.ToString() + ", Y = " + point(1).Y.ToString())
Console.WriteLine("Bottom right coordinates: X = " + point(2).X.ToString() + ", Y = " + point(2).Y.ToString())
Console.WriteLine("Bottom left coordinates: X = " + point(3).X.ToString() + ", Y = " + point(3).Y.ToString())
End If
Console.WriteLine("Codetext: " + barCodeReader.GetCodeText())
End While
' Close reader
barCodeReader.Close()
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Create an instance of BarCodeReader and set image and symbology type to recognize
Dim barCodeReader As New BarCodeReader(dataDir & Convert.ToString("code39.png"), DecodeType.Code39Standard)
' Set grayscale image processing
barCodeReader.RecognitionMode = RecognitionMode.MaxBarCodes
' Try to recognize all possible barcodes in the image
While barCodeReader.Read()
' Display the codetext
Console.WriteLine("Codetext: " + barCodeReader.GetCodeText())
End While
' Close the reader
barCodeReader.Close()
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
Dim watch As New Stopwatch()
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
Using reader As New BarCodeReader(dataDir & Convert.ToString("SymbologyTypebarcode.png"), DecodeType.Code128)
' Start Stopwatch
watch.Start()
' Set RecognitionMode and ManualHints
reader.RecognitionMode = RecognitionMode.ManualHints
reader.ManualHints = ManualHint.MedianSmoothing
While reader.Read()
Console.WriteLine("GetCodeType " & reader.GetCodeType().ToString() + " GetCodeText : " & reader.GetCodeText().ToString())
End While
' End Stopwatch
watch.[Stop]()
Console.WriteLine("Time: " + watch.ElapsedMilliseconds + "ms.")
End Using
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Create an instance of BarCodeReader and set image and symbology type to recognize
Dim barCodeReader As New BarCodeReader(dataDir & Convert.ToString("code39.png"), DecodeType.Code39Standard)
Dim counter As Integer = 0
' Read all the barcodes from the images
While barCodeReader.Read()
' Display the symbology type and codetext
Console.WriteLine("BarCode Type: " & barCodeReader.GetCodeType().ToString())
Console.WriteLine("BarCode CodeText: " & barCodeReader.GetCodeText().ToString())
' Get the barcode region
Dim region As BarCodeRegion = barCodeReader.GetRegion()
If region IsNot Nothing Then
' Initialize an object of type Image to get the Graphics object
Dim image__1 As Image = Image.FromFile(dataDir & Convert.ToString("code39.png"))
' Initialize graphics object from the image
Dim graphics__2 As Graphics = Graphics.FromImage(image__1)
' Draw the barcode edges and Save the image
region.DrawBarCodeEdges(graphics__2, New Pen(Color.Red, 1.0F))
image__1.Save(dataDir & String.Format("edge_{0}.png", System.Math.Max(System.Threading.Interlocked.Increment(counter), counter - 1)))
' Fill the barcode area with some color
region.FillBarCodeRegion(graphics__2, Brushes.Green)
image__1.Save(dataDir & String.Format("fill_{0}.png", System.Math.Max(System.Threading.Interlocked.Increment(counter), counter - 1)))
End If
End While
barCodeReader.Close()
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
Dim sw As New Stopwatch()
' Start the stopwatch
sw.Start()
' Define the settings to use all of the processor cores, if not then how many to use.
BarCodeReader.ProcessorSettings.UseAllCores = False
BarCodeReader.ProcessorSettings.UseOnlyThisCoresCount = 4
' Perform the BarCode recognition task Initialize the BarCodeReader object
Using reader As New BarCodeReader(dataDir & Convert.ToString("code39.png"), DecodeType.Code128)
While reader.Read()
Console.WriteLine("Code Text: " & reader.GetCodeText().ToString() & " Type: " & reader.GetCodeType().ToString())
End While
End Using
' Stop the stopwatch
sw.[Stop]()
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Create an instance of BarCodeReader class and specify an area to look for the barcode
Dim reader As New BarCodeReader(New Bitmap(dataDir & Convert.ToString("ReadBarcodefromSpecificRegionofImage.png")), New Rectangle(0, 0, 100, 50), DecodeType.Pdf417)
' Read all barcodes in the provided area
While reader.Read() = True
' Display the codetext and symbology type of the barcode found
Console.WriteLine("Codetext: " & reader.GetCodeText().ToString() & " Symbology: " & reader.GetCodeType().ToString())
End While
' Close the reader
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Initialize the Bitmap object
Dim bitmap As New Bitmap(Convert.ToString("Region.png"))
Dim areas As Rectangle() = New Rectangle(2) {}
areas(0) = New Rectangle(50, 50, 300, 300)
areas(1) = New Rectangle(400, 40, 350, 350)
areas(2) = New Rectangle(40, 500, 700, 150)
' Initialize the BarCodeReader object and load bitmap object
Using reader As New BarCodeReader(bitmap, areas, DecodeType.Code39Standard)
While reader.Read()
Console.WriteLine("GetCodeType" & reader.GetCodeType().ToString() + "GetCodeText: " + reader.GetCodeText().ToString())
End While
End Using
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
Dim strFileID As String = "1"
Dim strFileslist As String() = Directory.GetFiles((dataDir & strFileID) + "_*.png")
For Each strFile As String In strFileslist
' We got list of all the files, now read barcodes
Dim reader As New BarCodeReader(strFile, DecodeType.MacroPdf417)
If reader.Read() = True Then
Console.WriteLine((Convert.ToString("File: ") & strFile) + " == FileID: " + reader.GetMacroPdf417FileID() + " == SegmentID: " + reader.GetMacroPdf417SegmentID() + " == CodeText: " + reader.GetCodeText())
End If
' Close the reader
reader.Close()
Next
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Create array for storing multiple bar codes file names
Dim files As String() = New String() {"Barcodefrom.png", "Barcode2.png"}
' Iiterate through the bar code image files
For i As Integer = 0 To files.Length - 1
' Create instance of BarCodeReader class and set symbology
Using reader As New BarCodeReader(dataDir + files(i), DecodeType.MacroPdf417)
If reader.Read() Then
' Get code text, file id, segment id and segment count
Console.WriteLine("File Name: " + files(i) + " Code Text: " + reader.GetCodeText())
Console.WriteLine("FileID: " + reader.GetMacroPdf417FileID())
Console.WriteLine("SegmentID: " + reader.GetMacroPdf417SegmentID())
Console.WriteLine("Segment Count: " + reader.GetMacroPdf417SegmentsCount())
End If
Console.WriteLine()
End Using
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Initialize the BarCodeReader
Dim reader As New BarCodeReader(dataDir & Convert.ToString("RecognizingMultipleSymbologies.png"), BarCodeReadType.Code39Standard Or BarCodeReadType.Pdf417)
' Call Read() method in a loop
While reader.Read()
' Display the codetext and symbology type
Console.WriteLine("Codetext: " & reader.GetCodeText().ToString())
Console.WriteLine("Symbology type: " & reader.GetCodeType().ToString())
End While
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Create instance of BarCodeBuilder class
Dim reader As New BarCodeReader(dataDir & Convert.ToString("SymbologyTypebarcode.png"), DecodeType.Code128)
While reader.Read()
' Display code text and Symbology Type
Console.WriteLine("CodeText: " & reader.GetCodeText().ToString())
Console.Write("Symbology Type: " & reader.GetCodeType().ToString())
End While
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_CreateAndManage2DBarCodes()
' Read file from directory with DecodeType.EAN13
Dim reader As New BarCodeReader(dataDir & Convert.ToString("Scan.jpg"), DecodeType.EAN13)
While reader.Read()
' Read symbology type and code text
Console.WriteLine("Symbology Type: " & reader.GetCodeType().ToString())
Console.WriteLine("CodeText: " & reader.GetCodeText().ToString())
End While
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Create an instance of BarCodeReader and set image and symbology type to recognize
Dim barCodeReader As New BarCodeReader(Convert.ToString("BarcodeOrientation.png"), DecodeType.Code39Standard)
' Set the orientation
barCodeReader.OrientationHints = RecognitionHints.Orientation.Rotate90
' Try to recognize all possible barcodes in the image
While barCodeReader.Read()
' Display the codetext
Console.WriteLine("Codetext: " + barCodeReader.GetCodeText())
End While
' Close the reader
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set border style to solid
barCodeBuilder.BorderDashStyle = Aspose.BarCode.BorderDashStyle.Solid
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Create instance of BarCodeBuilder class
Dim reader As New BarCodeReader(dataDir & Convert.ToString("Scan.jpg"))
While reader.Read()
' Get code text
Console.WriteLine("CodeText: " + reader.GetCodeText())
End While
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition()
' Initialize the BarCodeReader object and Set recognition mode and manual hints
Dim reader As New BarCodeReader(dataDir & Convert.ToString("datamatrix-barcode.jpg"), DecodeType.DataMatrix)
reader.RecognitionMode = RecognitionMode.ManualHints
reader.ManualHints = ManualHint.InvertImage Or ManualHint.IncorrectBarcodes
' Try to recognize all possible barcodes in the image
While reader.Read()
' Display the codetext
Console.WriteLine("Codetext: " + reader.GetCodeText())
End While
' Close the reader
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object and Increase the space between code text and barcode to 1 point
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.CodeTextSpace = 1.0F
barCodeBuilder.Save(dataDir & Convert.ToString("AddSpaceInBarCodeAndText_out.bmp"), System.Drawing.Imaging.ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object
Dim builder As New BarCodeBuilder("1234567890", Symbology.Code39Standard)
' Set auto size false
builder.AutoSize = False
' Set height
builder.ImageHeight = 50
' Set width
builder.ImageWidth = 120
' Save image to disk
builder.Save(dataDir & Convert.ToString("barcode-custom-size_out.jpg"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object and Set border style to solid
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.BorderDashStyle = BorderDashStyle.Solid
' Set border margins by assigning an instance of MarginsF
barCodeBuilder.Margins = New MarginsF(2.0F, 2.0F, 2.0F, 2.0F)
' Set border width and enable border to be shown in the barcode
barCodeBuilder.BorderWidth = 0.5F
barCodeBuilder.BorderVisible = True
' Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir & Convert.ToString("barcodeImageborders_out.jpeg"), ImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object, Set the Code text, Symbology type, left margin, right margin, top margin and bottom margin for the barcode
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.CodeText = "1234567"
barCodeBuilder.SymbologyType = Symbology.Code128
barCodeBuilder.Margins.Left = 0.5F
barCodeBuilder.Margins.Right = 0.0F
barCodeBuilder.Margins.Top = 0.0F
barCodeBuilder.Margins.Bottom = 0.0F
barCodeBuilder.Save(dataDir & Convert.ToString("barcode-image-margins_out.jpeg"), System.Drawing.Imaging.ImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object, Set the Code text, symbology type and image quality mode to anti alias to the barcode
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.CodeText = "1234567"
barCodeBuilder.SymbologyType = Symbology.Code128
barCodeBuilder.ImageQuality = ImageQualityMode.AntiAlias
barCodeBuilder.Save(dataDir & Convert.ToString("barcode-image-quality_out.jpeg"), System.Drawing.Imaging.ImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set the Code text for the barcode
barCodeBuilder.CodeText = "1234567"
' Set the symbology type to Code128
barCodeBuilder.SymbologyType = Symbology.Code128
' Create an instance of resolution and apply on the barcode image with customized resolution settings
barCodeBuilder.Resolution = New Resolution(200.0F, 400.0F, ResolutionMode.Customized)
' Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir & Convert.ToString("barcode-image-resolution_out.jpeg"), System.Drawing.Imaging.ImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
Dim dst As String = dataDir & Convert.ToString("colorize-barcode_out.jpg")
' Instantiate barcode object, Set the Code text, symbology type, background color, fore color, border color, code text color of the barcode
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.CodeText = "1234567"
barCodeBuilder.SymbologyType = Symbology.Code128
barCodeBuilder.BackColor = System.Drawing.Color.Yellow
barCodeBuilder.ForeColor = System.Drawing.Color.Blue
barCodeBuilder.BorderColor = System.Drawing.Color.Red
barCodeBuilder.CodeTextColor = System.Drawing.Color.Red
barCodeBuilder.Save(dst, System.Drawing.Imaging.ImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object
Using builder As New BarCodeBuilder("TEXT", Symbology.Code128)
builder.FilledBars = False
builder.Save(dataDir & Convert.ToString("ControlBarsFillingofOneDBarcodes_out.png"))
End Using
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Get the default Printer Name
Dim settings As New PrinterSettings()
Dim printerName As String = settings.PrinterName
' Create instance of BarCodeBuilder, specify codetext and symbology in the constructor
Dim builder As New BarCodeBuilder("12345678", Symbology.Code128)
' Set printer name
builder.PrinterName = printerName
builder.Print()
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate BarCodeBuilder object and set the symbology type, Code Text and Hide code text.
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.SymbologyType = Symbology.QR
barCodeBuilder.CodeText = "1234567890"
barCodeBuilder.CodeLocation = CodeLocation.None
barCodeBuilder.RotationAngleF = 90
barCodeBuilder.Save(dataDir & Convert.ToString("QR-rotate_out.jpeg"), BarCodeImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object and set the Code text, symbology type and rotation angle for the barcode
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.CodeText = "1234567"
barCodeBuilder.SymbologyType = Symbology.Code128
barCodeBuilder.RotationAngleF = 180
barCodeBuilder.Save(dataDir & Convert.ToString("barcode-image-rotate_out.jpeg"), System.Drawing.Imaging.ImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set the Code text for the barcode
barCodeBuilder.CodeText = "1234567"
' Set the symbology type to Code128
barCodeBuilder.SymbologyType = Symbology.Code128
' Create a memory stream object that would store barcode image in binary form
Dim mStream As New System.IO.MemoryStream()
' Call save method of BarCodeImage to store Png barcode image to memory stream
barCodeBuilder.BarCodeImage.Save(dataDir & mStream.ToString() & ".png", System.Drawing.Imaging.ImageFormat.Png)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate barcode object and set the Code text and align Code text for the barcode
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.CodeText = "1234567"
barCodeBuilder.CodeTextAlignment = System.Drawing.StringAlignment.Center
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object and set Code text font' S type and size
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.CodeTextFont = New System.Drawing.Font("Verdana", 12.0F)
barCodeBuilder.Save(dataDir & Convert.ToString("SetCodeTextFontFamilyNameAndSize_out.bmp"), System.Drawing.Imaging.ImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate barcode object and set the Code text and the location for the barcode
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.CodeText = "1234567"
barCodeBuilder.CodeLocation = CodeLocation.Above
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.CaptionAbove.TextAlign = StringAlignment.Near
barCodeBuilder.CaptionAbove.Text = "Aspose.Demo"
barCodeBuilder.CaptionAbove.Visible = True
barCodeBuilder.CaptionAbove.Font = New System.Drawing.Font("Pristina", 14.0F)
barCodeBuilder.CaptionAbove.ForeColor = Color.OrangeRed
barCodeBuilder.CaptionBelow.TextAlign = StringAlignment.Far
barCodeBuilder.CaptionBelow.Text = "Aspose.Demo"
barCodeBuilder.CaptionBelow.Visible = True
barCodeBuilder.CaptionBelow.Font = New System.Drawing.Font("Pristina", 14.0F)
barCodeBuilder.CaptionBelow.ForeColor = Color.OrangeRed
' Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir & Convert.ToString("SetFontandColorSetting.jpeg"), System.Drawing.Imaging.ImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate barcode object, Set the Code text and code text fore color for the barcode
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.CodeText = "1234567"
barCodeBuilder.CodeTextColor = System.Drawing.Color.Red
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder("00850006000227")
barCodeBuilder.AutoSize = True
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.ITF14
' Set ITF14 Barcode Border Type
barCodeBuilder.ITF14BorderType = ITF14BorderType.FrameOut
' Set Font
barCodeBuilder.CodeTextFont = New Font("OCR B Std", 8.0F)
' Set Measuring Units
barCodeBuilder.GraphicsUnit = GraphicsUnit.Millimeter
' Set xDimension
barCodeBuilder.xDimension = 0.495F
' Set Bars Height
barCodeBuilder.BarHeight = 12.7F
' Specify space between characters
barCodeBuilder.CodeTextSpace = 0.5F
' Define resolution and its mode
barCodeBuilder.Resolution = New Resolution(1200.0F, 1200.0F, ResolutionMode.Customized)
' Save the Barcode image
barCodeBuilder.Save(dataDir & Convert.ToString("ITF14_Border_Type_FrameOut.png"), BarCodeImageFormat.Png)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder("00850006000227")
barCodeBuilder.AutoSize = True
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.ITF14
' Set ITF14 Barcode Border Type
barCodeBuilder.ITF14BorderType = ITF14BorderType.BarOut
' Set Font
barCodeBuilder.CodeTextFont = New Font("OCR B Std", 8.0F)
' Set Measuring Units
barCodeBuilder.GraphicsUnit = GraphicsUnit.Millimeter
' Set xDimension
barCodeBuilder.xDimension = 0.495F
' Set Bars Height
barCodeBuilder.BarHeight = 12.7F
' Specify space between characters
barCodeBuilder.CodeTextSpace = 0.5F
' Define resolution and its mode
barCodeBuilder.Resolution = New Resolution(1200.0F, 1200.0F, ResolutionMode.Customized)
' Save the Barcode image
barCodeBuilder.Save(dataDir & Convert.ToString("ITF14_Border_Type_BarOut.png"), BarCodeImageFormat.Png)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder()
' Set the Code text for the barcode
barCodeBuilder.CodeText = "1234567"
' Set the symbology type to Code128
barCodeBuilder.SymbologyType = Symbology.Code128
' Set the bar height to 3 points
barCodeBuilder.BarHeight = 3.0F
' Set the measuring unit of barcode to point
barCodeBuilder.GraphicsUnit = System.Drawing.GraphicsUnit.Point
' Save the image to your system and set its image format to Jpeg
barCodeBuilder.Save(dataDir & Convert.ToString("barcode-size-unit_out.jpeg"), System.Drawing.Imaging.ImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodesImages()
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder("00850006000227")
barCodeBuilder.AutoSize = True
' Set Barcode Symbology
barCodeBuilder.SymbologyType = Symbology.ITF14
' Set ITF14 Barcode Border Type
barCodeBuilder.ITF14BorderType = ITF14BorderType.BarOut
' Set Font
barCodeBuilder.CodeTextFont = New Font("OCR B Std", 8.0F)
' Set Measuring Units
barCodeBuilder.GraphicsUnit = GraphicsUnit.Millimeter
' Set xDimension
barCodeBuilder.xDimension = 0.495F
' Set Bars Height
barCodeBuilder.BarHeight = 12.7F
' Specify space between characters
barCodeBuilder.CodeTextSpace = 0.5F
' Define resolution and its mode
barCodeBuilder.Resolution = New Resolution(1200.0F, 1200.0F, ResolutionMode.Customized)
' Save the Barcode image
barCodeBuilder.Save(dataDir & Convert.ToString("ITF14_Border_TypeBar_Out.png"), BarCodeImageFormat.Png)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Create an instance of BarCodeReader class and load an existing oncecode barcode.
Using r As New BarCodeReader(dataDir & Convert.ToString("onecode.png"), DecodeType.OneCode)
' Set the ChecksumValidation property to Off.
r.ChecksumValidation = ChecksumValidation.Off
While r.Read()
Console.WriteLine(r.GetCodeType() + ": " + r.GetCodeText())
Console.WriteLine("CheckSum: " + r.GetCheckSum())
End While
End Using
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
'Initialize reader object
Using reader As New Aspose.BarCode.BarCodeRecognition.BarCodeReader("error5.jpg", Aspose.BarCode.BarCodeRecognition.DecodeType.EAN13)
While reader.Read()
'Get code text by passing TRUE to get the Barcode along with checksum value
Console.WriteLine("{0}: {1}", reader.GetCodeType(), reader.GetCodeText(True))
End While
End Using
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate barcode object and Set border width
Dim barCodeBuilder As BarCodeBuilder = New BarCodeBuilder()
barCodeBuilder.BorderWidth = 0.5F
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate barcode object and Set the Code text, symbology type and enable check sum for the barcode
Dim barCodeBuilder As New BarCodeBuilder()
barCodeBuilder.CodeText = "1234567"
barCodeBuilder.SymbologyType = Symbology.Code39Standard
barCodeBuilder.EnableChecksum = EnableChecksum.Yes
barCodeBuilder.Save(Convert.ToString("code39-checeksum_out.png"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
'Generation
'Instantiate BarCodeBuilder object
Dim builder As New Aspose.BarCode.BarCodeBuilder()
'Set the Code text for the barcode
builder.CodeText = "1234567890"
'Set the symbology type to Code128
builder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.Codabar
'Set the EnableChecksum property to yes
builder.EnableChecksum = Aspose.BarCode.EnableChecksum.Yes
'Set the CodabarChecksumMode
builder.CodabarChecksumMode = Aspose.BarCode.CodabarChecksumMode.Mod10
'Save the image on the system
builder.Save("Codabar_Mod10.png")
'Recognition
'Initialize reader object
Using reader As New Aspose.BarCode.BarCodeRecognition.BarCodeReader("Codabar_Mod10.png", Aspose.BarCode.BarCodeRecognition.DecodeType.Codabar)
'Set ChecksumValidation property of the reader to On
reader.ChecksumValidation = Aspose.BarCode.BarCodeRecognition.ChecksumValidation.[On]
While reader.Read()
'Get code text
Console.WriteLine("{0}:{1}", reader.GetCodeType(), reader.GetCodeText())
'Get checksum value
Console.WriteLine("Checksum:" + reader.GetCheckSum())
End While
End Using
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Create instance of BarCodeBuilder, specify codetext and symbology in the constructor
Dim builder As New BarCodeBuilder("11112222333344", Symbology.Codabar)
' Set the codabar start symbol to A and stop symbol to D
builder.CodabarStartSymbol = CodabarSymbol.A
builder.CodabarStopSymbol = CodabarSymbol.D
builder.Save(dataDir & Convert.ToString("Coabar-start-stop-symbols_out.png"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate bar code object
Dim barCodeBuilder As New BarCodeBuilder()
' Set the Code text and code text alignment for the bar code
barCodeBuilder.CodeText = "1234567"
' Align the code text to center
barCodeBuilder.CodeTextAlignment = System.Drawing.StringAlignment.Center
' Set the location and fore color for barcode
barCodeBuilder.CodeLocation = CodeLocation.Above
barCodeBuilder.CodeTextColor = System.Drawing.Color.Red
' Increase the space between code text and barcode to 1 point
barCodeBuilder.CodeTextSpace = 1.0F
' Set the symbology type to Code128
barCodeBuilder.SymbologyType = Symbology.Code128
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Generate the barcode and set code text, symbology type
Dim builder As New BarCodeBuilder("One thing 2 thing", EncodeTypes.Pdf417)
' Set the code text location, graphics unit and margins
builder.CodeLocation = CodeLocation.None
builder.GraphicsUnit = GraphicsUnit.Pixel
builder.Margins.[Set](0)
' Get Bitmap with exact barcode only
Dim bmp As Bitmap = builder.GetOnlyBarCodeImage()
' Allows to set size for whole picture with barcode inside and Save image on local disk
Dim bitmap As Bitmap = builder.GetCustomSizeBarCodeImage(New Size(bmp.Width * 5, bmp.Height * 5), False)
bitmap.Save(dataDir & Convert.ToString("CreateAndSetSizeForImageWithBarcode_out.Png"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Initialize BarCode builder class object
Dim barCodeBuilder As New BarCodeBuilder()
' Set symbology type as GS1-128 AI 8102 coupon extended and set the barcode text
barCodeBuilder.SymbologyType = Symbology.UpcaGs1Code128Coupon
' Upca part is "514141100906", GS1Code128 part is "(8102)03 and save Barcode"
barCodeBuilder.CodeText = "514141100906(8102)03"
barCodeBuilder.Save(dataDir & Convert.ToString("UpcaGs1Code128Coupon_out.png"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Instantiate BarCodeBuilder object
Dim barCodeBuilder As New BarCodeBuilder()
' Set the SymbologyType for the barcode
barCodeBuilder.SymbologyType = Symbology.DataMatrix
' Set the CodeText for the barcode
barCodeBuilder.CodeText = "1234567890"
' Save file to disk
barCodeBuilder.Save(dataDir & Convert.ToString("datamatrix-barcode_out.jpg"), BarCodeImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Generate the barcode and set code text, symbology type
Dim builder As New BarCodeBuilder("123456", EncodeTypes.Code128)
' Get bitmap with exact barcode only and Save image on local disk
Dim bmp As Bitmap = builder.GetOnlyBarCodeImage()
bmp.Save(dataDir & Convert.ToString("CreateImageWithExactBarcodeOnly_out.png"), ImageFormat.Png)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Instantiate BarCodeBuilder object
Dim barCodeBuilder As New BarCodeBuilder()
' Set the SymbologyType for the barcode
barCodeBuilder.SymbologyType = Symbology.Pdf417
' Set the Code text for the barcode
barCodeBuilder.CodeText = "1234567890"
' Save file to disk
barCodeBuilder.Save(dataDir & Convert.ToString("pdf417-barcode_out.jpg"), BarCodeImageFormat.Jpeg)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
Const codetext As String = "被洪水困住的"
' Generate the barcode and Encode the code text
Dim builder As New BarCodeBuilder(codetext, EncodeTypes.Pdf417)
Dim bytes As Byte() = Encoding.GetEncoding(936).GetBytes(codetext)
builder.SetBinaryCodeText(bytes)
' Set the display text
builder.Display2DText = codetext
builder.Save(dataDir & Convert.ToString("CreatePdf417BarcodeWithChineseCharacters_out.png"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
Const codetext As String = "AYŞE" + vbLf + "Ümit" + vbLf + "Ümit@estee.com" + vbLf + "Türkiye"
' Generate the barcode, encode the code text and Set the display text
Dim builder As New BarCodeBuilder(codetext, EncodeTypes.Pdf417)
Dim bytes As Byte() = Encoding.GetEncoding(1254).GetBytes(codetext)
builder.SetBinaryCodeText(bytes)
builder.Display2DText = codetext
builder.Save(dataDir & Convert.ToString("CreatePdf417BarcodeWithTurkishCharacters_out.png"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Initialize BarCodeBuilder
Dim barCodeBuilder As New BarCodeBuilder()
' Set the Smbology Type
barCodeBuilder.SymbologyType = Symbology.QR
' Set the Code text for the barcode
barCodeBuilder.CodeText = "1234567890"
' Save the file on disk and set its image format to Jpeg
barCodeBuilder.Save(dataDir & Convert.ToString("CreateQRbarcode_out.bmp"), BarCodeImageFormat.Bmp)
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Initialize BarCode builder class object
Dim barCodeBuilder As New BarCodeBuilder()
' Set symbology type as UPCA & GS1 Databar coupon and set the barcode text
barCodeBuilder.SymbologyType = Symbology.UpcaGs1DatabarCoupon
' Upca part is "514141100906", GS1Databar part is "(8110)001234502239811110555"
barCodeBuilder.CodeText = "512345678900(8110)001234502239811110555"
' Set barcode caption and barcode
barCodeBuilder.CaptionAbove.Text = "012345-022398"
barCodeBuilder.Save(dataDir & Convert.ToString("couponUpcaDatabar_out.png"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate barcode object
Dim barCodeBuilder As New BarCodeBuilder("0123456789", Symbology.Code39Standard)
' Always show checksum on image
barCodeBuilder.AlwaysShowChecksum = True
' Save file to disk
barCodeBuilder.Save(Convert.ToString("DisplayChecksumCharacter_out.png"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' Instantiate barcode object and Enable border to be shown in the barcode
Dim barCodeBuilder As BarCodeBuilder = New BarCodeBuilder()
barCodeBuilder.BorderVisible = true;
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Initialize the BarCodeBuilder class by passing barcode text and barcode symbology as parameters.
Dim builder As New BarCodeBuilder("abcdefghijklmnopqrstuvwxyzabcdef", Symbology.DataMatrix)
' Set various different properties/variables of the barcode.
builder.BorderVisible = True
builder.ImageQuality = ImageQualityMode.AntiAlias
builder.CodeLocation = CodeLocation.Above
builder.Columns = 4
builder.Rows = 3
' Specify caption settings.
builder.CaptionAbove = New Caption("{Caption ABOVE}")
builder.CaptionAbove.TextAlign = System.Drawing.StringAlignment.Center
builder.CaptionAbove.Visible = True
builder.CaptionAbove.ForeColor = Color.Green
builder.CaptionBelow = New Caption("{Caption BELOW}")
builder.CaptionBelow.TextAlign = System.Drawing.StringAlignment.Far
builder.CaptionBelow.Visible = True
builder.CaptionBelow.ForeColor = Color.Yellow
' Specify text font settings.
builder.CodeTextFont = New Font("Courier New", 24, FontStyle.Bold Or FontStyle.Italic)
' Call the export to XML method to export the properties to XML file.
builder.ExportToXml(dataDir & Convert.ToString("BarCodeBuilder.DataMatrix_out.xml"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Generate the barcode
Dim imgBarcode As Bitmap = Nothing
Dim objBarCodeBuilder As New BarCodeBuilder() With { _
.EncodeType = EncodeTypes.MacroPdf417 _
}
' Set the codetext by converting it into unicode byte array
Dim byteArray As Byte() = Encoding.Unicode.GetBytes("منحة")
objBarCodeBuilder.SetBinaryCodeText(byteArray)
imgBarcode = objBarCodeBuilder.GenerateBarCodeImage()
imgBarcode.Save(dataDir & Convert.ToString("GenerateAndRecognizeUTF8Characters_out.png"))
' Recognize the above barcode
Dim reader As New BarCodeReader(dataDir & Convert.ToString("GenerateAndRecognizeUTF8Characters_out.png"))
While reader.Read()
Dim unicode As Encoding = Encoding.Unicode
' Get the characters array from the bytes
Dim unicodeChars As Char() = New Char(unicode.GetCharCount(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length) - 1) {}
unicode.GetChars(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length, unicodeChars, 0)
' Build unicode string
Dim strCodeText As New String(unicodeChars)
System.Console.WriteLine(strCodeText)
End While
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Set codetext
Dim codeText As String = "12345678"
' Initialize BarCodeBuilder
Dim builder As New BarCodeBuilder(codeText, Symbology.AustraliaPost)
' Set format control code to standard
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.Standard
' Save the image to disk in PNG format
builder.Save(dataDir & Convert.ToString("AustraliaPost-Standard_out.png"))
' Set format control code to ReplyPaid
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.ReplyPaid
' Save the image to disk in PNG format
builder.Save(dataDir & Convert.ToString("AustraliaPost-ReplyPaid_out.png"))
' Set format control code to Customer2
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.Customer2
' Save the image to disk in PNG format
builder.Save(dataDir & Convert.ToString("AustraliaPost-Customer2_out.png"))
' Set format control code to Customer3
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.Customer3
' Save the image to disk in PNG format
builder.Save(dataDir & Convert.ToString("AustraliaPost-Customer3_out.png"))
' Set format control code to Routing
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.Routing
' Save the image to disk in PNG format
builder.Save(dataDir & Convert.ToString("AustraliaPost-Routing_out.png"))
' Set format control code to Redirection
builder.AustraliaPostFormatControlCode = AustraliaPostFormatControlCode.Redirection
' Save the image to disk in PNG format
builder.Save(dataDir & Convert.ToString("AustraliaPost-Redirection_out.png"))
' For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir_ManageBarCodes()
' Initialize BarCode builder class object and set symbology type as Aztec and set the barcode text
Dim builder As New BarCodeBuilder("25", Symbology.Aztec)
' Save barcode
builder.Save(dataDir & Convert.ToString("Aztec_out.png"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment