Viscomsoft UWP PDF Viewer SDK

IDocument.LoadPageAsync Method

 

Load Page for non-blocking calls.
 
 C#

public IPage LoadPageAsync(int pageNumber)

 


Parameter
pagenumber - the page number

Namespace: Viscomsoft.UWP.PDFViewerSDK;

Return Value
Return the IPage object.

Example

   

[C# Syntax] 
using Viscomsoft.UWP.PDFViewerSDK;
   
    DocumentFactory factory = new DocumentFactory();

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

    bool opened = await doc.OpenAsync(file);

    if (opened)
    {
      if (doc.RequiresPassword)
      {

       string strPassword = await InputTextDialogAsync("Password");

       bool passwordApplied = await doc.applyPasswordAsync(strPassword);
      
       if (!passwordApplied)
       {
         MessageDialog messageDialog = new MessageDialog("Password is incorrect", "Open File");
         await messageDialog.ShowAsync();
         return;
        }

      }

    }

    _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();

    IPage page = await _pdfDisplayManager.Document.LoadPageAsync(1);

Windows.Storage.Streams.IRandomAccessStream stream = await page.drawAsync(pageWidth, pageHeight);