diff --git a/PdfSharpCore/Pdf.Advanced/PdfCatalog.cs b/PdfSharpCore/Pdf.Advanced/PdfCatalog.cs index b34c661d..ab489c62 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfCatalog.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfCatalog.cs @@ -160,14 +160,15 @@ internal PdfOutlineCollection Outlines /// public PdfAcroForm AcroForm { - get + get { return (PdfAcroForm)Elements.GetValue(Keys.AcroForm); } + set { - if (_acroForm == null) - _acroForm = (PdfAcroForm)Elements.GetValue(Keys.AcroForm); - return _acroForm; + if (Elements.ContainsKey(Keys.AcroForm)) + Elements[Keys.AcroForm] = value; + else + Elements.Add(Keys.AcroForm, value); } } - PdfAcroForm _acroForm; /// /// Gets or sets the language identifier specifying the natural language for all text in the document.