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.Resources>
+       <ResourceDictionary>
+           <ResourceDictionary.MergedDictionaries>
+               <ResourceDictionary>
+                   <x:String x:Key="PSPDFKitLicense">YOUR_LICENSE_KEY_HERE</x:String>
+               </ResourceDictionary>
+           </ResourceDictionary.MergedDictionaries>
+       </ResourceDictionary>
+   </Application.Resources>


Programmatically Setting the License Key

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

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

public App()