You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a block that contains some text and is located at a specific position with a defined size. I need to draw a rectangle at the same position and size, style it with a black stroke and a light blue background, and then place text and an image centered both vertically and horizontally within this rectangle.
20
+
This article shows how to draw rectangles with formatted text or image content with the [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}) in the [PdfProcessing]({%slug radpdfprocessing-overview%}) library.
26
21
27
22
This knowledge base article also answers the following questions:
28
23
- How can I draw a rectangle and style it using RadPdfProcessing?
@@ -35,57 +30,105 @@ To draw a rectangle with a black stroke and a light blue background, add centere
35
30
36
31
### Drawing a Rectangle
37
32
38
-
1. Create a `RectangleGeometry` and define its dimensions.
39
-
2. Create a `Path` and set the `RectangleGeometry` to its geometry.
40
-
3. Set the `IsFilled` and `IsStroked` properties of the path to true.
41
-
4. Specify the `Fill`, `Stroke`, and `StrokeThickness` properties for the path.
42
-
5. Add the path to the page content.
33
+
1. Draw a rectangle by creating a **Path** with a **RectangleGeometry** , defining its dimensions, formatting it, and inserting it in the page.
34
+
2. Create a **Block** of text, format it, and draw it on top of the rectangle with the **FixedContentEditor** by specifying its **Position**.
35
+
3. Draw a second rectangle at a different position.
36
+
4. Create an image **Block** and draw it on top of the second rectangle with the **FixedContentEditor** while specifying its **Position**.
37
+
5. Export the **RadFixedDocument** to PDF.
38
+
39
+

Following these steps allows you to draw styled rectangles, add centered text, and insert centered images within these rectangles using the RadPdfProcessing library.
100
+
radFixedPage.Content.Add(rectangle2Path);
101
+
102
+
// Draw a block with an image on top of the second rectangle
0 commit comments