Some test text!

Loading...
Guides
Viewer Control

Implement PDF Viewer Control in UWP app

This guide goes over the steps to implement the Viewer Control in a UWP application

  1. To begin working with ViewerControl, you must have first initialize the PDFTron's UWP SDK by calling pdftron.PDFNet.Initialize("your_key") at the initialization of your application.

  2. Add WinUI 2 resources to the application

    When using WinUI library it is necessary to call it's resource dictionary and add it to the application's resources otherwise the application might crash with a missing resource (style or theme) not found issue

//@data {"ga":8640113736}// <Application.Resources> <ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries> </Application.Resources> ```

<div class='info'>
<div class='body'>For more information on starting with WinUI please follow the official <a href="https://docs.microsoft.com/en-us/windows/apps/winui/winui2/getting-started">Microsoft getting started guide</a></div>
</div>
  1. Enable Share Document Feature by adding runtime directives

    In order to use the Share feature, it is necessary to add System.Collections.Generic.List{} directive to the Default.rd file

//@data {"ga":6170400733}//

<Type Name="System.Collections.Generic.List{}" MarshalObject="Required All"/>

</Application>
</Directives>
```
  1. Enable support for MS Office Conversion by adding the required resource files to the project. To do this go into the solution explorer, right click your solution, and click Add -> Existing Item.... Go to the UWP SDK folder -> Resources and add the files pdftron_exotic_font_resources.plugin, pdftron_layout_resources_.plugin, and pdftron_smart_substitution.plugin. For each file, right click the file and click properties and change the Build Action to Content.

    For more information on MS Office Conversion, you can look here.

  2. Add ViewerControl to a page

    ViewerControl can be easily added to a UWP App page.

//@data {"ga":6448432080}//

<viewer:ViewerControl/>
</Page>
```
  1. Check the ViewerControl sample app

    You can also check a sample project that implements the ViewerControl

Get the answers you need: Support

UPCOMING WEBINAR: Live tech update and run-through. October 21 @ 11am PDT