Hi,
I am getting a System.NullReferenceException when trying to set a value to a acro form field.
This is in a project targeting .Net 6 using Aspose.PDF 22.7.0. The pdf that I am using is attached to this ticket.
Here is my code:
License license = new License();
license.SetLicense(new MemoryStream(licenseBin));
string path = @"C:\Dev\Testing\PDF_Eval";
string pdfTemplate1 = Path.Combine(path, "f941pr.Q2.2022.LT.PDF");
string outPdf1 = Path.Combine(path, "outPdf1.pdf");
byte[] template = File.ReadAllBytes(pdfTemplate1);
Document pdfDocument = new Document(new MemoryStream(template));
var fld = pdfDocument.Form["topmostSubform[0].Page1[0].Header[0].EntityArea[0].f1_5[0]"] as Field;
if (fld != null)
{
fld.Value = "test 123"; // Error here
}
var outSream = new MemoryStream();
pdfDocument.Flatten();
pdfDocument.Save(outSream);
var outBytes1 = outSream.ToArray();
File.WriteAllBytes(outPdf1, outBytes1);
Thanks
Alexf941pr.Q2.2022.LT.PDF (159.5 KB)