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

Free Support Forum - aspose.com

XFA Form not flattening

I’m evaluating ASPOSE.PDF. I want to fill and flatten XFA documents. My source code is:
var form = new Aspose.Pdf.Facades.Form();
form.BindPdf(package.PdfTemplate);

        using (var dataStream = new MemoryStream())
        {
            dataXml.Save(dataStream);
            dataStream.Seek(0, SeekOrigin.Begin);

            form.ImportXml(dataStream);
            if (flatten)
            {
                form.FlattenAllFields();
            }

            var result = new MemoryStream();
            form.Save(result);
            result.Seek(0, SeekOrigin.Begin);

            return result;
        }

The result is not flattened. If I open result in Acrobat Reader, all fields looks like flattened, but other PDF programs want open it.
Result PDF is here g2pOutput.pdf (1.0 MB)

@nechanicky,
Kindly send us your source PDF and XML file. We will investigate and share our findings with you. Your response is awaited.

Best Regards,
Imran Rafique

Hello,
data are attached here: aspose.zip (74.0 KB)

@nechanicky,

Kindly elaborate a bit more about the problematic behavior and the software tool which you are using to open the PDF document. We cannot edit fields in the Adobe Reader and Foxit. This is the output PDF: FilledPDFFileWithFlatten.pdf (79.9 KB)

Best Regards,
Imran Rafique

Hello,

your PDF has same result. I can’t edit fields in Acrobat Reader, but also the PDF can’t be opened in Chrome.
See: Capture.PNG (94.6 KB)

Best Regards,
Jaromir Nechanicky

@nechanicky,
We managed to replicate the said error in our environment. It has been logged under the ticket ID PDFNET-43132 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates. We are sorry for the inconvenience caused.

Best Regards,
Imran Rafique

Hi,

do you have any update about when the bug will be fixed?

Best regards Jaromir

@nechanicky,
The linked ticket ID PDFNET-43132 is pending for the analysis and not resolved yet. It is difficult for us to share an estimate before the completion of the analysis phase. We have logged an ETA request under the same ticket ID PDFNET-43132. We will let you know once a significant progress has been made in this regard.

Best Regards,
Imran Rafique