Created
October 13, 2021 13:23
-
-
Save GroupDocsGists/489db43078dc098ec014662a64d3e81d to your computer and use it in GitHub Desktop.
Add Highlight and Links Annotations to Annotate PDF documents using C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create Hyperlinks in PDF using link annotations in C# | |
using (Annotator annotator = new Annotator(@"path/sample.pdf")) | |
{ | |
LinkAnnotation link = new LinkAnnotation | |
{ | |
CreatedOn = DateTime.Now, | |
PageNumber = 0, | |
Points = new List<Point> | |
{ | |
new Point(120, 300), | |
new Point(600, 300), | |
new Point(120, 270), | |
new Point(600, 270) | |
}, | |
Url = @"https://products.groupdocs.com/annotation" | |
}; | |
annotator.Add(link); | |
annotator.Save(@"path/annotation-link.pdf"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Highlight PDF using highlight annotation in C# | |
using (Annotator annotator = new Annotator(@"path/sample.pdf")) | |
{ | |
HighlightAnnotation highlight = new HighlightAnnotation | |
{ | |
BackgroundColor = 0xFFF000, | |
CreatedOn = DateTime.Now, | |
Opacity = 0.5, | |
PageNumber = 0, | |
Points = new List<Point> | |
{ | |
new Point(120, 270), | |
new Point(600, 270), | |
new Point(120, 300), | |
new Point(600, 300) | |
} | |
}; | |
annotator.Add(highlight); | |
annotator.Save(@"path/annotation-highlight.pdf"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment