Hi,
We are exporting the documents created in RadRichTextBox to PDF files. Then we add a Barcode on the upper right of pages as a new layer. We need to check if the Barcode borders intersects with any document element (text, table, image, etc.) in the document.
First Approach: We try to set the caret position to first line, then set to line ending, get the location and check if it intersects with Barcode border.
Problem with this approach: When we get the location of caret position, it returns position offset to the RadRichTextBox control. But we need the offset coordinates to the page borders.
Code:
01.
for
(
int
i = 2; i <= pageCount; i++)
02.
{
03.
RadEditor.Document.CaretPosition.MoveToPage(i);
04.
RadEditor.Document.CaretPosition.MoveToCurrentLineEnd();
05.
if
((RadEditor.Document.CaretPosition.Location.X) > 700 && (RadEditor.Document.CaretPosition.Location.Y) < 100)
06.
{
07.
// barcode border intersects with the text in the document
08.
}
09.
}
Second Approach: We can use GetLayoutBoxByPosition method to check if there is an element at the coordinates we will add Barcode border.
Problem with this approach: We should give the position offset to the RadRichTextBox but we need to give the position offset to the page borders.
I've attached 3 images to describe the problem more clearly.
Regards.