In this document
chevron_rightCreating a Windows 10 app using PDFTron for UWP
An evaluation or commercial license key is required to run PDFTron. If you are evaluating the SDK and do not have a key, please obtain one, and then visit this page via the link included in the trial email. If your company has licensed PDFTron then you already received your key in an email from firstname.lastname@example.org. See sign in for more details.
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.
linkCreating a Windows 10 app using PDFTron for UWP
- Create a new project in Visual Studio 2015. We will be using C# and create a blank 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 reference to the PDFNet SDK