New to Telerik UI for .NET MAUI? Start a free 30-day trial
Displaying Semi-Transparent Watermarks in .NET MAUI PDF Viewer
Updated on Mar 27, 2026
Environment
| Version | Product | Author |
|---|---|---|
| 13.0.0 | Telerik UI for .NET MAUI PDF Viewer | Dobrinka Yordanova |
Description
When displaying PDF documents in the PDFViewer component for UI for .NET MAUI, watermarks with transparency may appear as solid colors. This happens because the component does not automatically render semi-transparent watermarks.
This knowledge base article also answers the following questions:
- How to enable transparency for watermarks in MAUI PDF Viewer?
- Why does the watermark appear solid in MAUI PDF Viewer?
- How to modify watermark transparency in .NET MAUI PDF Viewer?
Solution
To display semi-transparent watermarks in the PDF Viewer, implement the following steps:
- Subscribe to the
RadPdfViewer.PageElementsLoadedevent. - Enumerate the page's content elements.
- Identify
TextFragmentobjects that match the watermark text. - Set the fill color with transparency to the matching fragments.
Use the following XAML to define the PDFViewer and attach the PageElementsLoaded event.
xml
<telerik:RadPdfViewer x:Name="pdfViewer"
PageElementsLoaded="pdfViewer_PageElementsLoaded"/>
Define the PageElementsLoaded event handler and implement the logic to apply transparency to the watermark text.
csharp
private void pdfViewer_PageElementsLoaded(object sender, Telerik.Maui.Controls.PdfViewer.PageElementsLoadedEventArgs e)
{
UpdateWatermarkTransparency(e.Page);
}
private static void UpdateWatermarkTransparency(RadFixedPage fixedPage)
{
foreach (var contentElement in fixedPage.Content)
{
if (contentElement is Telerik.Windows.Documents.Fixed.Model.Text.TextFragment textBlock)
{
if (textBlock.Text.Contains("Watermark text!"))
{
// Set the fill color with transparency (e.g., 60% opacity red).
textBlock.Fill = new RgbColor(60, 255, 0, 0);
}
}
}
}