How do you create a new annotation that is an exact copy of another annotation?
I see one of the constructors on Annot takes in an Annot.
var newAnnot = new Annot(oldAnnot);
However, this does not create a new Annot object. Any changes I make to oldAnnot are also reflected on newAnnot. The "mp_annot" value is the same.
So next I tried to create a new Annot object via the Annot.Create method.
var newAnnot = Annot.Create(doc, oldAnnot.GetType(), oldAnnot.GetRect());
This didn't seem to work either though. I at least got a new object, but the properties aren't as expected. For example, the color of the new Annot is not set, when the color of the old Annot is red. Maybe I am missing something here.
Is there any way to accomplish this without adding it to the doc? This seems like a fairly expensive way to do this.
To give some context, I am trying to keep an old copy of an annotation around for when the user modifies the annotation. For example, say a user draws a line that is colored red. They then change it to be green. I want to give the user the option to undo that modification and set it back to red. My idea was that if I had a previous copy, I could just simply replace the new annotation with the old one, effectively undoing whatever it is that they did.