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

RadEditor exportToPdf nullReferenceException

1 Answer 70 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Corentin
Top achievements
Rank 1
Corentin asked on 28 Oct 2015, 03:44 PM

Hi, every body,

 

Today I try to export pdf from one RadEditor ... but the function throw an nullReferenceException.

Here is my code :

 

RadEditor radEditor = new RadEditor();
radEditor.Content = "<div>Hello</div>";
radEditor.ExportSettings.FileName = "TextFile.pdf";
radEditor.ExportSettings.OpenInNewWindow = true;
radEditor.ExportToPdf();
 

Did I miss something ?

Thanks,

Corentin

RadEditor radEditor = new RadEditor();
radEditor.Content = "<div>Hello</div>";
radEditor.ExportSettings.FileName = "TextFile.pdf";
radEditor.ExportSettings.OpenInNewWindow = true;
radEditor.ExportToPdf();
RadEditor radEditor = new RadEditor();
radEditor.Content = "<div>Hello</div>";
radEditor.ExportSettings.FileName = "TextFile.pdf";
radEditor.ExportSettings.OpenInNewWindow = true;
radEditor.ExportToPdf();

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 29 Oct 2015, 11:11 AM
Hi Corentin,

RadEditor is not designed to be used as a framework or API to export to PDF. You need an actual RadEditor rendered on a page for the exporting to work. 

What you can use for this case is RadWordsProcessing to convert HTML to RadFlowDocument and next to use a PdfFormatProvider class to export the document to PDF file.

Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Editor
Asked by
Corentin
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or