PDFsharp icon indicating copy to clipboard operation
PDFsharp copied to clipboard

Adds option to enable annotation copying - and other PdfSharpCore Features

Open peterharding93 opened this issue 10 months ago • 2 comments

The PdfSharpCore project (branched many years ago) support for deep-copying annotations on a page. It has a fairly simple pull request to implement it: https://github.com/ststeiger/PdfSharpCore/issues/77 Adds option to enable annotation copying

Is anyone else interested in having this feature migrated?

I (like many people) have been using PdfSharpCore for a few years due to the NetCore/NetFramework compatibility. Now I have to move back due to PdfSharpCore and the version problems / security risks with the ImageSharp libraries. That project is as good as unmaintained from what I can see. There are probably other features that would be useful to migrate back.

I also got a lot of benefit from being able to read dodgy PDF's with "PdfReadAccuracy.Moderate". Not sure if that is viable to include in PdfSharp?

Maybe someone else has already looked into this and has tried including these features? Or any recommendations on how I go about this?

peterharding93 avatar Jan 22 '25 21:01 peterharding93

Seems to be already done ? (although without the AnnotationCopyingType) See here.

But IMO, the import is still incomplete. When you're importing pages from a document that contains an AcroForm, the Widget-Annotations of the fields would be imported, but the AcroForm itself is left out (unless it is handled somewhere else).

packdat avatar Jan 24 '25 17:01 packdat

Thanks that info is useful. I just read about the distinction between the AcroForm and the Annotation Widgets.

Regarding Annotation copy, I now think:

  1. A complete solution would need to copy the relevant fields from AcroForm. I'm not sure if PdfSharpCore did that.
  2. The PDFSharpCore optionally performs deep copy, PdfSharp does not. Maybe this copies the form fields? In early testing I found I needed the deep copy, but I'm not sure anymore.
  3. My testing is inconclusive. PdfSharp annotation copies seem to NOT work in Edge browser, but they do in other browsers / viewers.

I will continue to test and investigate.

Regarding my other thought, on PdfReadAccuracy, I found that PdfSharp implemented a better solution to improve robustness, the read options. Nothing to do there.

I recommend this task can be **closed / rejected ** further work on annotation copying is a bigger exercise than just copying what was done in PdfSharpCore.

peterharding93 avatar Jan 25 '25 00:01 peterharding93