You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Akshay Rawat <pr...@akshay.cc> on 2013/11/19 09:56:36 UTC

PDFBox: How to detect the max length of a PDTextBox

I'm working with an AcroForm which has a text field (PDTextBox) with a max length. How do I use PDFBox to detect the max length of this field.

Thanks for any help.

Re: PDFBox: How to detect the max length of a PDTextBox

Posted by Akshay Rawat <pr...@akshay.cc>.
Thank you. Now I know how this works.


Akshay Rawat  |  Mobile/Whatsapp: +91 9538780000  |  Skype: akshayrawat

On 19 November 2013 at 4:39:53 PM, Gilad Denneboom (gilad.denneboom@gmail.com) wrote:

When a property is not directly accessible through the object's getters, it  
can usually still be found by going to the "guts" of the object and  
checking the COS Dictionary associated with it. A quick research revealed  
that this property is found by accessing the "MaxLen" property (which maybe  
should be added as one of the constants of the COSName object).  
So you can use it like so (field1 is a PDTextbox object):  

field1.getDictionary().getInt("MaxLen");  

This will return -1 if the Maximum Length property is not set.  


On Tue, Nov 19, 2013 at 9:56 AM, Akshay Rawat <pr...@akshay.cc> wrote:  

> I'm working with an AcroForm which has a text field (PDTextBox) with a max  
> length. How do I use PDFBox to detect the max length of this field.  
>  
> Thanks for any help.  

Re: PDFBox: How to detect the max length of a PDTextBox

Posted by Gilad Denneboom <gi...@gmail.com>.
When a property is not directly accessible through the object's getters, it
can usually still be found by going to the "guts" of the object and
checking the COS Dictionary associated with it. A quick research revealed
that this property is found by accessing the "MaxLen" property (which maybe
should be added as one of the constants of the COSName object).
So you can use it like so (field1 is a PDTextbox object):

field1.getDictionary().getInt("MaxLen");

This will return -1 if the Maximum Length property is not set.


On Tue, Nov 19, 2013 at 9:56 AM, Akshay Rawat <pr...@akshay.cc> wrote:

> I'm working with an AcroForm which has a text field (PDTextBox) with a max
> length. How do I use PDFBox to detect the max length of this field.
>
> Thanks for any help.