PDF Form using itextsharp RRS feed

  • Question

  • User1902608566 posted

    I have converted a pdf document to interactive using Adobe Acrobat.In that pdf i have placed a TextField control.

    the maximum length of that textfield control is 25.Now i am accessing that pdf in c# code using itextsharp library.

    Every thing works fine,except i cant get the max length value which i set to that textfield. I just want it to validate the length of that.


    * please provide me a solution.Its very urgent.I am running out of time




    Tuesday, May 10, 2011 4:58 AM


  • User1902608566 posted

    Finally i got the answer...

    PdfReader pdfReader = new PdfReader(@"c:\sample.pdf");

    AcroFields.Item fldItem;

    int maxlen;

    foreach (KeyValuePair<string, AcroFields.Item> de in pdfReader.AcroFields.Fields)


    fldItem = pdfFormFields.GetFieldItem(de.Key.ToString());

    maxlen =fldItem.GetMerged(0).GetAsNumber(PdfName.MAXLEN).IntValue;


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 11, 2011 12:15 AM