I'm loading .html file into RTE editor , then Once I click Save as PDF button its saving as PDF
this is view of RTE editor content
Once I click save as PDF and open it throuch adobe pdf reader , I'm getting this kind PDF
its a unformatted structure with missing sections , what can I do to get exact view that existing in RTE editor content
this is controller related method
- [HttpGet]
- [ValidateInput(false)]
-
- public ActionResult output_xhtml()
- {
- PrepairEditor(delegate (Editor editor)
- {
- editor.LoadHtml("~/brochuretemplates/myhtml.html");
- });
- return View();
- }
-
- [HttpPost]
- [ValidateInput(false)]
- public ActionResult output_xhtml(string m)
- {
- Editor theeditor = PrepairEditor(delegate (Editor editor)
- {
-
- });
-
- theeditor.SavePDF("~/brochuretemplates/anemeh.pdf");
-
- return View();
- }
- [HttpGet]
- [ValidateInput(false)]
-
- public ActionResult output_xhtml()
- {
- PrepairEditor(delegate (Editor editor)
- {
- editor.LoadHtml("~/brochuretemplates/myhtml.html");
- });
- return View();
- }
-
- [HttpPost]
- [ValidateInput(false)]
- public ActionResult output_xhtml(string m)
- {
- Editor theeditor = PrepairEditor(delegate (Editor editor)
- {
-
- });
-
- theeditor.SavePDF("~/brochuretemplates/anemeh.pdf");
-
- return View();
- }
-
- [ValidateInput(false)]
- protected Editor PrepairEditor(Action<Editor> oninit)
- {
- Editor editor = new Editor(System.Web.HttpContext.Current, "editor");
-
- editor.ClientFolder = "~/richtexteditor/";
- editor.ContentCss = "~/Content/example.css";
-
-
-
- editor.Text = "Type here";
-
- editor.AjaxPostbackUrl = Url.Action("EditorAjaxHandler");
-
- if (oninit != null) oninit(editor);
-
-
- bool isajax = editor.MvcInit();
-
- if (isajax)
- return editor;
-
-
- if (this.Request.HttpMethod == "POST")
- {
- string formdata = this.Request.Form[editor.Name];
- if (formdata != null)
- editor.LoadFormData(formdata);
- }
-
-
- ViewBag.Editor = editor.MvcGetString();
-
- return editor;
- }
output_xhtml.cshtml view page
- @{
- ViewBag.Title = "Create Brochure";
-
- }
-
-
- <!DOCTYPE html>
- <html>
- <head>
- <title>RichTextEditor - Output XHTML</title>
- </head>
- <body>
-
- @using (Html.BeginForm())
- {
-
- <div>
- @Html.Raw(ViewBag.Editor)
- <br />
- <button id="btn_sumbit" type="submit" class="btn btn-danger submit">Save as PDF</button>
- </div>
-
-
- }
- </body>
- </html>
-
- @section Scripts {
- @Scripts.Render("~/bundles/jqueryval")
- @Scripts.Render("~/bundles/jqueryui")
-
- <script type="text/javascript">
-
- var editor;
-
- function RichTextEditor_OnLoad(editor) {
- editoreditor = editor;
- var content = true;
- if (!content) {
- setTimeout(function () {
- editor.SetText("<table>...</table>");
- }, 1000);
- return;
- }
- }
-
- </script>
-
-
- <script type='text/javascript'>
-
- function RichTextEditor_OnLoad(editor) {
- editor.SetWidth(1150); //Sets the width.
- editor.SetHeight(612); //Sets the height.
- }
-
- </script>
-
- }
myhtml.html : this is RTE editor content loading html file
-
-
- <!DOCTYPE html>
- <html>
- <head>
- </head>
- <body>
- <div id="header" style="font-family:'Segoe UI';background-color: black;color: white;text-align: center;padding: 5px;">
- <h1 style="font-family:'Segoe UI';color: white;text-align: center;">Bank Brochure</h1>
- </div>
-
- <div id="nav" style="font-family:'Segoe UI';line-height: 30px;background-color: #eeeeee;height: 300px;width: 100px;float: left;padding: 5px;">
- London<br>
- Paris<br>
- Tokyo<br>
- </div>
-
- <div id="section" style="font-family:'Segoe UI';float: left;padding: 10px;color:black">
- <h2>London</h2>
- <p>
- London is the capital city of England. It is the most populous city in the United Kingdom,
- with a metropolitan area of over 13 million inhabitants.
- </p>
- <p>
- Standing on the River Thames, London has been a major settlement for two millennia,
- its history going back to its founding by the Romans, who named it Londinium.
- </p>
- </div>
-
- <div id="footer" style="font-family:'Segoe UI';background-color: black;color: white;clear: both;text-align: center;padding: 5px;">
- Copyright © 2015 Zoo Group , Solution by kelum.
- </div>
-
-
- </body>
- </html>