The below code sets the value of a multiline text field with five lines and then flattens and saves a new pdf. Viewing the pdf in Edge or Chrome shows that there is a margin before the first line of text and the last line is partially visible.
Opening the template pdf in Edge and entering five lines works correctly. The last line is not cut off.
I am using Aspose.PDF for .NET 23.4
template.pdf (6.4 KB)
out.pdf (5.0 KB)
image.png (2.7 KB)
using Aspose.Pdf.Forms;
new Aspose.Pdf.License().SetLicense("Aspose.PDF.NET.lic");
var pdf = new Aspose.Pdf.Document(@"C:\Source\Test\Aspose\MultiLineHeightBug\template.pdf");
var textBoxField = pdf.Form["Text1"] as TextBoxField;
textBoxField.Value = "line 1\r\nline 2\r\nline 3\r\nline 4\r\nline 5";
pdf.Flatten();
pdf.Save(@"C:\Source\Test\Aspose\MultiLineHeightBug\out.pdf");