Getting Started
This article will get you started in using the RadPdfProcessing library.
If you still don't have Telerik Document Processing installed, check the First Steps topic to learn how you can obtain the packages through the different suites.
Assembly References
The libraries support .NET 6/.NET 8/.NET 9. .NET Standard-compatible binaries are available as well. The assemblies for .NET Standard don't include 'Windows' in their names (e.g. Telerik.Documents.Core.dll). For more information check Cross-Platform Support article.
In order to use the RadPdfProcessing library in your project, you need to add references to the following assemblies:
.NET Framework | .NET Standard-compatible |
---|---|
Telerik.Windows.Documents.Core.dll | Telerik.Documents.Core.dll |
Telerik.Windows.Documents.Fixed.dll | Telerik.Documents.Fixed.dll |
Telerik.Windows.Zip.dll | Telerik.Zip.dll |
To export images different than Jpeg and Jpeg2000 or ImageQuality different than High you will need to add a reference to the following assembly: | |
- |
Telerik.Documents.ImageUtils.dll
This assembly is not available in UI for Xamarin. |
This assembly is required for the Image Exporting functionality. This is only available in the NET Standard version. | |
- | Telerik.Documents.Fixed.FormatProviders.Image.Skia |
To enable the import of documents containing CMap Tables, you will need to add a reference to: | |
Telerik.Windows.Documents.CMapUtils | Telerik.Documents.CMapUtils |
To describe different colors, shapes and other properties, RadPdfProcessing depends on the listed below .NET assemblies, which you should also refer in your project: | |
WindowsBase.dll | - |
PresentationCore.dll | - |
PresentationFramework.dll | - |
The Telerik.Documents.ImageUtils.dll assembly depends on SkiaSharp. In order to use this assembly, you will need to add a reference to SkiaSharp. With the R2 2023 changes SkiaSharp replaced ImageSharp as the required dependency.
The Telerik.Documents.Fixed.FormatProviders.Image.Skia assembly depends on SkiaSharp. In order to use this assembly, you will need to add a reference to SkiaSharp. The SkiaSharp.NativeAssets.* Nuget package is required as well. This package may differ according to the used platform. There are version for Windows, MacOs, Linux, WebAssembly, Android, iOS, and others.
Creating a Document
RadFixedDocument is the root element in the library. It consists of RadFixedPage objects and instructions for annotations and destinations in the document. Example 1 shows how to create a document and add a page to it.
Example 1: Create RadFixedDocument
RadFixedDocument document = new RadFixedDocument();
RadFixedPage page = document.Pages.AddPage();
The page can then be edited through a FixedContentEditor instance. Example 2 creates an editor and adds a TextFragment to the page object created in Example 1.
Example 2: Add text
FixedContentEditor editor = new FixedContentEditor(page);
editor.DrawText("Hello RadPdfProcessing!");
Exporting to PDF
Exporting to PDF format can be achieved with the PdfFormatProvider class. Example 3 shows how to export the RadFixedDocument created in Examples 1 and 2 to a file.
Example 3: Export to PDF
PdfFormatProvider provider = new PdfFormatProvider();
using (Stream output = File.OpenWrite("Hello.pdf"))
{
provider.Export(document, output);
}