/// <summary> /// <inheritdoc/> /// </summary> public void NavigateToFindPlace(IPDFFindPosition position) { if (position == null) { return; } ClearSelectionRectangles(); if (position is PDFFindPosition ourPosition && position.Page.RelatedPage is PDFPage ourPage) { PageIndexWithSelections = ourPage.PageIndex; var positionX = -1; var positionY = -1; var pageHandle = _mainComponent.PDFiumBridge.FPDF_LoadPage(_mainComponent.PDFiumDocument, ourPosition.Page.RelatedPage.PageIndex); var textPageHandle = _mainComponent.PDFiumBridge.FPDFText_LoadPage(pageHandle); var rectCount = _mainComponent.PDFiumBridge.FPDFText_CountRects(textPageHandle, ourPosition.Position, ourPosition.Length); for (int i = 0; i < rectCount; i++) { double left, top, right, bottom; left = top = right = bottom = 0; if (_mainComponent.PDFiumBridge.FPDFText_GetRect(textPageHandle, i, ref left, ref top, ref right, ref bottom)) { AddSelectionRectangle(left, top, right, bottom); if (positionX == -1) { positionX = (int)Math.Round(left, 0); positionY = (int)Math.Round(top, 0); } } } _mainComponent.PDFiumBridge.FPDFText_ClosePage(textPageHandle); _mainComponent.PDFiumBridge.FPDF_ClosePage(pageHandle); var previousCurrentPageIndex = CurrentPageIndex; var currentPageIndex = position.Page.RelatedPage.PageIndex + 1; SetCurrentInformation(position.Page.RelatedPage); NavigatedToPage?.Invoke(this, new NavigatedToPageEventArgs(previousCurrentPageIndex, CurrentPageIndex, positionX, positionY)); }
/// <summary> /// Adds position into <see cref="Positions"/>. /// </summary> /// <param name="position">Position to add into <see cref="Positions"/>.</param> public void AddPosition(IPDFFindPosition position) { Positions.Add(position); }