empira / PDFsharp-1.5

A .NET library for processing PDF
MIT License
1.28k stars 588 forks source link

Fix InsertRange annotation crash #87

Open Risord opened 5 years ago

Risord commented 5 years ago

PdfSharp.Pdf.InsertRange crash if there is fixed annotations.

Crash happen at the end of PdfSharp.Pdf.InsertRange: page.Elements.Add(PdfPage.Keys.Annots, annotations); since page have already annotations added by ImportExternalPage method. Therefore this seems like potential regression bug.

So use replace instead? Works nicely for me but I have no enough knowledge about PDF format to say should annotations be merged mode intelligently instead?