I have problem with Spire.PDF .NET.
When i create pdf with annotations and then i want to print it, there are no annotations printed.
Im using newest version of Spire.PDF, and Adobe Acrobat Reader DC version 2020.009.20074. (I have checked in Adobe Preferences-> Commenting -> Print notes and pop-up, and in Print window i have selected Comments & Forms => Documents and Markups )
Here is example code that generates PDF.
- Code: Select all
class Program
{
static void Main(string[] args)
{
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add();
PointF[] points = FromRectangle(new RectangleF(200,200,100,100),5f);
var annotation = new PdfPolygonAnnotation(page, points)
{
Name = $"a1",
Color = Color.Red,
Text = "Test Text",
Author = "autor",
BorderEffect = PdfBorderEffect.BigCloud,
ModifiedDate = DateTime.Now,
Subject = "test subject"
};
annotation.Text = "text";
(page as PdfNewPage).Annotations.Add(annotation);
doc.SaveToFile("result.pdf");
System.Diagnostics.Process.Start("result.pdf");
}
private static PointF[] FromRectangle(RectangleF r, float skew = 0.0f) => FromCorners(r.Left, r.Top, r.Right, r.Bottom, skew);
private static PointF[] FromCorners(float x1, float y1, float x2, float y2, float skew = 0.0f)
=> new PointF[]
{
new PointF(x1 - skew, y1),
new PointF(x2 - skew, y1),
new PointF(x2 + skew, y2),
new PointF(x1 + skew, y2),
new PointF(x1 - skew, y1)
};
}