Hi,
I have pdf form in which i am filling values using iTextSharp. I wanted to add some more text boxed in the same pdf form. I have written code for that but text boxes are not visible on pdf. If i open pdf with Notepad++ then i can see the text field name and values. that means text boxes are there on pdf but it is not visible.
So could some please help me how do i make text field visible on pdf form?
What I have tried:
try
{
iTextSharp.text.pdf.PdfReader reader = new iTextSharp.text.pdf.PdfReader(SrcFile);
PdfStamper stamper = new PdfStamper(reader, new FileStream(DestFile, FileMode.Append));
TextField textname = new TextField(stamper.Writer, new Rectangle(36, 700, 136, 680), "TxtName");
textname.Text = "softwareid1";
textname.TextColor = new BaseColor(255, 0, 0);
textname.BackgroundColor = BaseColor.LIGHT_GRAY;
TextField textmail = new TextField(stamper.Writer, new Rectangle(36, 660, 136, 640), "TxtMail");
textmail.Text = "SoftwareId2";
textmail.Options = TextField.MULTILINE;
textmail.TextColor = new BaseColor(255, 0, 0);
textmail.BackgroundColor = BaseColor.LIGHT_GRAY;
stamper.AddAnnotation(textname.GetTextField(), 1);
stamper.AddAnnotation(textmail.GetTextField(), 1);
stamper.AcroFields.GenerateAppearances = true;
stamper.Close();
}
catch (Exception ex)
{ }