Form field shrinking to accomodate text length

Using FillField I’m saving text to a pdf form field which has been set up as FontSize 10
When I save very long text to the field, the font size is shrinking in order to display all of the text.
This is the behaviour I would expect to see only if the field font size was set to Auto, but it’s not – the field font size is 10. Unless it is Auto, the font size specified should be applied regardless of the length of the text.
Is there a way of getting around this? I would be grateful if you could confirm this issue and provide an ETA for resolution.
Thanks

Nora Devine:
Using FillField I’m saving text to a pdf form field which has been set up as FontSize 10 When I save very long text to the field, the font size is shrinking in order to display all of the text. This is the behaviour I would expect to see only if the field font size was set to Auto, but it’s not – the field font size is 10. Unless it is Auto, the font size specified should be applied regardless of the length of the text.
Hi Nora,

Do you mean that if font size for field is specified, the contents inside field should be displayed with specific font but if the contents inside form field are greater than field size/width, the contents will be truncated. Do you accept the behavior to truncate the contents exceeding field width or would like to have some scroll bar when contents reach field width.

Please share the details and some PDF file which can help us in testing the scenario in our environment.

We do not want the text to reduce to fit - we want it to appear exactly as per the font size specified in the field - even if that involves truncation.



Have a look at the field called “Text2” in the attached.



Some of the organisations to which we are sending forms will not accept them below a certain font size.

Hi Nora,


Thanks for sharing the resource file.

I have tested the scenario and have observed that font size fro form field contents is reduced, if the contents being added to form field are larger in size as compared to field size/width. For
the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-37929. We will
investigate this issue in details and will keep you updated on the status of a
correction.

We apologize for your inconvenience.

Thanks. I would be grateful if you could prioritise this and provide an ETA. Filling a field should correctly observe the control settings regardless of the text length.

Regards
Nora

Hi Nora,


As we recently have been able to notice this issue, and until or
unless we have investigated and have figured out the actual reasons of this
problem, we might not be able to share any timelines by which this problem will
be resolved.
<o:p></o:p>

However, as soon as we have made some significant progress towards the resolution of this issue, we would be more than happy to update you with the status of correction. Please be patient and spare us little time. Your patience and comprehension is greatly appreciated in this regard.

Was this ever addressed? I see the same behavior form filling a pdf using version 11.4.

I tried the fitFont Boolean flag on the FillField method, but it doesn’t do anything.

Hi Randell,


Thanks for using our API’s.

I am afraid the earlier reported issue is not yet resolved. Nevertheless, I have intimated the product team to try accommodating it in their development schedule and as soon as we have some definite updates, we will let you know. However we request you to please share the source/input file which you are using, so that we can test that specific scenario. We are sorry for this delay and inconvenience.

Hi Randell,


Thanks for your patience. Please use TextBoxField.FitIntoRectangle property, it will help you to accomplish the task.

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

Document pdfDocument = new Document("c:/pdftest/FieldNovalue.pdf");

//get a field

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

//modify field value

TextBoxField.FitIntoRectangle = false;

textBoxField.Value = "This is sample large value inside Text field and with scroll bars so that we can see complete field contents";

//save updated document

pdfDocument.Save("c:/pdftest/filledFormField.pdf");


Please feel free to contact us for any further assistance.

Best Regards,

Hi,

Have this ever been resolved using FillField method and not using TextBoxField.FitIntoRectangle for each field?

Thanks

@NoraDevine,

I had no information about this before your post, but I saw a comment from the developer from seven years ago.

This is the comment:

Please use TextBoxField.FitIntoRectangle property:

//open document
Document pdfDocument = new Document("c:/pdftest/FieldNovalue.pdf");
//get a field
TextBoxField textBoxField = pdfDocument.Form["Text2"] as TextBoxField;
//modify field value
TextBoxField.FitIntoRectangle = false;
textBoxField.Value = "This is sample large value inside Text field and with scroll bars so that we can see complete field contents";
//save updated document
pdfDocument.Save("c:/pdftest/filledFormField.pdf"); 

End of comment.

This message is seven years old, and the API has gone up many majors, so not sure how up-to-day this is. This was also the last response post used in this topic if you noticed.

Hi,

We are running Aspose.Pdf 21.6.0.0 and that version has the same behavior on FillField method. I was hoping to have to avoid loading each form field into the TextBoxField object. So I assume then this is not something that will be addressed using FillField method?

Thanks,

Sandra

~WRD0002.jpg (357 Bytes)

@Sandra_Silver

Can you use the latest version? 23.4.

If it fails, can you post your code and document, please?