Why below code is not working. I am try to convert html to pdf. "radEditor.ExportToPdf()" line of code given error "Object reference not set to an instance of an object at Telerik.Web.UI.Editor.Export.RadEditorExportTemplate.Export()"
static void Main(string[] args)
{
RadEditor radEditor = new RadEditor();
radEditor.Content = "<div>Hello</div>";
radEditor.ExportContent += radEditor_ExportContent;
radEditor.ExportToPdf();
}
static void radEditor_ExportContent(object sender, EditorExportingArgs e)
{
string path = "C:/tmp/NewFile.pdf";
if (File.Exists(path))
{
File.Delete(path);
}
using (FileStream fs = File.Create(path))
{
Byte[] info = System.Text.Encoding.Default.GetBytes(e.ExportOutput);
fs.Write(info, 0, info.Length);
}
}
static void Main(string[] args)
{
RadEditor radEditor = new RadEditor();
radEditor.Content = "<div>Hello</div>";
radEditor.ExportContent += radEditor_ExportContent;
radEditor.ExportToPdf();
}
static void radEditor_ExportContent(object sender, EditorExportingArgs e)
{
string path = "C:/tmp/NewFile.pdf";
if (File.Exists(path))
{
File.Delete(path);
}
using (FileStream fs = File.Create(path))
{
Byte[] info = System.Text.Encoding.Default.GetBytes(e.ExportOutput);
fs.Write(info, 0, info.Length);
}
}