Closed Sicos1977 closed 5 years ago
Maybe add the PdfTextAnnotation
after RenderDocument
has completed.
Or maybe use RenderPage
instead of RenderDocument
as shown in this sample:
https://forum.pdfsharp.net/viewtopic.php?f=8&t=3172
Thanks... I solved it like this.
var pdfRenderer = new PdfDocumentRenderer {Document = document};
pdfRenderer.RenderDocument();
var page = pdfRenderer.PdfDocument.Pages[0];
var pdfTextAnnotation = new PdfTextAnnotation
{
Icon = PdfTextAnnotationIcon.Note,
Title = "Image meta-data",
Contents = "Bla die bla bla",
Rectangle = new PdfRectangle(new XRect(30, page.Height, 30, 30)),
Flags = PdfAnnotationFlags.Locked
};
page.Annotations.Add(pdfTextAnnotation);
pdfRenderer.WriteDocumentInformation();
pdfRenderer.PdfDocument.Save(outputFile);
Hi,
Is it possible to add a PDFAnnotation to a document object?
I made the document like this
And added some images like this
And tried to add a pdfannotation like this
Everything works, I see the images but for some reason the annotation is not visible in the document. Am I doing something wrong?