Can you explain where is filePath in your code?
byte[] bytes = File.ReadAllBytes(Server.MapPath(filePath));
protected void Save(object sender, EventArgs e)
{
using (FileStream stream = new FileStream(Server.MapPath("~/Files/") + "ImageExport.pdf", FileMode.Create))
{
String[] texts = { chkAgree.Text };
string filePath = "~/Files/" + Path.GetFileName("E-Sign.png");
byte[] bytes = File.ReadAllBytes(Server.MapPath(filePath));
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 10f);
PdfWriter writer = PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
PdfWriter.GetInstance(pdfDoc, stream);
pdfDoc.Open();
string FONT = "c:/windows/fonts/WINGDING.TTF";
string checkBox = "\u00fe";
string uncheckBox = "o";
BaseFont bf = BaseFont.CreateFont(FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
iTextSharp.text.Font f = new iTextSharp.text.Font(bf, 12);
Paragraph ptrue = new Paragraph(checkBox, f);
Paragraph pfalse = new Paragraph(uncheckBox, f);
if (chkAgree.Checked)
{
pdfDoc.Add(ptrue);
}
else
{
pdfDoc.Add(pfalse);
}
pdfDoc.Add(new Paragraph(chkAgree.Text));
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(bytes);
pdfDoc.Add(img);
iTextSharp.text.html.simpleparser.HTMLWorker hw = new iTextSharp.text.html.simpleparser.HTMLWorker(pdfDoc);
hw.Parse(new StringReader(pnlDetails.InnerText));
pdfDoc.Close();
stream.Close();
}
}