# RadFixedDocument

**RadFixedDocument** is the class representing a PDF document inside **RadPdfViewer**.

> important Since R3 2020 RadPdfViewer uses [PdfProcessing](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview) and its [RadFixedDocument](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/model/radfixeddocument) as a model.

## Creation

You can create a PDF document with the API of PdfProcessing and directly assing it to RadPdfViewer.

#### \[C#] Example 1: Create a PDF document and show it

```C#
RadFixedDocument document = new RadFixedDocument();
using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(document))
{
    editor.InsertRun("Hello PDF!");
}

this.pdfViewer.Document = document;
```

For an existing PDF document, an instance of **RadFixedDocument** can be created using **PdfFormatProvider**  and assigned to **RadPdfViewer** in the following way:

#### \[C#] Example 2: Import a PDF document

```C#

Stream stream = System.Windows.Application.GetResourceStream(new Uri("PdfViewerDemo;component/SampleData/test.pdf", UriKind.Relative)).Stream;

Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider pdfFormatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();
pdfFormatProvider.ImportSettings = Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.PdfImportSettings.ReadOnDemand;

RadFixedDocument document = pdfFormatProvider.Import(stream, null);
this.pdfViewer.Document = document;
```

> The **PdfFormatProvider** of **RadPdfViewer** must not be confused with that of **RadRichTextBox**. Telerik.Windows.Documents.**Fixed**.FormatProviders.Pdf.PdfFormatProvider is the provider that **RadPdfViewer** uses to import files. It is located in the **Telerik.Windows.Documents.Fixed** assembly.For reference, the Telerik.Windows.Documents.FormatProviders.Pdf.PdfFormatProvider of **RadRichTextBox** is included in the **Telerik.Windows.Documents.FormatProviders.Pdf** assembly, in a namespace with the same name. The latter can be used only to export **RadDocument** to PDF.

As you can see, the Import() method of PdfFormatProvider accepts two parameters  – stream with the contents of the PDF file and format provider settings specifying the loading mode.

For details about the model used by PdfViewer and the members of [RadFixedDocument](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/model/radfixeddocument), check the documentation of [PdfProcessing](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview).

## See Also

* [PdfProcessing Documentation](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview)
