PdfTextMarkupAnnotation constructor
PdfTextMarkupAnnotation(})
Initializes new instance of PdfTextMarkupAnnotation class with bounds, text, color, author, subject, modifiedDate, boundsCollection, flags and textMarkupAnnotationType.
//Create a new PDF document.
final PdfDocument document = PdfDocument();
//Create a new page.
final PdfPage page = document.pages.add();
//Create PDF font with font style.
final PdfFont font =
PdfStandardFont(PdfFontFamily.courier, 10, style: PdfFontStyle.bold);
const String markupText = 'Text Markup';
final Size textSize = font.measureString(markupText);
page.graphics.drawString(markupText, font,
brush: PdfBrushes.black, bounds: const Rect.fromLTWH(175, 40, 0, 0));
//Create a text markup annotation.
final PdfTextMarkupAnnotation markupAnnotation = PdfTextMarkupAnnotation(
Rect.fromLTWH(175, 40, textSize.width, textSize.height),
'Markup annotation',
PdfColor(128, 43, 226));
markupAnnotation.author = 'MarkUp';
markupAnnotation.textMarkupAnnotationType =
PdfTextMarkupAnnotationType.highlight;
//Adds the annotation to the page
page.annotations.add(markupAnnotation);
final List<int> bytes = document.saveSync();
document.dispose();
Implementation
PdfTextMarkupAnnotation(Rect bounds, String text, PdfColor color,
{String? author,
String? subject,
double? opacity,
DateTime? modifiedDate,
bool? setAppearance,
List<Rect>? boundsCollection,
List<PdfAnnotationFlags>? flags,
PdfTextMarkupAnnotationType? textMarkupAnnotationType}) {
_helper = PdfTextMarkupAnnotationHelper(
this,
bounds,
text,
color,
author,
subject,
opacity,
modifiedDate,
setAppearance,
flags,
textMarkupAnnotationType);
if (boundsCollection != null) {
this.boundsCollection = boundsCollection;
}
}