SetFieldLimit not working

Hi,

We have a production issue where the contents of the filled fields in the generated PDF must be 'autofit'(i.e. fields must be resized based on the content of the fields to autofit the content).

As per the code suggested in the below post, we tried setting the FieldLimit as 10 for a text field (assuming that the output PDF will have the text field size changed to accustom 10 characters alone). But its not working as expected. The field size doesnt seem to get changed.

https://forum.aspose.com/t/90788

Document pdfDocument = new Document(Server.MapPath("~/input.pdf"));

FormEditor formEditor = new FormEditor(pdfDocument);

formEditor.SetFieldLimit("Field1", 10);

formEditor.SetFieldLimit("Field2", 50);

formEditor.Save(Server.MapPath("~/output.pdf"));

Please confirm whether we are missing something in the code above and please suggest us the fix for this issue.

Thanks for helping us in it. As its the prod issue, it would be grateful if you could suggest us the fix ASAP. Thanks.

Hi Jerrold,


Thanks for using our products.

I have tested the scenario using Aspose.Pdf for .NET 7.7.0 and as per my observations, the field limit is 10 digits. Can you please share which version of Aspose.Pdf for .NET you are using ?

Furthermore, if the problem still persists with latest release version, please share the source PDF document so that we can test the scenario at our end. we are sorry for your inconvenience.

PS, For your reference, I have also attached the resultant file generated with following code snippet.


[C#]

Document pdfDocument = new Document(“c:/pdftest/Doc1.pdf”);<o:p></o:p>

FormEditor formEditor = new FormEditor(pdfDocument);

//add field with field limit as 10

formEditor.AddField(FieldType.Text, "textfield", "1",1, 100, 100, 200, 150);

formEditor.SetFieldLimit("textfield", 10);

formEditor.Save("c:/pdftest/FieldLimit_output.pdf");

Hi Nayyer,

Thanks a lot for your reply. We are using Aspose.Pdf for .NET 7.4.0 version.

The SetFieldLimit method is setting the max length of the content of the field and it doesnt do anything related to resizing of the field.

To make it clear about the requirement, we need to generate the output PDF from the input PDF template by filling the data dynamically. The main feature thats expected is, the data populated in the controls need to fit the field size and the empty spaces between the fields must be removed. i.e, all other content below the resized field must be pushed up so that there is no white space in between the fields once after flattening all fields.
Please let me know how to generate a dynamic filled output PDF form, removing all the empty spaces in between fields once after filling the content.
Awaiting your reply. Please suggest us some fix as its an high priority issue for us. Thanks a lot in helping in it.

Hi Jerrold,


Thanks for providing additional information. I’m afraid currently Aspose.Pdf doesn’t support the requested feature. As Aspose.Pdf mimic Adobe Acrobat as close as possible, Can you please refer some similar feature from Adobe Acrobat for understanding and logging the feature in our Issue tracking system? There is a feature in Adobe Acrobat to set Auto font property of a field to automatically shrink the input text to fit, by changing font size. Does it fit to your need?

Sorry for the inconvenience faced.

Best Regards,