Viscomsoft UWP PDF Viewer SDK

IDocument.SaveTextAsync Method

 

Export the text to text file from PDF document.
 
 C#

public async Task SaveTextAsync(StorageFile file)

 


Parameter
file - the StorageFile 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);

   

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

    FileSavePicker savePicker = new FileSavePicker();
   
    savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;

    savePicker.FileTypeChoices.Add("Text", new List<string>() { ".txt" });

    StorageFile file = await savePicker.PickSaveFileAsync();
  
   if (file != null)
   {
     await _pdfDisplayManager.Document.SaveTextAsync(file);
   }