ByteScout BarCode Generator SDK – C# – Generate PharmaCode

  • Home
  • /
  • Articles
  • /
  • ByteScout BarCode Generator SDK – C# – Generate PharmaCode

How to generate pharmacode in C# and ByteScout Barcode SDK

This code in C# shows how to generate pharmacode with this how to tutorial

The sample source codes on this page shows how to generate pharmacode in C#. ByteScout Barcode SDK is the fully featured library to generate barcodes. Supports QR Code, Code 39, Code 128, UPC, GS1, GS-128, PDF417, Datamatrix and many other barcode types. Includes various options for barcode generation to ensure output quality, add barcodes to new or existing pdf files and images. It can be used to generate pharmacode using C#.

This code snippet below for ByteScout Barcode SDK works best when you need to quickly generate pharmacode in your C# application. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Implementing C# application typically includes multiple stages of the software development so even if the functionality works please test it with your data and the production environment.

Free trial version of ByteScout Barcode SDK is available on our website. Documentation and source code samples are included.

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="15.0" xmlns=""> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{99735776-2956-463D-9795-EBCE16928C30}</ProjectGuid> <OutputType>Exe</OutputType> <RootNamespace>GeneratePharmaCode</RootNamespace> <AssemblyName>GeneratePharmaCode</AssemblyName> <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Bytescout.BarCode, Version=, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>c:\Program Files\Bytescout BarCode Generator SDK\net2.00\Bytescout.BarCode.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Drawing" /> </ItemGroup> <ItemGroup> <Compile Include="Program.cs" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>

using System; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using Bytescout.BarCode; namespace GeneratePharmaCode { class Program { static void Main(string[] args) { try { // Create new barcode using (Barcode barcode = new Barcode()) { barcode.RegistrationName = "demo"; barcode.RegistrationKey = "demo"; // Set symbology barcode.Symbology = SymbologyType.PharmaCode; // optional margins barcode.Margins = new Margins(5, 5, 5, 5); // Set Value barcode.Value = "12345"; // Set PharmaCode options: //barcode.Options.PharmaCodeSupplementaryCode = true; //barcode.Options.PharmaCodeSupplementaryBarColor = Color.Orange; //barcode.Options.PharmaCodeMiniature = true; //barcode.Options.PharmaCodeTwoTrack = true; // Save 300 DPI Image barcode.ResolutionX = barcode.ResolutionY = 300; barcode.SaveImage("300dpi.png", ImageFormat.Png); // Save 600 DPI Image barcode.ResolutionX = barcode.ResolutionY = 600; barcode.SaveImage("600dpi.png", ImageFormat.Png); } // Show image in default image viewer Process.Start("300dpi.png"); Process.Start("600dpi.png"); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("Press enter key to exit..."); Console.ReadLine(); } } }


Visit ByteScout Barcode SDK page or

explore documentation