A demo license key or a commercial license key is required to proceed. If you have not yet received a license key, please obtain a license key here before continuing to read this documentation.
This tutorial assumes that you have access to Windows 10.0 and Visual Studio 2015 installed. It also assumes that you have installed the appropriate kits to develop UWP apps. We will be using C# to create a basic document viewer using the PDFViewCtrl. This tutorial was written using Visual Studio 2015, version 14.0.25123.00 Update 2.
Installing PDFNet for UWP is very simple. We do this by executing the VSIX installer located in side the
Lib folder. Simply follow the instructions.
If you already have a version of PDFNet for UWP installed, you might get an error message stating "This extension is already installed to all applicable products." This might happen if you get a custom build to replace the official release. If this is the case, you can uninstall the old version by, in Visual Studio 2015, opening Tools -> Extensions and Updates. Under the menu Installed -> All, you should be able to find PDFNet for UWP. Select it and click Uninstall.
Creating a Windows 10 app using PDFTron for UWP
- Create a new project in Visual Studio 2015. We will be using C# and create a blan app to keep things simple. We will be calling the App PDFNetSample.
Under Templates, select Visual C#, Windows, Universal and then select Blank App. In the dialog to select Platform Versions, simply click OK.
Figure 1: Creating an empty project
- Now, we need to add a reference to the PDFNet SDK. Note that we need to ensure the build architecture of
the project is not "Any CPU", because we can't use it in projects that include native code. In this case, we will use x86.
Click on Build -> Configuration Manager and, if it is "Any CPU", change the active solution platform to x86.
Figure 2: Build architecture
Next, find the references in the Solution Explorer, right click and select "Add Reference…". In the dialog, select Universal Windows -> Extensions and check the box next to PDFNet SDK for UWP. This reference will work for any build architecture (though not with "Any CPU"). To make sure everything works, try building the project.
Figure 3: Adding a referehce to the PDFNet SDK