Edited content save as PDF when I click a Button

  •  10-12-2015, 1:41 AM

    Edited content save as PDF when I click a Button

    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

    1. public ActionResult Index()  
    2. {              
    3.   
    4.     Editor Editor1 = new Editor(System.Web.HttpContext.Current, "Editor1");              
    5.   
    6.     Editor1.LoadHtml("~/brochuretemplates/myhtml.html");  
    7.   
    8.     Editor1.MvcInit();  
    9.   
    10.     ViewBag.Editor = Editor1.MvcGetString();  
    11.   
    12.     return View();  
    13. }
    Now I want to save that newly edited content  as a PDF , but for that I should call following syntax inside 

    above controller method  .  

    1. Editor1.SavePDF("~/doc/mtPDF.pdf");  

     So with the changes code snippet will be like this 

     

     

    1. public ActionResult Index()   { 
    2.                      
    3. Editor Editor1 = new Editor(System.Web.HttpContext.Current, "Editor1"); 
    4.                      
    5. Editor1.LoadHtml("~/brochuretemplates/myhtml.html"); 
    6.          
    7. Editor1.MvcInit();          
    8.  
    9. ViewBag.Editor = Editor1.MvcGetString(); 
    10.  
    11. Editor1.SavePDF("~/doc/mtPDF.pdf");   
    12.          
    13. return View();  
    14.  
    15. }    

     

    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,

     

     

    Filed under:
View Complete Thread