Completed
Last Updated: 01 Oct 2014 13:00 by ADMIN
ADMIN
Dimitar
Created on: 17 Feb 2014 14:00
Category: UI for WinForms
Type: Feature Request
0
FIX. RadPdfViewer - Document - TextSearch functionality is not exposed.
To reproducce:
- Try to search with the following code:

SearchResult searchResult = this.radPdfViewer1.Document.TextSearch.Find("domain model");
if (searchResult.Result != null)
{
    this.radPdfViewer1.Select(searchResult);
}

Workaround:
- Use reflection:
PropertyInfo property = typeof(Telerik.Windows.Documents.Fixed.Model.RadFixedDocument).GetProperty("TextSearch", BindingFlags.Instance | BindingFlags.NonPublic);
Type propType = property.PropertyType;

MethodInfo findMethod = propType.GetMethod("Find", BindingFlags.Instance | BindingFlags.Public);

SearchResult searchResult = (SearchResult)findMethod.Invoke(property.GetValue(this.radPdfViewer1.Document, null),
    new object[] { "EditorRequired", TextSearchOptions.Default });

if (searchResult.Result != null)
{
    this.radPdfViewer1.Select(searchResult);

}
1 comment
ADMIN
Stefan
Posted on: 18 Feb 2014 08:43
There are methods exposed to the PdfViewerElement, so no need for exposing the Document.TextSearch class, nor using reflection to use the functionality.

 SearchResult searchResult = this.radPdfViewer1.PdfViewerElement.Find("domain model");

 SearchResult searchResult = this.radPdfViewer1.PdfViewerElement.FindPrevious("domain model");