Code that worked in the stable 1.32.3057 now throws "System.NullReferenceException' occurred in PdfSharp-wpf.dll" "Additional information: Object reference not set to an instance of an object."
I am using the following code:
Code:
PdfDocument document = PdfReader.Open(toPath, PdfDocumentOpenMode.Modify);
if (document.AcroForm.Elements.ContainsKey("/NeedAppearances") == false)
{
document.AcroForm.Elements.Add("/NeedAppearances", new PdfBoolean(true));
}
else
{
document.AcroForm.Elements["/NeedAppearances"] = new PdfBoolean(true);
}
PdfTextField currField = (PdfTextField)document.AcroForm.Fields["txtProjNamn"];
currField.Text = projData.projName;
It is the last row above that throws the exception.
The document with all fields is created in Acrobat 8 Pro.
I moved over to the latest beta today, since I need to use streams for images, after that it does not work anymore.
projData.projName is a public static string.