Viscomsoft UWP PDF Viewer SDK

IDocument.UnloadPage Method

 

Unload the Page for blocking calls.
 
 C#

public void UnLoadPage(IPage page)

 


Parameter
page - the IPage object

Namespace: Viscomsoft.UWP.PDFViewerSDK;

No Return Value


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 =  _pdfDisplayManager.Document.LoadPage(1);

Windows.Storage.Streams.IRandomAccessStream stream = await page.drawAsync(pageWidth, pageHeight);
     if (stream != null)
     {
     WriteableBitmap bitmap = new WriteableBitmap(1, 1);
     bitmap.SetSource(stream);
     }

     _pdfDisplayManager.Document.UnloadPage(page);