PdfTextMarkupAnnotation Class
Represents the text markup annotation.
Implements
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfTextMarkupAnnotation : PdfAnnotation, IPdfWrapper, INotifyPropertyChanged
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create PDF font and PDF font style .
Font font = new Font("Calibri", 10, FontStyle.Bold);
PdfFont pdfFont = new PdfTrueTypeFont(font, false);
//Create a new pdf brush.
PdfBrush pdfBrush = new PdfSolidBrush(Color.Black);
//Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, new PointF(150, 10));
string markupText = "Text Markup";
SizeF size = pdfFont.MeasureString(markupText);
RectangleF rectangle = new RectangleF(175, 40, size.Width, size.Height);
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle);
//Create a pdf text markup annotation .
PdfTextMarkupAnnotation markupAnnotation = new PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, new PointF(175, 40), pdfFont);
markupAnnotation.TextMarkupColor = new PdfColor(Color.BlueViolet);
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight;
//Add this annotation to a new page.
page.Annotations.Add(markupAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create pdf font and pdf font style .
Dim font As New Font("Calibri", 10, FontStyle.Bold)
Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, False)
'Create a new PDF brush.
Dim pdfBrush As PdfBrush = New PdfSolidBrush(Color.Black)
'Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, New PointF(150, 10))
Dim markupText As String = "Text Markup"
Dim size As SizeF = pdfFont.MeasureString(markupText)
Dim rectangle As New RectangleF(175, 40, size.Width, size.Height)
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle)
'Create a pdf text markup annotation .
Dim markupAnnotation As New PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, New PointF(175, 40), pdfFont)
markupAnnotation.TextMarkupColor = New PdfColor(Color.BlueViolet)
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight
'Add this annotation to a new page.
page.Annotations.Add(markupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
Constructors
PdfTextMarkupAnnotation()
Initializes new instance of PdfTextMarkupAnnotation class.
Declaration
public PdfTextMarkupAnnotation()
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create PDF font and font style .
Font font = new Font("Calibri", 10, FontStyle.Bold);
PdfFont pdfFont = new PdfTrueTypeFont(font, false);
//Create a new PDF brush.
PdfBrush pdfBrush = new PdfSolidBrush(Color.Black);
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, new PointF(150, 10));
string markupText = "Text Markup";
SizeF size = pdfFont.MeasureString(markupText);
RectangleF rectangle = new RectangleF(175, 40, size.Width, size.Height);
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle);
//Create a pdf text markup annotation .
PdfTextMarkupAnnotation markupAnnotation = new PdfTextMarkupAnnotation();
markupAnnotation.Text = "Text Markup annotation";
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight;
//Add this annotation to a new page.
page.Annotations.Add(markupAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create pdf font and font style .
Dim font As New Font("Calibri", 10, FontStyle.Bold)
Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, False)
'Create a new PDF brush.
Dim pdfBrush As PdfBrush = New PdfSolidBrush(Color.Black)
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, New PointF(150, 10))
Dim markupText As String = "Text Markup"
Dim size As SizeF = pdfFont.MeasureString(markupText)
Dim rectangle As New RectangleF(175, 40, size.Width, size.Height)
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle)
'Create a pdf text markup annotation .
Dim markupAnnotation As New PdfTextMarkupAnnotation()
markupAnnotation.Text = "Text Markup annotation"
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight
'Add this annotation to a new page.
page.Annotations.Add(markupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also
PdfTextMarkupAnnotation(RectangleF)
Initializes new instance of PdfTextMarkupAnnotation class with specified bounds.
Declaration
public PdfTextMarkupAnnotation(RectangleF rectangle)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rectangle | The bounds of the annotation. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create PDF font and font style .
PdfFont pdfFont = new PdfStandardFont(PdfFontFamily.Helvetica, fontSize);
//Create a new PDF brush.
PdfBrush pdfBrush = new PdfSolidBrush(Color.Black);
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, new PointF(150, 10));
string markupText = "Text Markup";
SizeF size = pdfFont.MeasureString(markupText);
RectangleF rectangle = new RectangleF(175, 40, size.Width, size.Height);
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle);
//Create a pdf text markup annotation .
PdfTextMarkupAnnotation markupAnnotation = new PdfTextMarkupAnnotation(rectangle);
markupAnnotation.TextMarkupColor = new PdfColor(Color.BlueViolet);
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight;
//Add this annotation to a new page.
page.Annotations.Add(markupAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create pdffont and pdffont style .
Dim pdfFont As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, fontSize)
'Create a new pdfbrush .
Dim pdfBrush As PdfBrush = New PdfSolidBrush(Color.Black)
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, New PointF(150, 10))
Dim markupText As String = "Text Markup"
Dim size As SizeF = pdfFont.MeasureString(markupText)
Dim rectangle As New RectangleF(175, 40, size.Width, size.Height)
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle)
'Create a pdf text markup annotation .
Dim markupAnnotation As New PdfTextMarkupAnnotation(rectangle)
markupAnnotation.TextMarkupColor = New PdfColor(Color.BlueViolet)
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight
'Add this annotation to a new page.
page.Annotations.Add(markupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also
PdfTextMarkupAnnotation(String, String, String, PointF, PdfFont)
Initializes new instance of PdfTextMarkupAnnotation class with specified title, markup text, annotation text and font.
Declaration
public PdfTextMarkupAnnotation(string markupTitle, string text, string markupText, PointF point, PdfFont pdfFont)
Parameters
Type | Name | Description |
---|---|---|
System.String | markupTitle | The markup annotation title. |
System.String | text | The string specifies the text of the annotation. |
System.String | markupText | The string specifies the markup text of the annotation. |
System.Drawing.PointF | point | The location of the markup text annotation. |
PdfFont | pdfFont | The PdfFont specifies the text appearance of the markup text annotation. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create PDF font and font style .
Font font = new Font("Calibri", 10, FontStyle.Bold);
PdfFont pdfFont = new PdfTrueTypeFont(font, false);
//Create a new PDF brush.
PdfBrush pdfBrush = new PdfSolidBrush(Color.Black);
//Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, new PointF(150, 10));
string markupText = "Text Markup";
SizeF size = pdfFont.MeasureString(markupText);
RectangleF rectangle = new RectangleF(175, 40, size.Width, size.Height);
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle);
//Create a pdf text markup annotation.
PdfTextMarkupAnnotation markupAnnotation = new PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, new PointF(175, 40), pdfFont);
markupAnnotation.TextMarkupColor = new PdfColor(Color.BlueViolet);
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight;
//Add this annotation to a new page.
page.Annotations.Add(markupAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create PDF font and font style .
Dim font As New Font("Calibri", 10, FontStyle.Bold)
Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, False)
'Create a new PDF brush.
Dim pdfBrush As PdfBrush = New PdfSolidBrush(Color.Black)
'Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, New PointF(150, 10))
Dim markupText As String = "Text Markup"
Dim size As SizeF = pdfFont.MeasureString(markupText)
Dim rectangle As New RectangleF(175, 40, size.Width, size.Height)
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle)
'Create a pdf text markup annotation.
Dim markupAnnotation As New PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, New PointF(175, 40), pdfFont)
markupAnnotation.TextMarkupColor = New PdfColor(Color.BlueViolet)
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight
'Add this annotation to a new page.
page.Annotations.Add(markupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also
Properties
BoundsCollection
Gets or sets text markup bounds collection.
Declaration
public List<RectangleF> BoundsCollection { get; set; }
Property Value
Type |
---|
System.Collections.Generic.List<System.Drawing.RectangleF> |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create pdf font and pdf font style .
Font font = new Font("Calibri", 10, FontStyle.Bold);
PdfFont pdfFont = new PdfTrueTypeFont(font, false);
//Create a new PdfBrush.
PdfBrush pdfBrush = new PdfSolidBrush(Color.Black);
//Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, new PointF(150, 10));
string markupText = "Text Markup";
SizeF size = pdfFont.MeasureString(markupText);
RectangleF rectangle = new RectangleF(175, 40, size.Width, size.Height);
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle);
//Create a pdf text markup annotation .
PdfTextMarkupAnnotation markupAnnotation = new PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, new PointF(175, 40), pdfFont);
markupAnnotation.TextMarkupColor = new PdfColor(Color.BlueViolet);
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight;
List<RectangleF> bounds = new List<RectangleF>() { new RectangleF(200, 100, 60, 30), new RectangleF(100, 400, 60, 30) };
markupAnnotation.BoundsCollection = bounds;
//Add this annotation to a new page.
page.Annotations.Add(markupAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create PDF font and font style .
Dim font As New Font(Calibri", 10, FontStyle.Bold)
Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, False)
'Create a new PdfBrush.
Dim pdfBrush As PdfBrush = New PdfSolidBrush(Color.Black)
'Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, New PointF(150, 10))
Dim markupText As String = "Text Markup"
Dim size As SizeF = pdfFont.MeasureString(markupText)
Dim rectangle As New RectangleF(175, 40, size.Width, size.Height)
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle)
'Create a PDF text markup annotation .
Dim markupAnnotation As New PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, New PointF(175, 40), pdfFont)
markupAnnotation.TextMarkupColor = New PdfColor(Color.BlueViolet)
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight
Dim bounds As List(Of RectangleF) = New List(Of RectangleF)() From { New RectangleF(200, 100, 60, 30), New RectangleF(100, 400, 60, 30)}
markupAnnotation.BoundsCollection = bounds
'Add this annotation to a new page.
page.Annotations.Add(markupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also
Comments
Gets the annotation comments
Declaration
public PdfPopupAnnotationCollection Comments { get; }
Property Value
Type |
---|
PdfPopupAnnotationCollection |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create PDF font and PDF font style .
Font font = new Font("Calibri", 10, FontStyle.Bold);
PdfFont pdfFont = new PdfTrueTypeFont(font, false);
//Create a new pdf brush.
PdfBrush pdfBrush = new PdfSolidBrush(Color.Black);
//Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, new PointF(150, 10));
string markupText = "Text Markup";
SizeF size = pdfFont.MeasureString(markupText);
RectangleF rectangle = new RectangleF(175, 40, size.Width, size.Height);
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle);
//Create a pdf text markup annotation .
PdfTextMarkupAnnotation markupAnnotation = new PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, new PointF(175, 40), pdfFont);
markupAnnotation.TextMarkupColor = new PdfColor(Color.BlueViolet);
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight;
PdfPopupAnnotation popupComments = new PdfPopupAnnotation();
popupComments.Author = "TestAuthor";
popupComments.Text = "Test Text";
markupAnnotation.Comments.Add(popupComments);
//Get annotation comments
PdfPopupAnnotationCollection commentsCollection = markupAnnotation.Comments;
//Saves the document to disk.
document.Save("Output.pdf");
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim font As Font = New Font("Calibri", 10, FontStyle.Bold)
Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, false)
Dim pdfBrush As PdfBrush = New PdfSolidBrush(Color.Black)
'Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, New PointF(150, 10))
Dim markupText As String = "Text Markup"
Dim size As SizeF = pdfFont.MeasureString(markupText)
Dim rectangle As RectangleF = New RectangleF(175, 40, size.Width, size.Height)
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle)
Dim markupAnnotation As PdfTextMarkupAnnotation = New PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, New PointF(175, 40), pdfFont)
markupAnnotation.TextMarkupColor = New PdfColor(Color.BlueViolet)
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight
Dim popupComments As PdfPopupAnnotation = New PdfPopupAnnotation
popupComments.Author = "TestAuthor"
popupComments.Text = "Test Text"
markupAnnotation.Comments.Add(popupComments)
Dim commentsCollection As PdfPopupAnnotationCollection = markupAnnotation.Comments
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
ReviewHistory
Gets the annotation reviews
Declaration
public PdfPopupAnnotationCollection ReviewHistory { get; }
Property Value
Type |
---|
PdfPopupAnnotationCollection |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create PDF font and PDF font style .
Font font = new Font("Calibri", 10, FontStyle.Bold);
PdfFont pdfFont = new PdfTrueTypeFont(font, false);
//Create a new pdf brush.
PdfBrush pdfBrush = new PdfSolidBrush(Color.Black);
//Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, new PointF(150, 10));
string markupText = "Text Markup";
SizeF size = pdfFont.MeasureString(markupText);
RectangleF rectangle = new RectangleF(175, 40, size.Width, size.Height);
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle);
//Create a pdf text markup annotation .
PdfTextMarkupAnnotation markupAnnotation = new PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, new PointF(175, 40), pdfFont);
markupAnnotation.TextMarkupColor = new PdfColor(Color.BlueViolet);
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight;
// set review state
PdfPopupAnnotation popup = new PdfPopupAnnotation();
popup.State = PdfAnnotationState.Accepted;
popup.StateModel = PdfAnnotationStateModel.Review;
popup.Text = "Hello PDF Comments";
markupAnnotation.ReviewHistory.Add(popup);
//Get Review history
PdfPopupAnnotationCollection reviewCollection = markupAnnotation.ReviewHistory;
//Saves the document to disk.
document.Save("Output.pdf");
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim font As Font = New Font("Calibri", 10, FontStyle.Bold)
Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, false)
Dim pdfBrush As PdfBrush = New PdfSolidBrush(Color.Black)
'Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, New PointF(150, 10))
Dim markupText As String = "Text Markup"
Dim size As SizeF = pdfFont.MeasureString(markupText)
Dim rectangle As RectangleF = New RectangleF(175, 40, size.Width, size.Height)
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle)
Dim markupAnnotation As PdfTextMarkupAnnotation = New PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, New PointF(175, 40), pdfFont)
markupAnnotation.TextMarkupColor = New PdfColor(Color.BlueViolet)
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight
Dim popup As PdfPopupAnnotation = New PdfPopupAnnotation
popup.State = PdfAnnotationState.Accepted
popup.StateModel = PdfAnnotationStateModel.Review
popup.Text = "Hello PDF Comments"
markupAnnotation.ReviewHistory.Add(popup)
Dim reviewCollection As PdfPopupAnnotationCollection = markupAnnotation.ReviewHistory
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
TextMarkupAnnotationType
Gets or sets TextMarkupAnnotationType.
Declaration
public PdfTextMarkupAnnotationType TextMarkupAnnotationType { get; set; }
Property Value
Type | Description |
---|---|
PdfTextMarkupAnnotationType | The TextMarkupAnnotationType enumeration value which contains the different types of mark up annotation types. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create PDF font and font style .
Font font = new Font("Calibri", 10, FontStyle.Bold);
PdfFont pdfFont = new PdfTrueTypeFont(font, false);
//Create a new PDF brush.
PdfBrush pdfBrush = new PdfSolidBrush(Color.Black);
//Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, new PointF(150, 10));
string markupText = "Text Markup";
SizeF size = pdfFont.MeasureString(markupText);
RectangleF rectangle = new RectangleF(175, 40, size.Width, size.Height);
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle);
//Create a PDF text markup annotation .
PdfTextMarkupAnnotation markupAnnotation = new PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, new PointF(175, 40), pdfFont);
markupAnnotation.TextMarkupColor = new PdfColor(Color.BlueViolet);
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight;
//Add this annotation to a new page.
page.Annotations.Add(markupAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create pdf font and pdf font style .
Dim font As New Font("Calibri", 10, FontStyle.Bold)
Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, False)
'Create a new PdfBrush.
Dim pdfBrush As PdfBrush = New PdfSolidBrush(Color.Black)
'Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, New PointF(150, 10))
Dim markupText As String = "Text Markup"
Dim size As SizeF = pdfFont.MeasureString(markupText)
Dim rectangle As New RectangleF(175, 40, size.Width, size.Height)
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle)
'Create a pdf text markup annotation .
Dim markupAnnotation As New PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, New PointF(175, 40), pdfFont)
markupAnnotation.TextMarkupColor = New PdfColor(Color.BlueViolet)
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight
'Add this annotation to a new page.
page.Annotations.Add(markupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also
TextMarkupColor
Gets or sets text markup color.
Declaration
public PdfColor TextMarkupColor { get; set; }
Property Value
Type | Description |
---|---|
PdfColor | The PdfColor draws the outline of the annotation. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create pdf font and pdf font style .
Font font = new Font("Calibri", 10, FontStyle.Bold);
PdfFont pdfFont = new PdfTrueTypeFont(font, false);
//Create a new PdfBrush.
PdfBrush pdfBrush = new PdfSolidBrush(Color.Black);
//Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, new PointF(150, 10));
string markupText = "Text Markup";
SizeF size = pdfFont.MeasureString(markupText);
RectangleF rectangle = new RectangleF(175, 40, size.Width, size.Height);
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle);
//Create a pdf text markup annotation .
PdfTextMarkupAnnotation markupAnnotation = new PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, new PointF(175, 40), pdfFont);
markupAnnotation.TextMarkupColor = new PdfColor(Color.BlueViolet);
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight;
//Add this annotation to a new page.
page.Annotations.Add(markupAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create PDF font and font style .
Dim font As New Font(Calibri", 10, FontStyle.Bold)
Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, False)
'Create a new PdfBrush.
Dim pdfBrush As PdfBrush = New PdfSolidBrush(Color.Black)
'Draw text in the new page.
page.Graphics.DrawString("Text Markup Annotation Demo", pdfFont, pdfBrush, New PointF(150, 10))
Dim markupText As String = "Text Markup"
Dim size As SizeF = pdfFont.MeasureString(markupText)
Dim rectangle As New RectangleF(175, 40, size.Width, size.Height)
page.Graphics.DrawString(markupText, pdfFont, pdfBrush, rectangle)
'Create a PDF text markup annotation .
Dim markupAnnotation As New PdfTextMarkupAnnotation("Markup annotation", "Markup annotation with highlight style", markupText, New PointF(175, 40), pdfFont)
markupAnnotation.TextMarkupColor = New PdfColor(Color.BlueViolet)
markupAnnotation.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight
'Add this annotation to a new page.
page.Annotations.Add(markupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also
Methods
Initialize()
Initializes Annotation object.
Declaration
protected override void Initialize()
Overrides
Save()
Saves an Text Markup Annotation .
Declaration
protected override void Save()