Read Content from RadRichTextBox

2 posts, 0 answers
  1. Rahul
    Rahul avatar
    1 posts
    Member since:
    Jul 2017

    Posted 07 Sep Link to this post

    Hi Team, 

    I am looking to read the content of a specific page from RADRichTextBox with  below features

    1. Define Page Start ( from page number) and Read all Data(Text, Image, Symboles etc) up to a given document position. Identify lines, paragraph,  Image etc individually.

    2. Track location changes of any content or image, for example, User inserted any image but later on changes the location of image in RichTextBox

    3. How can we search lines, Images and get the location coordinates of same?

    4. How to know the page properties like font, size, margins etc.

    5. how to validate the content of the PDF page from another PDF stream.

    6. Merge multiple PDF streams( generated by another source)

     

    Kindly help me to know on this and let me know for any question.

     

     

  2. Tanya
    Admin
    Tanya avatar
    575 posts

    Posted 08 Sep Link to this post

    Hi Rahul,

    I will try to answer the questions in the order they appear in your post.

    1. You can read the content of a particular page and extract it in a different document using the Selection API. When you have the content separated, you can traverse each element inside easily. Here is an example of how you could select the second page of the document and extract a new document from it:
    DocumentPosition startPosition = new DocumentPosition(this.radRichTextBox.Document);
    DocumentPosition endPosition = new DocumentPosition(this.radRichTextBox.Document);
     
    startPosition.MoveToPage(2);
    endPosition.MoveToPage(3);
    endPosition.MoveToLastPositionOnPreviousPage();
     
    this.radRichTextBox.Document.Selection.SetSelectionStart(startPosition);
    this.radRichTextBox.Document.Selection.AddSelectionEnd(endPosition);
     
    RadDocument documentFromSelection = this.radRichTextBox.Document.Selection.CreateDocumentFromSelection();

    To iterate the document elements, you can use the EnumerateChildrenOfType() generic method.

    2. I would suggest you check the Track Changes functionality of RadRichTextBox as it seems like it would fit your requirements for this case.

    3. Can you please elaborate more on that requirement? Why you need to search them and how you would search? Do you need to find the DocumentPosition of those elements or their current position on the screen?

    4. The styling mechanism is pretty complex and the properties are stored in the elements they concern. For example, the properties defining how a page should look like (margin, page size, etc.) are preserved in the Section objects. The font properties can be inherited or locally applied to the Span elements. Why you need them? If I have more details here, I might be able to suggest you a more concrete solution.

    5. I am not sure I understand the scenario here. Do you need to compare PDF documents?

    6. Merging PDF documents can be achieved using the PdfStreamWriter functionality of RadPdfProcessing. We have an SDK example showing how this case could be implemented.

    Regards,
    Tanya
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top