Adding the license key

Setting the license key can be done either by setting the License in the PdfView, or programmatically in code by calling the appropriate method.

License key PdfView property

You can set the value of the License either directly in your XAML or indirectly by referencing a resource, as in this example:

<ui:PdfView Grid.Row="0" Name="PdfView" License="{StaticResource PSPDFKitLicense}" />

You can define the static resource string like this:

<Application
    x:Class="MyApp.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    >

+   <Application.Resources>
+       <ResourceDictionary>
+           <ResourceDictionary.MergedDictionaries>
+               <ResourceDictionary>
+                   <x:String x:Key="PSPDFKitLicense">YOUR_LICENSE_KEY_HERE</x:String>
+               </ResourceDictionary>
+           </ResourceDictionary.MergedDictionaries>
+       </ResourceDictionary>
+   </Application.Resources>

</Application>

Programmatically setting the license key

If setting the license in code, you must call Sdk.Initialize before using any other Nutrient API or instantiating any PdfViews.

An ideal place to do this is in the App constructor, as shown in this example:

public App()
{
  this.InitializeComponent();

  PSPDFKit.Sdk.Initialize("YOUR_LICENSE_HERE");
}