ByteScout QR Code SDK - C# - Convert vCard to QR Code - ByteScout

ByteScout QR Code SDK – C# – Convert vCard to QR Code

  • Home
  • /
  • Articles
  • /
  • ByteScout QR Code SDK – C# – Convert vCard to QR Code

How to convert vcard to QR code in C# using ByteScout QR Code

The tutorial below will demonstrate how to convert vcard to QR code in C#

We made thousands of pre-made source code pieces for easy implementation in your own programming projects. Want to convert vcard to QR code in your C# app? ByteScout QR Code is designed for it. ByteScout QR Code is QR Code barcode generator SDK with tunnable quality and features like QR Code embedded logo or images. Supports batch generation and specialized features like encoding of vCard and other structures inside QR Code barcodes.

C# code samples for C# developers help to speed up coding of your application when using ByteScout QR Code. Follow the instructions from the scratch to work and copy the C# code. 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.

Trial version of ByteScout QR Code is available for free. Source code samples are included to help you with your C# app.

Try it today: Get 60 Day Free Trial or sign up for Web API

using System.Diagnostics; using System.Drawing.Imaging; using System.IO; using Bytescout.BarCode; using Thought.vCards; namespace GenerateVCardQRCode { /// <summary> /// This example demonstrates generation of QR Code encoded vCard. /// It uses vCard library by David Pinch: /// /// vCard Class Library for .NET (Version 0.4; LGPL license) /// Copyright (c) 2007-2009 David Pinch /// /// /// </summary> class Program { static void Main(string[] args) { // Generate vCard vCard vCard = new vCard(); vCard.GivenName = "Forrest"; vCard.FamilyName = "Gump"; vCard.Organization = "Bubba Gump Shrimp Co."; vCard.Title = "Shrimp Man"; vCard.Phones.Add(new vCardPhone("(111) 555-1212", vCardPhoneTypes.Home)); vCard.EmailAddresses.Add(new vCardEmailAddress("", vCardEmailAddressType.Internet)); vCardDeliveryAddress address = new vCardDeliveryAddress(); address.AddressType.Add(vCardDeliveryAddressTypes.Home); address.Street = "100 Waters Edge"; address.City = "Baytown"; address.Region = "LA"; address.PostalCode = "30314"; address.Country = "United States of America"; vCard.DeliveryAddresses.Add(address); // Save vCard data to string vCardStandardWriter writer = new vCardStandardWriter(); StringWriter stringWriter = new StringWriter(); writer.Write(vCard, stringWriter); // Create and activate Bytescout.Barcode.QRCode instance using (QRCode barcode = new QRCode("demo", "demo")) { // Set barcode value barcode.Value = stringWriter.ToString(); // Save barcode to image barcode.SaveImage("result.png", ImageFormat.Png); } // Open generated barcode image in default associated application Process.Start("result.png"); } } }

Try it today: Get 60 Day Free Trial or sign up for Web API

<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Thought.vCards" version="1.0.9" targetFramework="net20" requireReinstallation="true" /> </packages>

Try it today: Get 60 Day Free Trial or sign up for Web API

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" 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>{2E45E9EF-7D6B-45F8-963F-AD1B246EB641}</ProjectGuid> <OutputType>Exe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>vCardQRCode</RootNamespace> <AssemblyName>vCardQRCode</AssemblyName> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <TargetFrameworkProfile /> </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.QRCode, Version=, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>c:\Program Files\Bytescout QR Code SDK\net40\Bytescout.BarCode.QRCode.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.Xml" /> <Reference Include="Thought.vCards"> <HintPath>packages\Thought.vCards.1.0.9\lib\net40\Thought.vCards.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <None Include="packages.config" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

Try it today: Get 60 Day Free Trial or sign up for Web API

Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28010.2003 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vCardQRCode", "vCardQRCode.csproj", "{2E45E9EF-7D6B-45F8-963F-AD1B246EB641}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {2E45E9EF-7D6B-45F8-963F-AD1B246EB641}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E45E9EF-7D6B-45F8-963F-AD1B246EB641}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E45E9EF-7D6B-45F8-963F-AD1B246EB641}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E45E9EF-7D6B-45F8-963F-AD1B246EB641}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2EF74C21-75D6-4CB9-8C3B-8DE48CD63854} EndGlobalSection EndGlobal

Try it today: Get 60 Day Free Trial or sign up for Web API


Get 60 Day Free Trial or Visit ByteScout QR Code page

Explore ByteScout QR Code documentation


Sign Up for free Web API key

Explore Web API Documentation