static Annot CreateSingleHighlightAnnot(Document document, List <Rect> boxes, ColorPt colorPt, double highlightOpacity)
        {
            Annot annotation = Annot.Create(document, Annot.Type.e_Highlight, RectangleUnion(boxes));

            annotation.SetColor(colorPt);

            annotation.SetBorderStyle(new Annot.BorderStyle
                                          (Annot.BorderStyle.Style.e_solid, 1));

            Obj         quads          = annotation.GetSDFObj().PutArray("QuadPoints");
            List <Rect> lineRectangles = boxes.GroupBy(box => box.y1).Select(line => RectangleUnion(line.ToList())).ToList();

            lineRectangles.ForEach(lineRect => PushBackBox(quads, lineRect));
            annotation.SetAppearance(CreateHighlightAppearance(lineRectangles, colorPt, highlightOpacity, document));

            return(annotation);
        }
        public static Annot CreatePDFAnnotation(BaseAnnotation annotation, PDFDoc pdfDocument, bool fromViewer)
        {
            _currentDoc = pdfDocument;
            Annot pdfAnnotation;

            switch (annotation.Properties.PropertyName)
            {
            case XMLHighlightText.Names.Highlight:
            case XMLHighlightArea.Names.Highlight:
                pdfAnnotation = setHighlight(annotation);
                break;

            case StickyNote.Names.StickyNote:
                pdfAnnotation = setStickyNote((StickyNote)annotation, fromViewer);
                break;

            case MarkArea.Names.MarkArea:
                pdfAnnotation = setMarkArea((MarkArea)annotation);
                break;

            case FreeText.Names.FreeText:
                pdfAnnotation = setFreeText((FreeText)annotation, fromViewer);
                break;

            case Circle.Names.Circle:
                pdfAnnotation = setCircle((Circle)annotation);
                break;

            case Square.Names.Square:
                pdfAnnotation = setSquare((Square)annotation);
                break;

            case Line.Names.Line:
                pdfAnnotation = setLine((Line)annotation);
                break;

            case StamperImage.Names.Stamper:
                pdfAnnotation = setStamperImage((StamperImage)annotation);
                break;

            case StamperText.Names.Stamper:
                pdfAnnotation = setStamperText((StamperText)annotation);
                break;

            case RubberStamp.Names.RubberStamp:
                pdfAnnotation = setRubberStamp((RubberStamp)annotation);
                break;

            case XMLSquiggly.Names.Squiggly:
                pdfAnnotation = setSquiggly((XMLSquiggly)annotation);
                break;

            case XMLStrikeout.Names.Strikeout:
                pdfAnnotation = setStrikeout((XMLStrikeout)annotation);
                break;

            case XMLUnderline.Names.Underline:
                pdfAnnotation = setUnderline((XMLUnderline)annotation);
                break;

            default:
                pdfAnnotation = Annot.Create(null, Annot.Type.e_3D, null);     // For Compiler. Should never execute this
                break;
            }

            if (!(annotation is FreeText)) // Quick Fix, need to revamp it
            {
                pdfAnnotation.SetColor(AnnotationsMannager.ConvertColor(new double[] { annotation.ColorRed(), annotation.ColorGreen(), annotation.ColorBlue() }), 3);
            }

            _currentDoc.GetPage(annotation.Page()).AnnotPushBack(pdfAnnotation);
            return(pdfAnnotation);
        }