Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, you also have to include a license key in your projects. Please refer to this link to know about registering Syncfusion license key in your ASP.NET Core application to use our components.
To get start with ASP.NET Core application, need to ensure the following software to be installed on the machine.
The following steps to create ASP.NET Core Application.
Step 1: Create ASP.NET Core Web Application with default template project in Visual Studio 2017.
Step 2: Once your project created. We need to add Syncfusion EJ2 package into your application by using Nugget Package Manager.
Open the nuGet
package manager.
Install the Syncfusion.EJ2 package to the application
After Installation complete this will included in the project. You can refer it from the Project Assembly Reference.
We need to install NewtonSoft.JSON as dependency since it Syncfusion.EJ2 dependent to NewtonSoft.JSON package.
Step 3: Open the Views/_ViewImports.cshtml to import Syncfusion.EJ2 package.
@addTagHelper *, Syncfusion.EJ2
Step 4: Add client side resource through CDN
or local package
in the layout page Views/Shared/_Layout.cshtml.
<head>
@* Syncfusion Essential JS 2 Styles *@
<link rel="stylesheet" href="https://cdn.syncfusion.com/ej2/material.css" />
@* Syncfusion Essential JS 2 Scripts *@
<script src="https://cdn.syncfusion.com/ej2/dist/ej2.min.js"></script>
</head>
Step 5: Adding Script Manager in layout page Views/Shared/_Layout.cshtml.
<body>
@RenderBody()
@RenderSection("Scripts", required: false)
<ejs-scripts></ejs-scripts>
</body>
Step 6: Add the below code to your Index.cshtml view page which is present under Views/Home folder, to initialize the barcode.
Create and add a barcode
(JSON data) with specific size, value .
<ejs-barcodegenerator id="container" width="200px" height="150px" invalid="invalidInput" type="Codabar" value="123456789" mode="SVG"></ejs-barcodegenerator>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Syncfusion.EJ2.BarcodeGenerator;
namespace EJ2CoreSampleBrowser.Controllers.Barcode
{
public partial class BarcodeController : Controller
{
// GET: Annotations
public ActionResult Codabar()
{
return View();
}
}
}
You can add the QR code in our barcode generator component.
<ejs-qrcodegenerator id="container" width="200px" height="150px" value="Syncfusion"></ejs-qrcodegenerator>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Syncfusion.EJ2.BarcodeGenerator;
namespace EJ2CoreSampleBrowser.Controllers.Barcode
{
public partial class BarcodeController : Controller
{
// GET: Annotations
public ActionResult qrcode()
{
return View();
}
}
public class ExpandOptionsqrcode
{
public string text;
public string value;
}
}
You can add the datamatrix code in our barcode generator component.
<ejs-datamatrixgenerator id="container" width="200px" height="150px" value="Syncfusion" mode="SVG"></ejs-datamatrixgenerator>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Syncfusion.EJ2.BarcodeGenerator;
namespace EJ2CoreSampleBrowser.Controllers.Barcode
{
public partial class BarcodeController : Controller
{
public ActionResult datamatrix()
{
return View();
}
}
}