Register Syncfusion® License key in Document Processing application

22 Jul 202616 minutes to read

The generated license key is just a string that needs to be registered before any Syncfusion® control is initiated. The following code is used to register the license.

Registering a single license key

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

Registering multiple license keys

You can register multiple license keys using either a comma (,) or a semicolon (;) as the separator between keys.

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY_1,YOUR LICENSE KEY_2,...");

or

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY_1;YOUR LICENSE KEY_2;...");

NOTE

  • Place the license key between double quotes. Also, ensure that Syncfusion.Licensing.dll is referenced in your project where the license key is being registered.
  • Syncfusion® license validation is done offline during application execution and does not require internet access. Apps registered with a Syncfusion® license key can be deployed on any system that does not have an internet connection.

IMPORTANT

Syncfusion® license keys can be validated during the Continuous Integration (CI) processes to ensure proper licensing and prevent licensing errors during deployment. Refer to the CI License Validation section for detailed instructions on how to implement it.

Recommended place to register the license in the various platform controls (ASP.NET Core, Xamarin, etc.) included in Document Processing platforms is covered in the following section.

ReactJS

Register the license key in the index.js file of the React project.

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { registerLicense } from '@syncfusion/ej2-base';

// Registering Syncfusion license key
registerLicense('License Key');

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

Blazor

License registration requirements vary depending on the project type.

1. Blazor Web App (Interactive Auto)

Open the ~/Program.cs file in both the server and client projects of a Blazor Web App (Interactive Auto) and register the Syncfusion® Blazor license key.

// Register the Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

2. Blazor Web App (Interactive Server)

  • For .NET 8, .NET 9, and .NET 10, open the ~/Program.cs file and register the Syncfusion® license key.
var app = builder.Build();
// Register the Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

3. Blazor Web App (Interactive WebAssembly)

Open the ~/Program.cs file in both the server and client projects of a Blazor Web App (Interactive WebAssembly) and register the Syncfusion® Blazor license key.

// Register the Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

4. Blazor Standalone WebAssembly App

Open the ~/Program.cs file and register the Syncfusion® Blazor license key in the client web app.

// Register the Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

var builder = WebAssemblyHostBuilder.CreateDefault(args);

....
....

Angular

Register the license key in the main.ts file of the Angular project.

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import { registerLicense } from '@syncfusion/ej2-base';

// Registering Syncfusion license key
registerLicense('License Key');

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.error(err));

.NET MAUI

In .NET MAUI, license keys can be registered using either of two approaches.

1. Registering license key in App.xaml.cs

You can register the license key in App.xaml.cs constructor before InitializeComponent(). If the App() constructor is not available in App.xaml.cs, create the App() constructor in App.xaml.cs and register the license key inside the constructor.

public App()
{
	//Register Syncfusion<sup>®</sup> license
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
	
	InitializeComponent();
	
	MainPage = new AppShell();
}

2. Registering license key in MauiProgram.cs

Register the license key in MauiProgram.cs when initializing or registering any Syncfusion® controls within this file. This ensures that all controls are fully licensed and functional from the moment the application starts. Add the license registration code inside the CreateMauiApp method in MauiProgram.cs.

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        // Register the Syncfusion license key
        Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR_LICENSE_KEY");
 
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .ConfigureSyncfusionCore()
            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
            });

        return builder.Build();
    }
}

ASP.NET Core

Register the license key in the Configure method of Startup.cs

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
	//Register Syncfusion license
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
	
	loggerFactory.AddConsole(Configuration.GetSection("Logging"));
	loggerFactory.AddDebug();

	...
	
}

JavaScript es6 / TypeScript

Register the license key at the entry point of the project before using the Syncfusion® controls.

// Registering Syncfusion license key
import { registerLicense } from '@syncfusion/ej2-base';

ej.base.registerLicense('License key');

JavaScript (Essential® JS 2)

Syncfusion® license key should be registered, if your project using Syncfusion® EJ2-JavaScript packages reference. The generated license key is a string that needs to be registered after any Syncfusion JavaScript script reference.

The following code is used to register the license.

JavaScript es5

Register the license key by using registerLicense method after the Syncfusion JavaScript script file reference as below.

// Registering Syncfusion license key
ej.base.registerLicense('License Key');

VueJS

Register the license key in the index.js file of the Vue project.

import { createApp } from 'vue'
import App from './App.vue'
import { registerLicense } from '@syncfusion/ej2-base';

// Registering Syncfusion license key
registerLicense('License Key');
createApp(App).mount('#app')

ASP.NET MVC

Register the license key in Application_Start method of Global.asax.cs/Global.asax.vb

void Application_Start(object sender, EventArgs e)
{
	//Register Syncfusion license
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
	
	// Code that runs on application startup
	RouteConfig.RegisterRoutes(RouteTable.Routes);
	BundleConfig.RegisterBundles(BundleTable.Bundles);
}
Protected Sub Application_Start()
        'Syncfusion Licensing Register
        Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY")
        AreaRegistration.RegisterAllAreas()
        Register(GlobalConfiguration.Configuration)
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters)
        RouteConfig.RegisterRoutes(RouteTable.Routes)
        BundleConfig.RegisterBundles(BundleTable.Bundles)
End Sub

WPF

Register the license key in App constructor of App.xaml.cs in C#. If App constructor not available in App.xaml.cs, create the “App()” constructor in App.xaml.cs and register the license key inside the constructor. In Visual Basic, register the license code in App.xaml.vb.

public partial class App : Application
{
	public App()
	{
		//Register Syncfusion license
		Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
	}	
}
Private Sub New()
	'Register Syncfusion License
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY")
End Sub

Windows Forms

Register the licensing code in the Main method before calling Application.Run() in C#. In Visual Basic, register the licensing code in the Application.Designer.vb file constructor.

static void Main()
{
    //Register Syncfusion license
    Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
	
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new Form1());
}
Public Sub New()
		MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
		'Register Syncfusion License
		Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY")
		Me.IsSingleInstance = False
		Me.EnableVisualStyles = True
		Me.SaveMySettingsOnExit = True
		Me.ShutdownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub

UWP

Register the license key in App.xaml.cs constructor before InitializeComponent() in C#. If App constructor not available in App.xaml.cs, create the “App()” constructor in App.xaml.cs and register the license key inside the constructor. In Visual Basic, register the licensing code in App.xaml.vb file before OnLaunched event.

public App()
{
	//Register Syncfusion license
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

	this.InitializeComponent();
	this.Suspending += OnSuspending;
}
Public Sub New()
	'Register Syncfusion License
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY")
End Sub

Protected Overrides Sub OnLaunched(e As Windows.ApplicationModel.Activation.LaunchActivatedEventArgs)

...

End Sub

Java

Import ‘syncfusion.licensing’ package and register the license key in the main method of your console application.

// Refer the licensing package
import com.syncfusion.licensing.*;

static void main() { 
// Register Syncfusion license 
SyncfusionLicenseProvider.registerLicense("YOUR LICENSE KEY"); 
}

NOTE

License key registration is not required for Java before v19.1.

Xamarin.Forms

Register the license key in App.xaml.cs constructor before InitializeComponent(). If App constructor not available in App.xaml.cs, create the “App()” constructor in App.xaml.cs and register the license key inside the constructor.

public App()
{
	//Register Syncfusion license
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
	
	InitializeComponent();
	
	MainPage = new App1.MainPage();
}

NOTE

If you are developing an application using Gorilla Player SDK, you must register the Syncfusion® license key in Xamarin.Forms.Android, Xamarin.Forms.iOS, and Xamarin.Forms.UWP.
Refer this link to register Syncfusion® license key in Xamarin.Forms.Android
Refer this link to register Syncfusion® license key in Xamarin.Forms.iOS
Refer this link to register Syncfusion® license key in Xamarin.Forms.UWP

If you are using Prism Framework in your application, register the license key before InitializeComponent in the OnInitialized method of App.xaml.cs.

protected override async void OnInitialized()
{
	//Register Syncfusion license
    Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
 
    InitializeComponent();
 
    await NavigationService.NavigateAsync("NavigationPage/MainPage");
}

Xamarin.Android

Register the license key in OnCreate override method of your main activity class before initializing any Syncfusion® control.

protected override void OnCreate(Bundle savedInstanceState)
{
	//Register Syncfusion license
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

	base.OnCreate(savedInstanceState);

	// Set our view from the "main" layout resource
	SetContentView(Resource.Layout.Main);
}

Xamarin.iOS

Register the license key in FinishedLaunching override method of AppDelegate.cs

public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
	//Register Syncfusion license
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

	// create a new window instance based on the screen size
	Window = new UIWindow(UIScreen.MainScreen.Bounds);

	// If you have defined a root view controller, set it here:
	// Window.RootViewController = myViewController;

	// make the window visible
	Window.MakeKeyAndVisible();

	return true;
}

ASP.NET

Register the license key in Application_Start method of Global.asax.cs/Global.asax

void Application_Start(object sender, EventArgs e)
{
	//Register Syncfusion license
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
	
	// Code that runs on application startup
	RouteConfig.RegisterRoutes(RouteTable.Routes);
	BundleConfig.RegisterBundles(BundleTable.Bundles);
}
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
	'Syncfusion Licensing Register
	Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY")
	'Code that runs on application startup
	AuthConfig.RegisterOpenAuth()
	RouteConfig.RegisterRoutes(RouteTable.Routes)
	System.Web.Http.GlobalConfiguration.Configuration.Routes.MapHttpRoute(name:="DefaultApi", routeTemplate:="api/{controller}/{action}/{id}", defaults:=New With {.id = System.Web.Http.RouteParameter.[Optional]
	   })
End Sub

JavaScript (Essential® JS 1)

You must have an active Syncfusion® Essential JS license to use Syncfusion® Essential JS1 (.js files). However, if you only use the Syncfusion® Essential JS1 product, you do not need to register the Syncfusion® License keys in your scripts (.js files).

For the following platforms, you can use the script files without registering the license keys.

JavaScript (Essential® JS 1)

  • AngularJS

  • Angular

  • Aurelia

  • ReactJS

  • TypeScript

  • EmberJS