Hey guys I’m implementing a page that has about 9 separate divs on it that I want each to be separately editable using ckeditor. The page is being dynamically generated through php with codeigniter but I want a user to be able to make changes to the HTML before finalizing it. I have currently implemented ckeditor to edit divs as demonstrated here: http://nightly.ckeditor.com/7614/_samples/divreplace.html
However after the user is done I want to be able to save the HTML on my server since I will be converting the page to a PDF using wkhtmltopdf. As you can see on the example once you click any of the divs it opens a new editor. I need a way to submit the changes when the user is done editing the page and because I am trying to pdf the resulting HTML i cannot include a button or similar element. I am also worried that since in this example you can’t hide all the editors you can only open a new one that the PDF will show the ckeditor box. I was thinking that I could just grab the document on a javascript event and send it via ajax request to a php function that would save it to a file and then PDF the file but I am unsure how to trigger the html submit event or replace the remaining edit box. Any suggestions?
You can simply wrap the content you’d like to convert to PDF into a div, and serialize it into a hidden field when the form is submitted:
jQuery code:
Voilà!