This is a migrated thread and some comments may be shown as answers.

RadFlowDocument to PDF error?

1 Answer 742 Views
WordsProcessing
This is a migrated thread and some comments may be shown as answers.
Phát
Top achievements
Rank 1
Phát asked on 14 Sep 2017, 11:07 AM

Dear Telerik,

Currently I'm trying to export docx to pdf but got some errors.

Here is my export code:

            PdfFormatProvider pdfer = new PdfFormatProvider();

            using (Stream input = File.OpenRead("E:\\hd.docx"))
            {
                RadFlowDocument document = provider.Import(input);
                pdfer.Export(document, new FileStream(@"E:\hd.pdf", FileMode.Create));
            }

And I got this error: "cant convert RadFlowDocument to RadFixedDocument", also when I'm using RadDocument and IDocumentFormatProvider to export like some threads, visual studio couldn't found these class, interface.

My references at attachment file, please look at it.

Thank you very much for your help!

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 14 Sep 2017, 03:07 PM
Hello Phát,

I just answered in the support thread you submitted but will paste the reply here as well in case anyone else encounters it.

"The components have their own format providers which can read a document and parse it to the model of the concrete component. The errors you are getting most probably are related to using the format from the wrong namespace.

To use the PdfFormatProvider for RadWordsProcessing, you will need to add a using statement to the Telerik.Windows.Documents.Flow.FormatProviders.Pdf namespace. This provider enables you to export a RadFlowDocument instance to PDF.

The RadDocument class is the base class of RadRichTextBox for WPF/SL and since the ticket is submitted for UI for ASP.NET MVC, I assume you are not using this control. However, in case you need it, you can find information on how to use its format providers in the Import/Export section of the documentation."


Regards,
Tanya
Progress Telerik

Tags
WordsProcessing
Asked by
Phát
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or