# PDF Export

The libraries included in **Telerik Document Processing** allow you to create, modify, and export PDF documents, and convert a document from a different file format to PDF.

Depending on the scenario, you can take advantage of the different features each library provides. This article describes the most common approaches for creating a PDF document and how to achieve the desired goal using **Telerik Document Processing**.

* [Create a PDF document from scratch](https://www.telerik.com/document-processing-libraries/documentation/getting-started/installation/pdf-export#create-a-pdf-document-from-scratch)

* [Convert a document to PDF](https://www.telerik.com/document-processing-libraries/documentation/getting-started/installation/pdf-export#convert-a-document-to-pdf)

* [Convert a spreadsheet document to PDF](https://www.telerik.com/document-processing-libraries/documentation/getting-started/installation/pdf-export#convert-a-spreadsheet-document-to-pdf)

> important The **.NET Standard** specification does not define APIs for getting specific fonts. `PdfFormatProvider` needs to have access to the font data so that it can read it and add it to the PDF file. That is why, to allow the library to create and use fonts, you must provide an implementation of the `FontsProviderBase` abstract class and set this implementation to the `FontsProvider` property of `FixedExtensibilityManager`. For detailed information, check the [cross-platform font and PDF support requirements](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/cross-platform/overview).

## Create a PDF Document From Scratch

Use RadPdfProcessing to create a PDF document from scratch.

### Required packages

* **.NET Framework**, **.NET 8, .NET 9 and .NET 10** (or newer) for Windows
  * Telerik.Windows.Documents.Fixed

* **.NET Standard 2.0 (.NET 8, .NET 9 and .NET 10)**
  * Telerik.Documents.Fixed

**RadPdfProcessing** is intended to work with fixed documents and provides a convenient API to create, modify, and export PDF documents.

You can import and export a document through the respective methods of the `PdfFormatProvider` class.

> The `PdfFormatProvider` class of RadPdfProcessing resides in the `Telerik.Windows.Documents.Fixed.FormatProviders.Pdf` namespace. For more information on how to work with this provider, read the [RadPdfProcessing PdfFormatProvider reference](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfformatprovider/pdfformatprovider).

## Convert a Document to PDF

In scenarios where you need to convert a document from another file format to PDF, you can take advantage of the capabilities of **RadWordsProcessing**. This library allows you to import documents from the most common rich text formats (DOCX, HTML, RTF) and plain text and export them to PDF. All the supported document formats and the corresponding format providers are listed in the [RadWordsProcessing format providers and conversion options](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/formats-and-conversion/formats-and-conversion).

> The `PdfFormatProvider` class of RadWordsProcessing resides in the `Telerik.Windows.Documents.Flow.FormatProviders.Pdf` namespace. For more information on how to work with this provider, read the [RadWordsProcessing PdfFormatProvider reference](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/formats-and-conversion/pdf/pdfformatprovider).

### Convert HTML to PDF

Use the following packages and example to convert HTML content to PDF.

**Required packages:**

* **.NET Framework**, **.NET 8, .NET 9 and .NET 10** (or newer) for Windows
  * Telerik.Windows.Documents.Flow\.FormatProviders.Pdf

* **.NET Standard 2.0 (.NET 8, .NET 9 and .NET 10)**
  * Telerik.Documents.Flow\.FormatProviders.Pdf

**Example 1** demonstrates how you can convert an HTML string to a PDF document. The [HtmlFormatProvider](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/formats-and-conversion/html/htmlformatprovider) and [PdfFormatProvider](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/formats-and-conversion/pdf/pdfformatprovider) classes of [RadWordsProcessing](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/overview) are used to import/export the [RadFlowDocument](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/model/radflowdocument) instance.

**Example 1: Convert an HTML string to a PDF document**

```csharp

	string htmlContent = "<!DOCTYPE html><html><body><p>Hello, world!</p></body></html>";
	
    Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider htmlProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider();
	// Create a document instance from the content.
    RadFlowDocument document = htmlProvider.Import(htmlContent, TimeSpan.FromSeconds(10));

    Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider pdfProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();

	// Export the document. The different overloads enables you to export to a byte[] or to a Stream.
    byte[] pdfBytes = pdfProvider.Export(document, TimeSpan.FromSeconds(10));
```

## Convert a Spreadsheet Document to PDF

Use RadSpreadProcessing to convert a spreadsheet document to PDF.

### Required packages

* **.NET Framework**, **.NET 8, .NET 9 and .NET 10** (or newer) for Windows
  * Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf

* **.NET Standard 2.0 (.NET 8, .NET 9 and .NET 10)**
  * Telerik.Documents.Spreadsheet.FormatProviders.Pdf

While the previously discussed libraries allow working with text documents, with RadSpreadProcessing you can create, import, and export tabular data. This library supports the most common file formats for storing spreadsheet documents - XLSX, CSV. All format providers are listed and described in the corresponding [RadSpreadProcessing spreadsheet format providers](https://www.telerik.com/document-processing-libraries/documentation/libraries/radspreadprocessing/formats-and-conversion/pdf/pdfformatprovider).

> The `PdfFormatProvider` class of RadSpreadProcessing resides in the `Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf` namespace. For more information on how to work with this provider, read the [RadSpreadProcessing PdfFormatProvider reference](https://www.telerik.com/document-processing-libraries/documentation/libraries/radspreadprocessing/formats-and-conversion/pdf/pdfformatprovider).

## See Also

* [Get started with Telerik Document Processing libraries](https://www.telerik.com/document-processing-libraries/documentation/getting-started/getting-started)
* [Create and export fixed-layout PDFs with RadPdfProcessing](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/overview)
* [Convert text documents with RadWordsProcessing](https://www.telerik.com/document-processing-libraries/documentation/libraries/radwordsprocessing/overview)
* [Process spreadsheets with RadSpreadProcessing](https://www.telerik.com/document-processing-libraries/documentation/libraries/radspreadprocessing/overview)
