|
Document.Pages[Options.PageIndex].Elements.Add(PdfPage.Keys.Annots, new PdfArray(Document, signatureField)); |
Using .Add(...) throw an exception when the /Annots key exists.
I stumbled upon some PDF documents generated by www.princexml.com that has the /Annots key present in this dictionary, but the reference PDF object does not exist, in PdfSharp this gives a null value for the /Annots key in the dictionary.
For example the /Annots element references an object '70 0 R' but there is no element with this reference in the document.
Leading to .Add(...) throwing an exception.
Simple fix is to use the indexer of the dictionary to overwrite the value instead of throwing:
KDS@233b486