Highlight Style is not retain properly in Adobe reader/acrobat

When we create link using Aspose 19.1.0.0 Library and set the “link Highlighting” to any mode on HighlightingMode(Outline, Invert). Open that created pdf document in adobe and check the link property, the HighlightingMode is not showing properly.

See the below code snip
try
{
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.Embedded = true;
license.SetLicense(“Aspose.Pdf.lic”);

                Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(textBox1.Text);
                Aspose.Pdf.Page page = pdf.Pages[1];
                Aspose.Pdf.Rectangle AnnotRect = new Aspose.Pdf.Rectangle(80, 500, 350, 530);
                LinkAnnotation link = new LinkAnnotation(page, AnnotRect);
                link.Highlighting = HighlightingMode.Outline;
                XYZExplicitDestination mag = new XYZExplicitDestination(page, 0, page.MediaBox.Height, 0);
                link.Action = new GoToAction(mag);
                System.Drawing.Color color1 = System.Drawing.ColorTranslator.FromHtml("#008000");
                link.Color = Aspose.Pdf.Color.FromRgb(color1);
                Border border = new Border(link);
                border.Style = Aspose.Pdf.Annotations.BorderStyle.Solid;
                link.Border = border;
                page.Annotations.Add(link);
                pdf.Save("D:\\link_without_textColor_change.pdf");
                MessageBox.Show("The PDF File is saved at the location of D:\\link_without_textColor_change.pdf");
            }
            catch
            {
                MessageBox.Show("Some Error Encountered");
            }

@punithkumar

Thanks for your inquiry.

LinkAnnotation creates a rectangle around selected text inside PDF page and all color properties implies to its rectangle only. In case you need to highlight entire text, you can use HighlighAnnotation as follows to achieve that which offers properties to set color as well as opacity.

Rectangle bbox = textFragment.Rectangle;
HighlightAnnotation annotation = new HighlightAnnotation(page, bbox);
annotation.Color = Color.Yellow;
annotation.Opacity = 0.5f;
{
  Border border = new Border(annotation);
  border.Width = 1;
  border.Style = BorderStyle.Solid;
  annotation.Border = border;
}

In case you still face any issue or have any different requirements, please share your source PDF document with us. We will test the scenario in our environment and address it accordingly.