We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get FieldLimit

I understand how to SetFieldLimit, but I would like to get the value before I change it.

Is this possible?

Hi Diane,


Thanks for contacting support.

In case you need to get the field limit/width, you may consider using following code snippet.

[C#]

//open
document
<o:p></o:p>

Document pdfDocument = new Document("input.pdf");

//get a field

TextBoxField textBoxField = pdfDocument.Form["textbox1"] as TextBoxField;

//get field value

Console.WriteLine("PartialName : {0} ", textBoxField.PartialName);

Console.WriteLine("Value : {0} ", textBoxField.Value);

Console.WriteLine("Width : {0} ", textBoxField.Width);

Is that width the physical width of the field on the document (measurement) or the number of characters allowed within the field?

I need the number of characters that are allowed to be entered a textbox field.

Thanks,
Diane Asberry

dasberry:
Is that width the physical width of the field on the document (measurement) or the number of characters allowed within the field?
Hi Diane,

Sorry for the delayed response.

The above stated code snippet returns the width of field in terms of measurement (object width over PDF file.).

dasberry:
I need the number of characters that are allowed to be entered a textbox field

I am afraid this feature is currently not supported. For
the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-37199. We will
investigate this issue in details and will keep you updated on the status of a
correction.

We apologize for your inconvenience.

The issues you have found earlier (filed as PDFNEWNET-37199) have been fixed in Aspose.Pdf for .NET 9.5.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Thank you for the enhancement!

Diane Asberry

Hi Diane,


Thanks for your feedback. Please check following code snippet to get maximum filed limit. Hopefully it will help you to accomplish the task.

// Adding Field
with limit<o:p></o:p>

Aspose.Pdf.Facades.FormEditor form = new Aspose.Pdf.Facades.FormEditor();

form.BindPdf("input.pdf");

form.SetFieldLimit("textbox1", 15);

form.Save("output.pdf");

// Getting maximum field limit using DOM

Document doc = new Document("output.pdf");

Console.WriteLine("Limit: " + (doc.Form["textbox1"] as TextBoxField).MaxLen);

// Getting maximum field limit using Facades

Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form();

form.BindPdf("output.pdf");

Console.WriteLine("Limit: " + form.GetFieldLimit("textbox1"));

Please feel free to contact us for any further assistance.


Best Regards,