PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

How to create an appearance stream for annotations?
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4099
Page 1 of 1

Author:  Oezguer [ Wed Feb 26, 2020 10:25 am ]
Post subject:  How to create an appearance stream for annotations?

Hi,

i'm trying to create a highlight annotation using as a reference.

This is my code so far:
Code:
XRect xrect = new XRect(new XPoint(Double.Parse(annotation.Rect[0], CultureInfo.InvariantCulture), Double.Parse(annotation.Rect[1], CultureInfo.InvariantCulture)),
      new XPoint(Double.Parse(annotation.Rect[2], CultureInfo.InvariantCulture), Double.Parse(annotation.Rect[3], CultureInfo.InvariantCulture)));

PdfHighlightAnnotation pdfAnnotation = new PdfHighlightAnnotation();
pdfAnnotation.Quadrilaterals = new List<PdfRectangle> { new PdfRectangle(xrect) };
pdfAnnotation.Title = annotation.Title;
pdfAnnotation.Color = XColor.FromArgb(annotation.Color[0], annotation.Color[1], annotation.Color[2]);
pdfAnnotation.Elements.SetString("/CreationDate", annotation.CreationDate);

pdfAnnotation.Rectangle = new PdfRectangle(xrect);

pdfDocument.Pages[pdfPage.PageNumber].Annotations.Add(pdfAnnotation);


The annotation gets created but it doesn't have any appearance.
As far as i understood i need to create an appearance stream, but i don't know how to do that.

Can anyone help me out?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/