Hi all,
My company has historically used an ActiveX control to produce certain documents, created as PDFs, for printing or sending via email. With the move to a new development environment we lost support for ActiveX and need to switch to the Telerik document controls.
We wrote a program using the following Telerik objects:
Telerik.Windows.Documents.Fixed.Model.RadFixedDocument.
Telerik.Windows.Documents.Fixed.Model.RadFixedPage.
Telerik.Windows.Documents.Fixed.Model.Editing.FixedContentEditor.
This works fine for most of the document creation, but we have a need to add language specific to each of our customers to the document. This language comes from each customer in an RTF file. The old control had a method to add the RTF file to the document flow, and it used the RTF metadata to add the properly formatted text to the document. Can you tell me if the Telerik document model has the ability to do this? And what objects/methods would be best to use? If it doesn't support RTF specifically, but has this ability for other formats, I can convert the RTF file to PDF, DOCX, etc. Thanks.
8 Answers, 1 is accepted
Hi Darrell,
You can import an RTF document into a RadFlowDocument model using the RtfFormatProvider of the WordsProcessing library. More information and examples you can find in the Using RtfFormatProvider help article.
I hope this helps. Do not hesitate to contact us if any additional questions arise.
Regards,
Martin
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Hello Darrell,
Take your time for testing and if you have any difficulties, please let us know.
Regards,
Martin
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Our existing program was written using the RadFixedDocument object. I think that was because the ultimate goal was to produce a PDF, as I see that RadFixedDocument is part of RadPDFProcessing library. Using your suggestion of the RadFlowDocument, would I have to change all of the existing code to use that as well? Sorry, I am not at all familiar with these libraries.
If that's the case, is there a way to import a different type of file into the RadFixedDocument flow? As mentioned, I can convert the RTF file to a PDF, DOCX, etc. I really don't want to have to rewrite the program to use a different library if I don't have to.
Hi Darrell,
You can use at the same time both RadFIxedDocument and RadFlowDocument and you don't need to change all the existing code. You will only need to extend it with the import of the RTF file into a RadFlowDocument and then export it to RadFixedDocument logic.
As a side note, the RadFlowDocument model provides you with the opportunity to import the following formats into a RadFlowDocument which later can be easily exported to RadFixedDocument (or PDF file):
- import/export from/to DOCX using DocxFormatProvider
- import/export from/to RTF using RtfFormatProvider
- import/export from/to HTML using HtmlFormatProvider
- import/export from/to Plain text using TxtFormatProvider
- only export to PDF using PdfFormatProvider
However, if you decide not to use the RadFlowDocument model in your code, you can convert the documents to PDF files and then import them with the PdfProcessing`s PdfFormatProvider directly into a RadFixedDocument.
Regards,
Martin
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.


Hi Martin,
I noticed in the two links that you referenced on importing and exporting that the export link takes you to the documentation on the PdfFormatProvider. Since we're working with RTF files, is that what you intended?
I tried to find a similar method to PdfFormatProvider.ExportToFixedDocument in the RTF library, but couldn't.
Hi Darrell,
I order to export a convert an RTF file to a RadFixedDocument you will need to:
- use the WordsProcessing`s RtfFormatProvider to import the RTF into a RadFlowDocument.
RadFlowDocument document; RtfFormatProvider rtfFormatProvider = new RtfFormatProvider(); using (Stream input = File.OpenRead("SampleDocument.rtf")) { document = rtfFormatProvider.Import(input); }
- use the WordsProcessing`s PdfFormatProvider to export this RadFlowDocument to a RadFixedDocument.
Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider pdfFormatProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider(); RadFixedDocument fixedDocument = pdfFormatProvider.ExportToFixedDocument(document);
I am attaching a sample project demonstrating this functionality as well.
As a side note, I want to clarify there are two different PdfFormatProviders:
- The first one is from the WordsProcessing library and it allows you to export a RadFlowDocument to RadFixedDocument or directly to a PDF file.
- The second one is part of the PdfProcessings library and it allows you to import a PDF file into a RadFixedDocument and vise versa.
Regards,
Martin
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.