Viscomsoft UWP PDF Viewer SDK

IDocument.CloseAsync Method

 

Close the document.
 
 C#

public async Task CloseAsync()

 


No Parameter


Namespace: Viscomsoft.UWP.PDFViewerSDK;

Return Value
No Return value.

Example

   

[C# Syntax] 
using Viscomsoft.UWP.PDFViewerSDK;
   
    await close();
    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();


 private async Task close()
 {
   if (_pdfDisplayManager != null)
   {
   await _pdfDisplayManager.Document.CloseAsync();
    _pdfDisplayManager = null;
   }
 }