Last post Jun 14, 2019 07:28 AM by AddWeb Solution
Jun 12, 2019 12:20 PM|sweetSteal|LINK
I am trying to create a file in iframe but having a problem.
Jun 13, 2019 08:38 AM|samwu|LINK
I tried running your code, found some problems and modified it.
If you want to create a pdf file, you first use the Document.open() method to open a document to be written, then create a Write instance for the Document.
The iframe src should be a relative path, not an absolute path,because you can't directly access the files in the c: drive in WebApplicaiton.
protected void Page_Load(object sender, EventArgs e)
string strip = "name";
string Path = Server.MapPath("~/HOD");
//if file exist delete
if (File.Exists(Path + "/" + strip + ".pdf"))
File.Delete(Path + "/" + strip + ".pdf");
FileStream fs = new FileStream(Path + "/" + strip + ".pdf", FileMode.Create, FileAccess.Write, FileShare.None);
Rectangle rec2 = new Rectangle(PageSize.A4);
Document doc = new Document(rec2, 10, 10, 10, 10);
PdfWriter writer = PdfWriter.GetInstance(doc, fs);
doc.Add(new Paragraph("What is your view of the type of support and feedback you received from your Supervisor/Head of Section/Head of Department (with respect to the motivation, guidance and coaching provided during the assessment period)? ", FontFactory.GetFont("Arial", 8, Font.BOLD)));
Response.Write("File could not be created. Please contact administrator");
string pa = Path + "\\" + strip + ".pdf";
string path = ResolveClientUrl(pa);
//load file in frame
Iframe1.Attributes["src"] = "/HOD/name.pdf";
Jun 14, 2019 07:28 AM|AddWeb Solution|LINK
<asp:Panel ID="Panel1" runat="server">
<iframe src="UploadFiles/RR Form_MP, BCA(P)_MCA_1501.pdf" width="400px" height="300px" />
Use '@' at the start of your Path,and after that give your whole path;
myframe.Attributes["src"] = @"Folder:\20120517110052.pdf";