How can I help you?
Change the highlight color of the text in Blazor SfPdfViewer Component
12 Feb 20261 minute to read
Use the Color property of PdfViewerHighlightSettings to set the default highlight color for text markup highlights. This applies only to Highlight annotations; other text-markup types (such as Underline or Strikethrough) use their own settings.
The following example shows how to set the highlight color.
@using Syncfusion.Blazor.Buttons
@using Syncfusion.Blazor.SfPdfViewer
<!--Render simple PDF Viewer with customized highlight options-->
<SfPdfViewer2 @ref="PDFViewer"
DocumentPath="@DocumentPath">
<PdfViewerHighlightSettings Color="@highlightColor">
</PdfViewerHighlightSettings>
</SfPdfViewer2>
@code{
SfPdfViewer2 PDFViewer;
//Sets the PDF document path for initial loading.
private string DocumentPath { get; set; } = "Data/PDF_Succinctly.pdf";
//Defines the color for text markup annotations like highlight.
private string highlightColor = "Green";
}