Viscomsoft UWP PDF Viewer SDK

PDFDisplayManager Object

Description

PDFDisplayManager represents the PDF View. You must create the instance of PDFDisplayManager first , when you want to Load and view PDF files.

Namespace: Viscomsoft.UWP.PDFViewerSDK

Example

   

[C# Syntax] 
using Viscomsoft.UWP.PDFViewerSDK;

public sealed partial class MainPage : Page
{

  private PDFDisplayManager _pdfDisplayManager = null;


  private async void open(StorageFile file)
  {

    DocumentFactory factory = new DocumentFactory();

    IDocument doc = factory.createDocument(file.Name);

    bool opened = await doc.openAsync(file);

    _pdfDisplayManager = new PDFDisplayManager();

    _pdfDisplayManager.Width = (int)Window.Current.Bounds.Width;

    _pdfDisplayManager.Height = (int)Window.Current.Bounds.Height;

    _pdfDisplayManager.Document = doc;

    _pdfDisplayManager.GotoPage(1);

    uiViewPanel.Child = createScrollViewControl();

  }

  private UIElement createScrollViewControl()
  {

      ScrollViewControl svc = new ScrollViewControl();

      svc.DataContext = _pdfDisplayManager;

      svc.Name = "uiScrollView";

      svc.SetBinding(ScrollViewControl.ItemCountProperty, new Binding { Path = new PropertyPath("PageCount") });

      svc.SetBinding(ScrollViewControl.ItemIndexProperty, new Binding { Path = new PropertyPath("CurrentIndex"), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.Default });

      svc.StartIndex = _pdfDisplayManager.CurrentIndex;

      return svc;

}

 

 

 

Double-click on MainPage.xaml to open it in the Design view.  In XAML code window, add Border named uiViewPanel
 the code looks like this
 

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid.RowDefinitions>

<RowDefinition Height="100" />

<RowDefinition Height="*" />

</Grid.RowDefinitions>

<Border Grid.Row="1" x:Name="uiViewPanel" Background="#FFE6E6E6" Margin="-10,10,10,-10"></Border>