Thanks to visit codestin.com
Credit goes to docs.telerik.com

Available for: UI for ASP.NET MVC | UI for ASP.NET AJAX | UI for Blazor | UI for WPF | UI for WinForms | UI for Silverlight | UI for Xamarin | UI for WinUI | UI for ASP.NET Core | UI for .NET MAUI

New to Telerik Document Processing? Download free 30-day trial

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.

Package References

The libraries support .NET 8, .NET 9 and .NET 10. .NET Standard-compatible packages are available as well. The packages for .NET Standard don't include 'Windows' in their names (e.g. Telerik.Documents.Core). 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 packages:

.NET Framework .NET Standard-compatible
Telerik.Windows.Documents.Core Telerik.Documents.Core
Telerik.Windows.Documents.Fixed Telerik.Documents.Fixed
 
Telerik.Windows.Documents.Fixed.FormatProviders.Ocr Telerik.Documents.Fixed.FormatProviders.Ocr
This reference is recommended to always be in the form of a NuGet package, as it will add the required Tesseract references and files automatically. Otherwise, a manual intervention might be required.
Telerik.Windows.Documents.Tesseract.Ocr Telerik.Documents.Tesseract.Ocr
 
To export images different than Jpeg and Jpeg2000 or ImageQuality different than High you will need to add a reference to the following package:
- Telerik.Documents.ImageUtils
This package is not available in UI for Xamarin.
This package 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 package depends on SkiaSharp. In order to use this package, 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 package depends on SkiaSharp. In order to use this package, 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.

[C#] 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.

[C#] 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.

[C#] Example 3: Export to PDF

PdfFormatProvider provider = new PdfFormatProvider();
using (Stream output = File.OpenWrite("Hello.pdf"))
{
    provider.Export(document, output, TimeSpan.FromSeconds(10));
}

For more complete examples head to the Developer Focused Examples section of the library.

See Also

In this article