PDFSharp filling in form fields
I would like to fill in form fields in a premade PDF doc, but I'm receiving a Null Refrence error with AcroForm when running. string fileN4 = TextBox1.Text + " LOG.pdf"; File.Copy(Path.Combine(textBox4.Text + "\\", fileN4), Path.Combine(Directory.GetCurrentDirectory(), fileN4), true); // Open the file PdfDocument document = PdfReader.Open(fileN4, PdfDocumentOpenMode.Modify); PdfTextField currentField = (PdfTextField)(document.AcroForm.Fields["<CASENUM>"]); //const string caseName = TextBox1.Text; PdfString caseNamePdfStr = new PdfString(caseName); //set the value of this field currentField