Viscomsoft UWP PDF Viewer SDK

IPage.DrawSelection Method

 

Draw the selection rectangle.
 
 C#

public void DrawSelection(ISelection start, ISelection end, Color color)

 


Parameter
start - the start position of ISelection object
end - the end position of ISelection object
color - the color of selection rectangle 

Namespace: Viscomsoft.UWP.PDFViewerSDK;

No Return Value


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

     foreach (IPage page in _pdfDisplayManager.getActivePages())
     {
       page.DrawSelection(page.GetSelectionMin(), page.GetSelectionMax(),        Windows.UI.Color.FromArgb(255, 255, 0, 0));
     }

  }

  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;

}