From 85ee89f745b5f45b95e1b983058050fb6bbacbfc Mon Sep 17 00:00:00 2001 From: Patrick Ammann Date: Thu, 2 Jun 2022 09:48:04 +0200 Subject: [PATCH] feat: allow to set AcroForm --- PdfSharpCore/Pdf.Advanced/PdfCatalog.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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.