Skip to content

Instantly share code, notes, and snippets.

@conholdate-docs-gists
Created September 22, 2022 07:11
Show Gist options
  • Save conholdate-docs-gists/0b96fd14df88332224777c1960cab12d to your computer and use it in GitHub Desktop.
Save conholdate-docs-gists/0b96fd14df88332224777c1960cab12d to your computer and use it in GitHub Desktop.
Add Text Field Annotation in a document | https://docs.conholdate.com/net/add-text-field-annotation/
//Add text field annotation to the document from local disk
using (Annotator annotator = new Annotator("input.pdf"))
{
TextFieldAnnotation textField = new TextFieldAnnotation
{
BackgroundColor = 65535,
Box = new Rectangle(100, 100, 100, 100),
CreatedOn = DateTime.Now,
Text = "Some text",
FontColor = 65535,
FontSize = 12,
Message = "This is text field annotation",
Opacity = 0.7,
PageNumber = 0,
PenStyle = PenStyle.Dot,
PenWidth = 3,
FontFamily = "Arial",
TextHorizontalAlignment = HorizontalAlignment.Center,
Replies = new List<Reply>
{
new Reply
{
Comment = "First comment",
RepliedOn = DateTime.Now
},
new Reply
{
Comment = "Second comment",
RepliedOn = DateTime.Now
}
}
};
annotator.Add(textField);
annotator.Save("result.pdf");
@conholdate-docs-gists
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment