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

Free Support Forum - aspose.com

Aspose.pdf.facades.form FieldNames threw exception of type system.nullreferenceexception

DO43_Template.pdf (361.8 KB)

FieldNames and FormSubmitButtonNames throw nullreferenceexception on the instantiation of pdfForm.
Is there a problem with the PDF file that is causing this? Or, an issue with Aspose.PDF?

        var dataDir = @"C:\TestDir\Source\WordPdf\Templates\Pdf\DO43_Template.pdf";
        var pdfForm = new Aspose.Pdf.Facades.Form();
        var allfields = pdfForm.FieldNames;

@afausz

I request you to mention the file name while loading the form and then share your feedback.

var pdfForm = new Aspose.Pdf.Facades.Form(dataDir);

My apology, I have tried several different things and forgot to put that back before posting.
It throws an exception System.Exception._COMPlusExceptionCode -532462766.
The SetLicense is for Aspose.Total.lic with isLicensed = true.
The Aspose code is in it’s own class which is not async and is called from an async Task.

            var result1 = await Task.Run(() => createUpd.CreateFormAsync());

Thank you for your assistance. I moved my await out another level in my project and the issue is resolved.

@afausz

It’s good to know that it is working on your end.