RadFixedDocument
RadFixedDocument hosts fixed document content and is the root element in the document elements tree. It holds a collection of RadFixedPage elements.
This article will get you familiar with the basics of RadFixedDocument. It contains the following sections:
What Is RadFixedDocument
RadFixedDocument is the root that contains all other elements in the RadPdfProcessing model. It exposes the following properties:
- Pages: The pages collection that contains all RadFixedPages in the document.
- Annotations: A read-only collection that contains all Annotations in the document.
- Destinations: A collection that contains all Destinations in the document.
- DocumentInfo: Contains additional meta information about the document like author, title, etc.
A complete SDK example how to generate a document is available here.
Example 1 shows how you can create a new RadFixedDocument instance.
Example 1: Create RadFixedDocument
RadFixedDocument document = new RadFixedDocument();
Operating with RadFixedDocument
There are different actions, which you can execute with the help of RadFixedDocument. For example, you can add a RadFixedPage to an existing document.
Example 2 adds a page to the document created in Example 1.
Example 2: Add page to RadFixedDocument
RadFixedPage page = document.Pages.AddPage();
Alternatively, you can create new RadFixedPage and add it to the Pages collection of a document.
Example 3 creates a page and adds it to the document created in Example 1.
Example 3: Create and add a page to RadFixedDocument
RadFixedPage page = new RadFixedPage();
document.Pages.Add(page);
Example 4: Clone a document
RadFixedDocument clonedDocument = document.Clone();
You can merge PDF documents out-of-the-box with the Merge() method of RadFixedDocument. This method clones the source document and appends it to the current instance of RadFixedDocument.
Example 5: Merge documents
document.Merge(source);
Document Information
RadFixedDocument exposes a DocumentInfo property of type RadFixedDocumentInfo, intended to hold additional information about the document. The RadFixedDocumentInfo class allows to set the following properties:
- Author: The author of the document.
- Title: The title of the document.
- Description: Text that describes the content of the document.
Example 6: Set DocumentInfo
document.DocumentInfo.Author = "Jane Doe";
document.DocumentInfo.Title = "RadFixedDocument";
document.DocumentInfo.Description = "This document is intended to explain the RadFixedDocument class from the RadPdfProcessing library";
Currently the DocumentInfo property is for export purposes only and meta information about documents is stripped when importing.