PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

Can pdfSharp remove annotations on a PDF page?
http://forum.pdfsharp.de/viewtopic.php?f=2&t=4126
Page 1 of 1

Author:  snuuby [ Sun Apr 19, 2020 9:38 pm ]
Post subject:  Can pdfSharp remove annotations on a PDF page?

I've searched around and nobody seems to answer this. I tried using the pdfAnnotations.Remove() method, but that doesn't seem to work. Am i doing something wrong?

Author:  wiliek [ Wed Sep 30, 2020 4:32 am ]
Post subject:  Re: Can pdfSharp remove annotations on a PDF page?

Code:
  foreach (var annot in page.Annotations.ToList().OfType<PdfAnnotation>())
  {
        //if some condition then
        page.Annotations.Remove(annot);
   }
   //save the document


This worked for me.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/