0

I would like to programatically remove the "scroll long text" field from a form field in a PDF prior to stamping that field. I would like to do so anytime a field has this setting enabled for a given form field. I had a similar problem recently and had resolved this using the solution I posted at the bottom of this post: ITextSharp: Remove character Limit from a form field

I think I should be able to do this in the same area but I'm not sure which PdfName setting I need to be looking for to detect (and remove) this setting.

Thanks in advance!

Community
  • 1
  • 1
Ben
  • 2,058
  • 9
  • 29
  • 39

1 Answers1

1

Per the PDF spec, section 12.7.4.3, Interactive Features -> Interactive Forms -> Field Types -> Text Fields you want to set the field flag (Ff) value. This value is a bitwise flag with position 24 being the "DoNotScroll" flag. Position 24 would be binary 1000 0000 0000 0000 0000 0000 or hex 0x800000. Using this and the code from the other post you can add this and it should do what you're looking for:

if (AnnotationDictionary.Contains(PdfName.FF)) {
    int Ff = AnnotationDictionary.GetAsNumber(PdfName.FF).IntValue;
    int doNotScrollBit = 0x800000;
    Ff = doNotScrollBit | Ff;
    AnnotationDictionary.Put(PdfName.FF, new PdfNumber(Ff));
}
Chris Haas
  • 53,986
  • 12
  • 141
  • 274