0

I am using the following code to add Annotations to an existing PDF using iTextSharp and C#. The problem is that the shape of annotation highlight is quad, but what I need is a rectangular annotation. Also, is there a way to suppress the sticky note getting added to each annotation?

float[] quad =
{
  rect.Rect.Left,
  rect.Rect.Bottom,
  rect.Rect.Right,
  rect.Rect.Bottom,
  rect.Rect.Left,
  rect.Rect.Top,
  rect.Rect.Right,
  rect.Rect.Top
};

PdfAnnotation highlight = PdfAnnotation.CreateMarkup(stamper.Writer, rect.Rect, 
Constants.vbNull.ToString(), PdfAnnotation.MARKUP_HIGHLIGHT, quad);

Click here to view Image representing the annotation shape & sticky note problem

Pang
  • 9,564
  • 146
  • 81
  • 122
Shayam
  • 27
  • 1
  • 6
  • Have you tried giving the quadrilateral coordinates counterclockwise? – mkl Oct 11 '15 at 12:21
  • Hi @mkl, I tried the quad in reverse order but it messes up the location of annotation. float[] quad = { rect.Rect.Right, rect.Rect.Bottom, rect.Rect.Left, rect.Rect.Bottom, rect.Rect.Right, rect.Rect.Top, rect.Rect.Left, rect.Rect.Top }; – Shayam Oct 11 '15 at 13:53
  • Neither the original nor the other order is counterclockwise. But the counterclockwise order is required by the specification. – mkl Oct 11 '15 at 15:00
  • Hi mkl, can you post a sample of order please. – Shayam Oct 11 '15 at 16:06
  • Ok, I looked deeper into this, and it looks like **(A)** Adobe Reader does not work according to specification here, cf. e.g. [this question](http://stackoverflow.com/q/9855814/1729265), but expects the quadpoints in the order TopLeft, TopRight, BottomLeft, BottomRight, and **(B)** Adobe Reader by default draws its markup quads with *rounded* left and right sides... But the specification requires "*The annotation dictionary’s **AP** entry, if present, shall take precedence over **QuadPoints***"; thus, to really get rectangular markups you might succeed by creating your own appearance streams. – mkl Oct 11 '15 at 21:26

0 Answers0