I'm loading .HTML file to richtext editor content that contains inside the project.
Once HTML file loaded, I can do changes of that content.
this is the initial view of that
this is the changed view of that rich text editor content
this is controller action to load rich text editor
- public ActionResult Index()
- {
-
- Editor Editor1 = new Editor(System.Web.HttpContext.Current, "Editor1");
-
- Editor1.LoadHtml("~/brochuretemplates/myhtml.html");
-
- Editor1.MvcInit();
-
- ViewBag.Editor = Editor1.MvcGetString();
-
- return View();
- }
Now I want to save that newly edited content as a PDF , but for that I should call following syntax inside
above controller method .
- Editor1.SavePDF("~/doc/mtPDF.pdf");
So with the changes code snippet will be like this
- public ActionResult Index() {
-
- Editor Editor1 = new Editor(System.Web.HttpContext.Current, "Editor1");
-
- Editor1.LoadHtml("~/brochuretemplates/myhtml.html");
-
- Editor1.MvcInit();
-
- ViewBag.Editor = Editor1.MvcGetString();
-
- Editor1.SavePDF("~/doc/mtPDF.pdf");
-
- return View();
-
- }
that mens once its loading its saving as PDF
But I want to save as PDF when I click a Button How can I ivoke that savePDF method outside the loading action
Like above view ,
Once I click Save as PDF button , I want to retrieve the current content of this rich text editor and then pass those data-set to SavePDF method,