3

I am using ASP.NET and C#.Then I am using iTextSharp for creating pdf on the fly.Can someone tell me how to create the textbox,label.Is it Possible? Because What ever i searched they are using PdfpTable and PdfpCell..

Give me some example..

EDIT: I need to create a pdf that should look exacly like my .aspx page.I am creating on button click.If i add textfield that is in edit mode i dont want that.So i need to create the entire page as readonly in pdf?

Provide me any materials/articles/ebooks..

Thanks..

Giri
  • 931
  • 11
  • 31
  • 51

1 Answers1

11

Try using this piece of code snippet:

using (PdfStamper stamper = new PdfStamper(new PdfReader(inputFile), File.Create(outputFile)))
{
    TextField tf = new TextField(stamper.Writer, new iTextSharp.text.Rectangle(0, 0, 100, 300), "Vertical");
    stamper.AddAnnotation(tf.GetTextField(), 1);
    stamper.Close();
}

Reference: iTextSharp - Adding a vertical textbox

You should also take a look at iText in Action. Chapter 8 has some examples that might be useful for you.

Community
  • 1
  • 1
Furqan Safdar
  • 16,260
  • 13
  • 59
  • 93