Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to save images/shapes in PDF file
    primarykey
    data
    text
    <p>In my application am allowing the user to create PDF file. Also the user can add shapes(like rectangle, line),, form fields (textarea, checkbox..) in the PDF file. when user clicks on save button PDF gets created successfully but the shapes and form fields that user has included in his document doesn't appear.</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(""); CKEDITOR.instances["editor1"].setData(""); }); } [AcceptVerbs(HttpVerbs.Post)] [ValidateInput(false)] public ActionResult CreateNewPDFile(FormCollection data) { var filename = data["filename"]; var htmlContent = data["content"]; string sFilePath = Server.MapPath(_createdPDF + filename + ".pdf"); htmlContent = htmlContent.Trim(); htmlContent = htmlContent.Replace("&lt;p&gt;", "\n").Replace("&lt;/p&gt;", "\n"); Regex reg = new Regex("&lt;[^&gt;]+&gt;", RegexOptions.IgnoreCase); 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>If use includes textarea , rectangle and checkmark in the newly created PDF instead of textarea, rectangle and checkmark the following thing appears how can i avoid this code and can display on the respective images in the document</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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