I am using iTextSharp with C# to fill an editable PDF. Everything was working fine, but suddenly I am getting an error on the PdfStamper line.
PdfReader pdfReader = new PdfReader(File.ReadAllBytes(pdfTemplatePath));
PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(newFile, FileMode.Create,FileAccess.Write));
AcroFields pdfFormFields = pdfStamper.AcroFields;
The error is
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=itextsharp
StackTrace:
at iTextSharp.text.Version.GetInstance()
I have checked the file paths and everything - that is all correct. I have also made sure there are no permission issues.
Can someone please let me what might be causing this to throw a null reference exception.
Thanks in advance.
User contributions licensed under CC BY-SA 3.0