Note that there are some explanatory texts on larger screens.

plurals
  1. POError in saving CKEDITOR content
    text
    copied!<p>In my application am allowing the user to create PDF file. Have used CKEDITOR in my application.</p> <pre><code>function create_PDF(box) { var filename = $("#filename").val(); if (filename == "") { alert("Enter filename"); return false; } var content = CKEDITOR.instances["message"].getData(); if (content == "") { alert("Enter Content in The Editor"); return false; } content = content.trim(); dhtmlx.modalbox.hide(box); dhtmlx.message("Saving file..."); $.post("/FileUpload/CreateNewPDFile", { filename: '' + filename + '', content: '' + content + '' }, function (data) { alert("PDF File created succesfully"); CKEDITOR.instances["message"].setData(""); }); } </code></pre> <p>CreateNewPDFFile controller code is:</p> <pre><code> public ActionResult CreateNewPDFile(FormCollection data) { var filename = data["filename"]; var htmlContent = data["content"]; string sFilePath = Server.MapPath(_createdPDF + filename + ".pdf"); htmlContent = htmlContent.Trim(); if (!System.IO.File.Exists(sFilePath)) { Document doc = new Document(PageSize.A4, 10, 10, 10, 10); doc.SetMargins(50, 50, 50, 50); doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height)); PdfWriter.GetInstance(doc, new System.IO.FileStream(sFilePath, System.IO.FileMode.Create)); iTextSharp.text.Font fnt = FontFactory.GetFont("Times New Roman", 14); doc.Open(); PdfPTable pdfTab = new PdfPTable(1); PdfPCell pdfCell = null; pdfCell = new PdfPCell(new Phrase(new Chunk(htmlContent))); pdfTab.AddCell(pdfCell); doc.Add(pdfTab); doc.Close(); Response.ContentType = "application/pdf"; System.Web.HttpContext.Current.Response.Write(doc); Response.Flush(); Response.End(); } return View(); } </code></pre> <p>PDF file gets created successfully but the displays HTML content in it for example: If i have inserted radio buttons in the file than in newly created file it displays </p> <pre><code>&lt;input name="age" type="radio" </code></pre> <p>value="15-20" /> </p> <p>and not the radio buttons. How can I avoid html content ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload