RadFixedPage conforms to the IContentRootElement interface and is the root element of all fixed content elements in the document model. Figure 1 in the Model article demonstrates in details the structure of the document model.
This article covers the following topics:
The root element in the document model tree is RadFixedDocument. The document, on the other hand, consists of RadFixedPages hosting all content elements. You can add a RadFixedPage to a document in several ways.
RadFixedPage exposes the following properties:
- Content: The content elements collection.
- Annotations: Collection that contains all Annotations and Destinations in the RadFixedPage.
- MediaBox: Defines the boundaries of the physical medium on which the page will be printed. Any content falling outside this boundary is discarded without affecting the meaning of the PDF file.
- CropBox: Defines the region to which the contents of the page are clipped (cropped) when displayed or printed. This boundary determines the visible page content. The default value is the page’s media box.
- Size: Property of type Size representing the size of the page. Its value is determined by the width and height of the MediaBox.
- Rotation: Property of type Rotation representing the page rotation.
Example 1 demonstrates how to create a new RadFixedPage instance and add it to the Pages collection of RadFixedDocument.
Example 1: Create RadFixedPage and add it to a document
RadFixedDocument document = new RadFixedDocument(); RadFixedPage page = new RadFixedPage(); document.Pages.Add(page);
There are several operations, which you can execute directly over a RadFixedPage instance.
RadFixedPage is designed to hold any content element in the document model. There are several ways to achieve that.
Example 2 shows how to add a previously created ContentElement in a RadFixedPage.
Example 2: Add content element to RadFixedPage
RadFixedPage page = new RadFixedPage(); page.Content.Add(contentElement);
You can also use the Add[Element]() methods of RadFixedPages's Content property. The respective methods - AddPath(), AddTextFragment(), AddImage(), create the element, add it to the page and return it for your convenience.
You can add different annotations in RadFixedPage by using the Annotations collection.
Example 3 shows how to add a previously created annotation in a RadFixedPage.
Example 3: Add annotation to RadFixedPage
RadFixedPage page = new RadFixedPage(); page.Annotations.Add(annotation);
The other possible approach is using the AddLink() method of the Annotations property. The method creates the link, adds it to the page and returns it. More information on the topic is available in the Annotation article.
RadFixedPage's API provides you with the ability to modify its properties.
Example 4 shows how you can change the Rotation and Size properties of a RadFixedPage.
Example 4: Change properties of a RadFixedPage
RadFixedPage page = new RadFixedPage(); page.Rotation = Rotation.Rotate270; page.Size = new Size(792, 1128);