Exception from adding pages

We’re using the latest aspose.Pdf and we’re getting an exception when we add pages to a PDF. The code is below.

public void InsertPageAndTraverseForm()
            var srcDocument = new Document(@"C:\Users\User\Desktop\FormTest.pdf");
            var addDocument = new Document(@"C:\Users\User\Desktop\FormTest.pdf");

            foreach (var page in addDocument.Pages)

            var list = srcDocument.Form.Fields.ToList();
            foreach (var item in list)
                // crash at here
                if (item.PageIndex != 1)

                // other code

FormTest.pdf (1.3 MB)


I tested your code and I was able to replicate the exception. I will contact the dev team and create a bug.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-53645

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.