This is a migrated thread and some comments may be shown as answers.

Read Content from RadRichTextBox

1 Answer 351 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 07 Sep 2017, 11:05 AM

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.

 

 

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 08 Sep 2017, 03:52 PM
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 you to write beautiful native mobile apps using a single shared C# codebase.
Tags
RichTextBox
Asked by
Rahul
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or