Flattening formatted fields don't retain look

The attached contract uses formatted fields. One set is formatted to be a number, currency with 2 decimal places. The other is a date format. After flattening the number fields gain an extra comma. The date field only keeps the value for year. Am using the most recent version aspose.pdf.dll.

Also buttons that are suppose to be invisible are showing after flattening.

Attached are the pdfs before and after flatten.

contracttest8.pdf (610.5 KB)
FlattenedContract.pdf (605.0 KB)

@jthacker

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the problem with date field only as there appears no problem with formatted fields while using Aspose.PDF for .NET 18.5 in our environment. Therefore, a ticket with ID PDFNET-44668 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

About the buttons, Flatten method does not hide or delete the buttons from a form. Instead, the buttons are disabled but they appear on the page; as in the flattened PDF file shared by you. Moreover, we have devised a code snippet to achieve your requirements. It flattens the document without changing formatted fields and while removing the buttons from the form. Please try using it in your environment and then share your kind feedback with us. We have attached generated PDF file for your kind reference. contracttest_18.5.pdf

Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + "contracttest8.pdf");
Aspose.Pdf.Forms.Field[] fields = doc.Form.Fields;
foreach (Aspose.Pdf.Forms.Field field in fields)
{
    if (field is Aspose.Pdf.Forms.ButtonField)
    {
        field.Flags = AnnotationFlags.Invisible;
    }
    field.Flatten();
}
doc.Save(dataDir + @"contracttest8_18.5.pdf");