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

Free Support Forum - aspose.com

Multilinetext + font auto + ImportXFDF = Font size MAX

Hello, I’m having an issue with MultiLineText fields set to font size AUTO after data merge. The resulting text appearance has an excessive size font.

Test Case

PDF Form with 1 full page sized MultiLineText field with font size set to AUTO


Win7 64bit

.NET 2.0

Aspose.PDF.dll v8.5.0.0 for .NET 2.0

Expected Result

In Adobe Acrobat Pro, when editing or filling PDF Form containing a multiline text field with size AUTO, the text maintains a font size of default (12) until the text fills the field at which point the text size will gradually reduce to accomodate all the text. This is true for manual entry and import XFDF.

Code Sample 1

Dim l_pdfForm As Aspose.Pdf.Facades.Form = Nothing
l_pdfForm = New Aspose.Pdf.Facades.Form(“c:\temp\testform.pdf”)
Using l_memoryStream As New MemoryStream( System.Text.Encoding.UTF8.GetBytes(“c:\temp\testform_data.xfdf”))
End Using

Code Sample 2

Dim l_pdfForm As Aspose.Pdf.Facades.Form = Nothing
Dim l_fieldName As String = String.Empty
Dim l_fieldPath As String = String.Empty
Dim l_fieldIndex As Integer = 0
Dim l_xfdfDoc As XmlDocument = Nothing
Dim l_nsManager As XmlNamespaceManager = Nothing
Dim l_xfdfNav As XPathNavigator = Nothing
Dim l_xfdfNodeNav As XPathNavigator = Nothing
l_pdfForm = New Aspose.Pdf.Facades.Form(“c:\temp\testform.pdf”)
l_xfdfDoc = New XmlDocument()
l_nsManager = New XmlNamespaceManager(l_xfdfDoc.NameTable)
l_nsManager.AddNamespace(“x”, “http://ns.adobe.com/xfdf/”)
l_xfdfNav = l_xfdfDoc.CreateNavigator()
For l_fieldIndex = 0 To l_pdfForm.FieldNames.Length - 1
l_fieldName = l_pdfForm.FieldNames(l_fieldIndex)
l_fieldPath = “//x:field[@name=’” + String.Join("’]/x:field[@name=’", l_fieldName.Split("."c)) + “’]/x:value”
l_xfdfNodeNav = l_xfdfNav.SelectSingleNode(l_fieldPath, l_nsManager)
If l_xfdfNodeNav IsNot Nothing Then
l_pdfForm.FillField(l_fieldName, l_xfdfNodeNav.Value)
End If

Actual Result

See attached ZIP containing the following files:

  • TestForm.pdf (base PDF Form used as the template)
  • TestForm_data.xfdf (XFDF data to be used for the form merge)
  • TestForm_ImportXFDF_result.pdf (Result of Code Sample 1)
  • TestForm_FillField_result.pdf (Result of Code Sample 2)

Notice in the results when opening the PDF in Adobe Acrobat Pro, the text appears to have extremely large font 72+.

If you edit the field in Adobe Acrobat Pro, the font returns to normal.

I attempted to fix appearance with the following but no success:

l_pdfEditor.Document.Form.Fields(l_fieldIndex).FitIntoRectangle = False
l_pdfEditor.Document.Form.Fields(l_fieldIndex).DefaultAppearance.FontSize = 12

I have also tried this with the latest Aspose.Pdf.dll v10.6.0.0 but I have the same problem.

How can I enforce a maximum size font (12) for a single line value of text in a multiline text field set to AUTO size?

NOTE: The font auto size behavior was working correctly in old style “importXfdf” using Aspose.Pdf.Kit.dll v

Hi there,

Thanks for your inquiry. Please check following sample code to change form field font, hopefully it will help you to accomplish the task.

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

TextBoxField field = pdfDocument.Form["test_field_auto"] as TextBoxField;

field.DefaultAppearance = new Aspose.Pdf.InteractiveFeatures.DefaultAppearance("Helvetica", 12, System.Drawing.Color.Black);

TextBoxField.FitIntoRectangle = false;


Please feel free to contact us for any further assistance.

Best Regards,

Hello, thank you for the quick reply.

While the code sample you have provided does indeed control the font size, it does not solve my problem. The issue is I need a multiline field to have auto size to accomodate a lot of text (the font becomes smaller automatically) but maintain a “natural” default font size when there is very little text in the field.

If you look at the result pdf files in my original post you will notice the font is extremely large, much bigger than a standard 12 point. However, if you look at the same form filled using Adobe Acrobat Pro - import xfdf, you will see that while the field is set to auto size, the actual font showing is very natural. (see attachment TestForm_ExpectedResult.pdf in current post).

The reason I cannot alter/fix the font to a specific size for the text field is because of the possibility of large amounts of text. (see attachment TestForm_large_ImportXFDF_result.pdf in current post).

The field font size must remain auto but it needs to be limited to a maximum font size. How can I do this?


Hi there,

Thanks for your feedback. We have logged a ticket PDFNEWNET-39108 in our issue tracking system for further investigation and resolution. We will keep you updated about the issue resolution progress within this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

Hello, this issue is rather critical as it is preventing us from moving into production. Do you have a potential alternative method?


Hi there,

Thanks for your inquiry. I am afraid there is no other workaround at the moment but to change font size to some specific size as suggested above. However for fix of the original issue you need to wait for the resolution. We will notify you as soon as we made some significant progress towards issue resolution.

We are sorry for the inconvenience caused.

Best Regards,

Good day,

Additionnal details regarding this problem:

- Once the PDF has been merged using Aspose.PDF, if you open the document in Adobe Acrobat and edit the field with the oversized looking font, the font returns to normal. If feels as though a “flag” is missing on the field. We have tried appending a carriage return to the field and playing with various boolean properties on the field but nothing seems to limit the maximum font size.

We have a valid Aspose Total license and respectfully request to expedite this request.

Thank you

Hi there,

Thanks for sharing your additional findings. We have passed on these to our product team, they will consider during analysis of the issue. Moreover, we have raised the issue priority and requested our team to complete the investigation at their earliest and share a workaround or ETA of the fix. We will notify you as soon as we get a feedback.

We are sorry for the inconvenience caused.

Best Regards,


It has been nearly a week and our need is urgent. Has your product team reviewed the problem? Do you have any news on this issue?

Thank you.

Hi there,

Thanks for your inquiry. Our product team has completed the investigation of above reported issue and planned its fix in upcoming version of Aspose.Pdf for .NET i.e.10.8.0. Hopefully it will be released in start of September 2015. However please note it is not promise but we will try our level best to fix your issue in said version. We will keep you updated about the progress.

Thanks for your patience and cooperation.

Best Regards,

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

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


We have deployed the latest Aspose.Pdf.dll (dated 2016-03-07) for testing and I regret to inform you we are still experiencing the same problem. Importing an XFDF using Aspose.Pdf.dll into PDF document with a multiline text field with “font: auto” and a value of juste 1 word still maximizes the text to fill the field rather than maintain a regular font (ie 12pt).

All original submitted documents and test files as support for this claim remain unchanged.

We are using the net2.0 dll.

Please review the test once again with latest Aspose DLL to confirm the problem.

Hi there,

We are sorry for the inconvenience. We have added a new property MaxFontSize in TextBoxField class. If set, this property defines maximal font size for autosized fields.
By default its value is -1 what means that font size is not limited. Thus, the following line should be added in the code:

TextBoxField.MaxFontSize = 12;<o:p></o:p>

Please feel free to contact us for any further assistance.

Best Regards,