First Steps
This article explains how to get started with one of the Telerik Document Processing Libraries quickly. As the libraries are UI-Independent and cover all .NET technologies, from desktop and web to mobile, and can also be deployed in client, server-side and cloud apps you need to consider the suite with which you've obtained the product.
Once you have first example up and running, take a look at the next steps section to start exploring the rest of the functionality in more details.
For additional resources you can also review the Related Articles section on the right.
You can download the packages that contain Telerik Document Processing from your Telerik account.
Step 1: Installing on Your Computer
Telerik Document Processing is part of several Telerik bundles and is installed following the steps for installing the suite with which you've obtained the product.
UI for ASP.NET AJAX - Installing Telerik UI for ASP.NET AJAX. When the installation completes, the Telerik Document Processing assemblies will be available in the AdditionalLibraries sub-folder.
UI for ASP.NET MVC - Installing Telerik UI for ASP.NET MVC. When the installation completes, the Telerik Document Processing assemblies will be available in the AdditionalLibraries sub-folder.
UI for ASP.NET Core - Installing Telerik UI for ASP.NET Core. The libraries can be used through the available NuGet packages.
UI for Blazor - Installing Telerik UI for Blazor. The libraries can be used through the available NuGet packages.
UI for WPF - Installing Telerik UI for WPF
UI for Silverlight - Installing Telerik UI for Silverlight
UI for WinForms - Installing Telerik UI for WinForms
UI for Xamarin - Installing Telerik UI for Xamarin
UI for WinUI - Installing Telerik UI for WinUI
Step 2: Creating Application with Visual Studio
As we are going to review a UI-Independent example we will use a console project.
- Open Microsoft Visual Studio and create a new console project
Figure 1: Go to File > New > Project > Console App (.Net Framework) > Next > Create
Step 3: Add a Telerik Document Processing Library to a Project
For this example we will go through the creation of a sample application that uses RadWordsProcessing.
Assembly References
Here is a list of assemblies that contain the RadWordsProcessing functionality and need to be referenced in your project:
- Telerik.Windows.Documents.Core.dll
- Telerik.Windows.Documents.Flow.dll
- Telerik.Windows.Zip.dll
Since we are going to export to a Docx and PDF file later in this example, we will also need to reference the below assemblies:
- Telerik.Windows.Documents.Flow.FormatProviders.Docx.dll
- Telerik.Windows.Documents.Flow.FormatProviders.Pdf.dll
Please note that for .NET Core, the references don't contain "Windows" in the assembly names.
Step 4: Create a Document
Example 1: Create RadFlowDocument
Telerik.Windows.Documents.Flow.Model.RadFlowDocument document = new Telerik.Windows.Documents.Flow.Model.RadFlowDocument();
Telerik.Windows.Documents.Flow.Model.Editing.RadFlowDocumentEditor editor = new Telerik.Windows.Documents.Flow.Model.Editing.RadFlowDocumentEditor(document);
editor.InsertText("Hello world!");
Dim document As Telerik.Windows.Documents.Flow.Model.RadFlowDocument = New Telerik.Windows.Documents.Flow.Model.RadFlowDocument()
Dim editor As Telerik.Windows.Documents.Flow.Model.Editing.RadFlowDocumentEditor = New Telerik.Windows.Documents.Flow.Model.Editing.RadFlowDocumentEditor(document)
editor.InsertText("Hello world!")
Step 5: Export the Generated Document
Exporting RadFlowDocument to DOCX
Exporting the document to docx file can be achieved with the DocxFormatProvider. Using the below code will create a provider instance and save a document with it. The document will be exported in the bin folder of your current project.
Example 2: Export RadFlowDocument to DOCX
using (Stream output = new FileStream("output.docx", FileMode.OpenOrCreate))
{
Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
provider.Export(document, output);
}
Using output As Stream = New FileStream("output.docx", FileMode.OpenOrCreate)
Dim provider As Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider = New Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider()
provider.Export(document, output)
End Using
Exporting RadFlowDocument to PDF
If you want to export the same document to a PDF format you will need to use PdfFormatProvider. Example 3 shows how to export the RadFlowDocument created in Examples 1 to a file.
Example 3: Export RadFlowDocument to PDF
using (Stream output = File.OpenWrite("Output.pdf"))
{
Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider providerPDF = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
providerPDF.Export(document, output);
}
Using output As Stream = File.OpenWrite("Output.pdf")
Dim providerPDF As Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider = New Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider()
providerPDF.Export(document, output)
End Using
Run the project and you should see something like this:
Figure 2: The final result
Next Steps
Now that you have run your first project example with Telerik Document Processing Libraries, you may want to explore some additional features like clone, edit, merge, insert documents and more. Below you can find guidance on getting started with such tasks: