I'm using the following code to add a polygon annotation:
- Code: Select all
var doc = PdfDocument.MergeFiles(files.ToArray());
var page = doc.Pages[0];
var points = new PointF[] { new(0.5, 1.0), new(7.5, 1.0), new(8.5, 4.0), new(1.5, 4.0), new(0.5, 1.0) };
var annotation = new PdfPolygonAnnotation(page, points)
{
Name = "name",
Author = "somebody",
BorderEffect = PdfBorderEffect.SmallCloud,
ModifiedDate = DateTime.Now,
Subject = "some text",
};
annotation.Text = "some text";
page.Annotations.Add(annotation);
doc.Save(outputPath);
(where "files" is an array of filepaths for single-page pdfs, and "outputPath" is the output path)
One of the input pdfs has a shape that links to a file (example attached). After adding an annotation to it like this, the file link vanishes.