
Syncfusion Maui Pdf Viewer
- 1 installs
- 1 repo stars
- Updated July 6, 2026
- syncfusion/pdf-viewer-sdk-skills
Implements and customizes the Syncfusion .NET MAUI SfPdfViewer for cross-platform PDF viewing, annotations, form filling, e-signatures, redaction, and printing.
About
Generates code to set up and customize the Syncfusion .NET MAUI SfPdfViewer with navigation, annotations, form fields, signatures, redaction, and printing. A developer uses it when building cross-platform PDF workflows in MAUI apps.
- Covers SfPdfViewer setup, annotations, form filling, and signature workflows
- Includes a built-in customizable toolbar
Syncfusion Maui Pdf Viewer by the numbers
- 1 all-time installs (skills.sh)
- Ranked #959 of 1,039 Mobile Development skills by installs in the Skillselion catalog
- Data as of Jul 8, 2026 (Skillselion catalog sync)
npx skills add https://github.com/syncfusion/pdf-viewer-sdk-skills --skill syncfusion-maui-pdf-viewerAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 1 |
| Last updated | July 6, 2026 |
| Repository | syncfusion/pdf-viewer-sdk-skills ↗ |
What it does
Implements and customizes the Syncfusion .NET MAUI SfPdfViewer for cross-platform PDF viewing, annotations, form filling, e-signatures, redaction, and printing.
Files
Implementing .NET MAUI PDF Viewer
A comprehensive skill for implementing and customizing the Syncfusion .NET MAUI PDF Viewer (SfPdfViewer) control. The PDF Viewer provides powerful document viewing and management capabilities including navigation, annotations, form filling, text operations, signatures, redaction, and printing with a built-in customizable toolbar.
When to Use This Skill
Use this skill when you need to:
- View and navigate PDF documents in .NET MAUI applications
- Load PDF documents from application‑provided streams or byte arrays.
- Unload documents to release memory and resources (synchronous/asynchronous methods)
- Add and manage annotations (ink, shapes, stamps, text markups, sticky notes)
- Fill and validate PDF form fields; import/export form data (XFDF, FDF, JSON, XML)
- Search and select text within PDF documents
- Add electronic signatures (handwritten, image-based, text)
- Redact sensitive content permanently
- Print PDF documents with quality settings
- Customize toolbars, appearance, and localization
- Migrate from Xamarin.Forms PDF Viewer to .NET MAUI
Component Overview
SfPdfViewer is a comprehensive PDF viewing and management control for .NET MAUI with these capabilities:
- Document Management: Load with password support, unload (sync/async) for memory management, save with flattening, print with quality settings
- Annotations: Ink, shapes, stamps, sticky notes, text markups, free text, eraser with full editing support
- Forms & Text: All AcroForm types, validation, import/export (XFDF/FDF/JSON/XML), async search, text selection
- Signatures & Redaction: Electronic signatures (handwritten/image/text), text/area/page-based redaction
- Navigation & UI: Page layouts, zoom, bookmarks, hyperlinks, customizable toolbar (desktop/mobile), localization, RTL, liquid glass effect
Documentation and Navigation Guide
Getting Started & Setup
📄 Read: references/basic-sample.md
- Installation, NuGet package, and handler registration (ConfigureSyncfusionCore)
- Basic PDF Viewer implementation (XAML & C#), DocumentSource binding
- Loading PDFs from different sources and platform-specific setup
Document Operations
📄 Read: references/document-operations.md
- Loading PDFs with password support
- Unloading documents (UnloadDocument, UnloadDocumentAsync) for proper memory management
- Saving with modifications and annotation flattening
- Printing with quality settings and page range selection
Annotations
📄 Read: references/annotations.md
- Adding/removing annotations (AddAnnotation, RemoveAnnotation)
- Ink, shapes, stamps, sticky notes, text markups, free text, ink eraser
- Annotation properties (color, opacity, bounds, stroke, rotation) and events
Form Fields
📄 Read: references/form-fields.md
- Viewing, accessing, and filling all AcroForm field types
- Field validation, import/export (XFDF, FDF, JSON, XML), flattening
- Form field events and interaction handling
Navigation & Viewing
📄 Read: references/viewing.md
- Page navigation (GoToPage, PageNumber), layout modes (Single, Continuous)
- Bookmarks, hyperlinks, zoom (ZoomMode, ZoomFactor), FitMode options
- Coordinate conversion (PageToClient, ClientToPage)
Text Search
📄 Read: references/text-search.md
- Async text search (SearchTextAsync), match navigation (GoToNextMatch, GoToPreviousMatch)
- Search highlighting, case-sensitive/whole-word options, custom search UI
Text Selection
📄 Read: references/text-selection.md
- Enabling text selection, SelectedText property, clipboard copy
- Selection customization (colors, opacity), TextSelectionChanged event
Electronic Signatures
📄 Read: references/electronic-signature.md
- Handwritten, image-based, and text signatures
- Signature field management, appearance customization, validation workflows
Redaction
📄 Read: references/redaction.md
- Text/area/page-based redaction (RedactText, RedactArea, RedactPage)
- Permanent content removal, appearance customization, saving redacted documents
Toolbar Customization
📄 Read: references/toolbar-customization.md
- Desktop vs mobile toolbar layouts
- Add/remove/hide/reorder toolbar items, AnnotationToolbarItemClicked event
- Custom toolbar creation and visibility control
UI Settings & Localization
📄 Read: references/ui-settings.md
- Localization, FlowDirection for RTL layouts, culture-specific formatting
- Liquid glass effect, theme customization, platform-specific UI adjustments
Gesture Events & Interaction
📄 Read: references/gesture-events.md
- DocumentTapped event with PageNumber and Position
- Touch gesture handling, custom interactions, event-driven workflows
Migration from Xamarin
📄 Read: references/migration-xamarin-to-maui.md
- API differences, property/method mappings, namespace changes
- Handler registration differences, breaking changes, migration checklist
Syncfusion .NET MAUI PDF Viewer — Skill
Overview
The syncfusion-maui-pdf-viewer skill enables AI-assisted code generation for the Syncfusion .NET MAUI SfPdfViewer. It produces minimal, copy-pasteable C# and XAML code to embed, configure, and interact with PDF documents inside cross-platform .NET MAUI applications.
---
Compatibility
| Requirement | Version |
|---|---|
| .NET | .NET 6, 7, 8, 9 or later |
| Target Platforms | Android, iOS, Windows, macOS |
| Visual Studio | 2022 (17.0 or later) |
| Package Manager | NuGet |
---
Skill Structure
syncfusion-maui-pdf-viewer/
├── SKILL.md # Skill rules, routing, and code generation guidelines
├── README.md # This file
└── references/
├── basic-sample.md # Minimal setup, handler registration, document loading
├── viewing.md # Page layouts, zoom modes, fit modes, bookmarks, hyperlinks
├── document-operations.md # Load with password, unload (memory mgmt), save, print
├── annotations.md # Ink, shapes, stamps, sticky notes, text markups, free text
├── form-fields.md # AcroForm support, validation, import/export (XFDF/FDF/JSON/XML)
├── text-search.md # Async text search, match navigation, highlighting
├── text-selection.md # Enable selection, SelectedText property, customization
├── electronic-signature.md # Handwritten, image, text signatures
├── redaction.md # Text/area/page-based redaction, permanent removal
├── toolbar-customization.md # Desktop/mobile layouts, add/remove/reorder items
├── ui-settings.md # Localization, RTL, liquid glass, theme customization
├── gesture-events.md # DocumentTapped event, touch handling
└── migration-xamarin-to-maui.md # Xamarin.Forms to MAUI migration guide---
Quick Start
1. Install NuGet Package
Syncfusion.Maui.PdfViewer2. Register Syncfusion Core Handler (MauiProgram.cs)
using Syncfusion.Maui.Core.Hosting;
builder.ConfigureSyncfusionCore();
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR_LICENSE_KEY");3. Add SfPdfViewer to XAML (MainPage.xaml)
<ContentPage xmlns:syncfusion="clr-namespace:Syncfusion.Maui.PdfViewer;assembly=Syncfusion.Maui.PdfViewer">
<syncfusion:SfPdfViewer x:Name="pdfViewer" />
</ContentPage>4. Load a PDF Document
Option A: From Embedded Resource (Recommended)
1. Add PDF to Assets folder in your project 2. Set Build Action to Embedded Resource 3. Load in code:
using System.Reflection;
Stream stream = typeof(App).GetTypeInfo().Assembly
.GetManifestResourceStream("PdfViewerExample.Assets.sample.pdf");
pdfViewer.DocumentSource = stream;Option B: From File Picker
private async Task LoadPdfFromFileSystem()
{
var result = await FilePicker.PickAsync(new PickOptions
{
PickerTitle = "Select a PDF file"
});
if (result != null)
{
Stream stream = await result.OpenReadAsync();
pdfViewer.DocumentSource = stream;
}
}5. Run the Application
Press F5 to build and run. The PDF will be displayed with the built-in toolbar.
---
Reference File Routing
Use the table below to find the correct reference file for any feature request.
Core Setup & Document Loading
| Reference File | Use When … |
|---|---|
basic-sample.md | Initial setup, handler registration, XAML declaration, DocumentSource binding |
document-operations.md | Loading with password, unloading (memory management), saving with flattening, printing |
Navigation & Viewing
| Reference File | Use When … |
|---|---|
viewing.md | Page navigation, layout modes (Single, Continuous), bookmarks, hyperlinks, zoom, FitMode |
Text Operations
| Reference File | Use When … |
|---|---|
text-search.md | Async text search, match navigation (GoToNextMatch, GoToPreviousMatch), highlighting, custom UI |
text-selection.md | Enable text selection, SelectedText property, clipboard copy, selection customization |
Annotations
| Reference File | Use When … |
|---|---|
annotations.md | Ink, shapes, stamps, sticky notes, text markups, free text, eraser; annotation properties and events |
Forms & Signatures
| Reference File | Use When … |
|---|---|
form-fields.md | Viewing, filling, validating form fields; import/export (XFDF, FDF, JSON, XML); flattening |
electronic-signature.md | Handwritten, image-based, text signatures; signature field management, validation |
Security & Redaction
| Reference File | Use When … |
|---|---|
redaction.md | Redacting text, areas, or pages; permanent content removal, appearance customization |
UI Customization
| Reference File | Use When … |
|---|---|
toolbar-customization.md | Desktop vs mobile toolbars, add/remove/hide/reorder items, AnnotationToolbarItemClicked event |
ui-settings.md | Localization, FlowDirection (RTL), liquid glass effect, theme customization |
Advanced Features
| Reference File | Use When … |
|---|---|
gesture-events.md | DocumentTapped event with page number and position, custom touch interactions |
migration-xamarin-to-maui.md | Migrating from Xamarin.Forms to MAUI, API differences, breaking changes |
---
Available Services
The PDF Viewer includes comprehensive features through its built-in services:
| Service | Purpose |
|---|---|
| Viewing | Page navigation, zoom, layout modes (Single, Continuous) |
| Annotations | Ink, shapes, stamps, sticky notes, text markups, free text |
| Forms | Fill, validate, import/export form data (XFDF, FDF, JSON, XML) |
| Text Operations | Async search, text selection, clipboard copy |
| Signatures | Handwritten, image-based, text signatures |
| Redaction | Permanent content removal |
| Toolbar | Customizable desktop/mobile layouts |
---
Example Prompts
"Show me how to set up SfPdfViewer in .NET MAUI"
- "How do I navigate to a specific page number?"
- "How do I search for text in a PDF asynchronously?"
- "How do I add an ink annotation to the PDF?"
- "How do I fill a form field programmatically?"
---
Metadata
| Field | Value |
|---|---|
| Skill Name | syncfusion-maui-pdf-viewer |
| Author | Syncfusion Inc |
| Version | 1.0.0 |
| Category | Document Viewing |
| Framework | .NET MAUI (Multi-platform App UI) |
| Target Platforms | Android, iOS, Windows, macOS |
| Reference Files | 13 |
---
License
Syncfusion .NET MAUI components require a commercial license for production use. A free community license is available for qualifying organizations and individuals.
Annotations
This guide demonstrates how to add, view, and manage all annotation types including Ink, Ink Eraser, Free Text, Shapes, Stamps, Sticky Notes, Text Markups, and common operations.
Table of Contents
Common Operations
Annotation Collection
// Access after DocumentLoaded
ReadOnlyObservableCollection<Annotation> annotations = PdfViewer.Annotations;Add Annotation Programmatically
RectF bounds = new RectF(10, 10, 100, 100);
CircleAnnotation circle = new CircleAnnotation(bounds, pageNumber: 1);
circle.Color = Colors.Red; circle.FillColor = Colors.Green;
circle.BorderWidth = 2; circle.Opacity = 0.75f;
PdfViewer.AddAnnotation(circle);Remove Annotation
PdfViewer.RemoveAnnotation(PdfViewer.Annotations[0]); // specific
PdfViewer.RemoveAllAnnotations(); // allEdit Annotation
Annotation annotation = PdfViewer.Annotations[0];
annotation.Color = Colors.Green; annotation.Opacity = 0.75f;
if (annotation is CircleAnnotation ca)
{ ca.FillColor = Colors.Red; ca.BorderWidth = 2; ca.Bounds = new RectF(10, 10, 100, 100); }Select / Deselect
PdfViewer.SelectAnnotation(PdfViewer.Annotations[0]);
PdfViewer.DeselectAnnotation(annotation);
PdfViewer.AnnotationSettings.Selector.Color = Colors.Blue;
PdfViewer.AnnotationSettings.Selector.LockedColor = Colors.LightGray;Lock / Unlock
PdfViewer.AnnotationSettings.IsLocked = true; // lock all
PdfViewer.Annotations[0].IsLocked = true; // lock one
PdfViewer.AnnotationSettings.Circle.IsLocked = true; // lock by typeUndo / Redo
XAML:
<Button Text="Undo" Command="{Binding Source={x:Reference PdfViewer}, Path=UndoCommand}" />
<Button Text="Redo" Command="{Binding Source={x:Reference PdfViewer}, Path=RedoCommand}" />Code:
PdfViewer.UndoCommand.Execute(null);
PdfViewer.RedoCommand.Execute(null);Cannot undo:SaveDocumentAsync,RedactAsync, orUnloadDocument.
Show / Hide
foreach (var a in PdfViewer.Annotations) a.Hidden = true; // hide all
foreach (var a in PdfViewer.Annotations) a.Hidden = false; // show all
foreach (var a in PdfViewer.Annotations)
if (a.Author == "SpecificAuthor") a.Hidden = true; // hide by authorLocked annotations cannot be hidden. Hidden annotations excluded from import, export, print, and save.
Import / Export
// Import
Stream xfdf = File.OpenRead(Path.Combine(FileSystem.Current.AppDataDirectory, "AnnotationsInfo.xfdf"));
PdfViewer.ImportAnnotations(xfdf, Syncfusion.Pdf.Parsing.AnnotationDataFormat.XFdf);
// Export all
FileStream fs = File.Create(Path.Combine(FileSystem.Current.AppDataDirectory, "ExportedFile.xfdf"));
PdfViewer.ExportAnnotations(fs, Syncfusion.Pdf.Parsing.AnnotationDataFormat.XFdf);
// Export specific
PdfViewer.ExportAnnotations(fs, Syncfusion.Pdf.Parsing.AnnotationDataFormat.XFdf, annotationList);Events
PdfViewer.AnnotationsLoaded += (s, e) => { /* all annotations loaded */ };
PdfViewer.AnnotationAdded += (s, e) => { Annotation a = e.Annotation; };
PdfViewer.AnnotationRemoved += (s, e) => { Annotation a = e.Annotation; };
PdfViewer.AnnotationEdited += (s, e) => { Annotation a = e.Annotation; };
PdfViewer.AnnotationSelected += (s, e) => { e.Annotation.Color = Colors.Blue; };
PdfViewer.AnnotationDeselected += (s, e) => { Annotation a = e.Annotation; };Comments
PdfViewer.IsCommentsPanelVisible = true;
PdfViewer.Annotations[0].Comments.Add(new Comment
{ Text = "Review this.", Author = "User", ModifiedDate = DateTime.Now });---
Annotation Types
Ink
PdfViewer.AnnotationMode = AnnotationMode.Ink;
PdfViewer.AnnotationMode = AnnotationMode.None; // disable
InkAnnotationSettings ink = PdfViewer.AnnotationSettings.Ink;
ink.Color = Colors.Blue; ink.BorderWidth = 2; ink.Opacity = 0.75f;
ink.AggregateInkStrokes = false; // each stroke = separate annotation
ink.TouchScreenInputMode = TouchScreenInputMode.Stylus; // stylus only
List<List<float>> pts = new() { new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 } };
InkAnnotation inkA = new InkAnnotation(pts, pageNumber: 1);
inkA.Color = Colors.Red; inkA.BorderWidth = 2; inkA.Opacity = 0.75f;
PdfViewer.AddAnnotation(inkA);
if (selected is InkAnnotation ia) { ia.Color = Colors.Blue; ia.BorderWidth = 1; }---
Ink Eraser
PdfViewer.AnnotationMode = AnnotationMode.InkEraser;
PdfViewer.AnnotationMode = AnnotationMode.None; // disable
PdfViewer.AnnotationSettings.InkEraser.Thickness = 50; // default 40
PdfViewer.AnnotationSettings.Ink.TouchScreenInputMode = TouchScreenInputMode.Stylus;Only ink annotations are erased. Supports undo/redo.
---
Free Text
PdfViewer.AnnotationMode = AnnotationMode.FreeText;
PdfViewer.AnnotationMode = AnnotationMode.None;
FreeTextAnnotationSettings ft = PdfViewer.AnnotationSettings.FreeText;
ft.Color = Colors.White; ft.FillColor = Colors.Black;
ft.BorderColor = Colors.Yellow; ft.BorderWidth = 2; ft.FontSize = 16; ft.Opacity = 0.75f;
FreeTextAnnotation fta = new FreeTextAnnotation("Free Text Annotation", pageNumber: 1, new RectF(100, 100, 100, 28));
fta.FontSize = 16; fta.BorderColor = Colors.Yellow; fta.BorderWidth = 4;
fta.Color = Colors.White; fta.FillColor = Colors.Black;
PdfViewer.AddAnnotation(fta);
if (selected is FreeTextAnnotation f)
{ f.Color = Colors.White; f.BorderWidth = 6; f.FillColor = Colors.Black; f.FontSize = 16; f.Text = "Modified"; }
// Modal view events (Android/iOS); set e.Cancel = true to use custom dialog
PdfViewer.FreeTextModalViewAppearing += (s, e) => { /* hide UI / e.Cancel = true */ };
PdfViewer.FreeTextModalViewDisappearing += (s, e) => { /* show UI */ };Desktop uses inline editing; mobile uses modal dialog. Set BorderWidth = 0 for borderless annotations.---
Shapes
Supported: Arrow, Circle, Line, Square, Polygon, Polyline, Cloud.
PdfViewer.AnnotationMode = AnnotationMode.Circle; // or Arrow/Line/Square/Polygon/Polyline
PdfViewer.AnnotationMode = AnnotationMode.None;
ShapeAnnotationSettings ss = PdfViewer.AnnotationSettings.Circle; // same for all types
ss.Color = Colors.Blue; ss.FillColor = Colors.Red; ss.BorderWidth = 2; ss.Opacity = 0.75f;
RectF b = new RectF(10, 10, 100, 100);
CircleAnnotation circleA = new CircleAnnotation(b, 1);
SquareAnnotation squareA = new SquareAnnotation(b, 1);
// LineAnnotation line = new LineAnnotation(startPoint, endPoint, 1);
PdfViewer.AddAnnotation(circleA);
// Polygon / Polyline — double-tap to finish drawing
List<PointF> polyPts = new() { new(10,10), new(100,10), new(100,100), new(10,100) };
PolygonAnnotation poly = new PolygonAnnotation(polyPts, 1);
poly.BorderStyle = BorderStyle.Cloudy; // Solid (default) or Cloudy — Square & Polygon only
PdfViewer.AddAnnotation(poly);
if (selected is CircleAnnotation ca2) { ca2.Color = Colors.Blue; ca2.BorderWidth = 1; }
if (selected is PolygonAnnotation pa) { pa.BorderStyle = BorderStyle.Cloudy; }---
Stamps
// Standard stamp — 18 built-in types:
// Approved, AsIs, Expired, NotApproved, NotForPublicRelease, Confidential, Departmental,
// ForComment, TopSecret, ForPublicRelease, Draft, Completed, Reviewed, etc.
StampAnnotation stdStamp = new StampAnnotation(StampType.Approved, pageNumber: 1, new PointF(100, 100));
PdfViewer.AddAnnotation(stdStamp);
// Custom stamp from image
Stream img = this.GetType().Assembly.GetManifestResourceStream("App.Assets.Logo.png");
StampAnnotation imgStamp = new StampAnnotation(img, pageNumber: 1, new RectF(50, 50, 200, 100));
PdfViewer.AddAnnotation(imgStamp);
// Custom stamp from MAUI View
var btn = new Button { Text = "Click Me", BackgroundColor = Colors.Blue };
StampAnnotation viewStamp = new StampAnnotation(btn, pageNumber: 1, new RectF(100, 100, 200, 100));
PdfViewer.AddAnnotation(viewStamp);
if (selected is StampAnnotation sa)
{
sa.Opacity = 0.75f;
if (sa.CustomStampView is Button b2) b2.Text = "Clicked"; // view-based stamps only
}
PdfViewer.CustomStampModalViewAppearing += (s, e) => { /* hide UI */ };
PdfViewer.CustomStampModalViewDisappearing += (s, e) => { /* show UI */ };Custom stamps from Views convert to images on save; interactions become read-only.
---
Sticky Notes
Supported icons: Comment, Note, Help, Key, NewParagraph, Paragraph, Insert.
PdfViewer.AnnotationMode = AnnotationMode.StickyNote;
PdfViewer.AnnotationMode = AnnotationMode.None;
StickyNoteAnnotationSettings sn = PdfViewer.AnnotationSettings.StickyNote;
sn.Icon = StickyNoteIcon.Comment; sn.Color = Colors.Yellow; sn.Opacity = 0.75f;
StickyNoteAnnotation sna = new StickyNoteAnnotation(
StickyNoteIcon.Comment, "Links are not working", pageNumber: 1, new PointF(100, 100));
PdfViewer.AddAnnotation(sna);
if (selected is StickyNoteAnnotation note)
{ note.Icon = StickyNoteIcon.Note; note.Text = "Changed to note."; }
// Modal view events (Android/iOS); set e.Cancel = true to use custom dialog
PdfViewer.StickyNoteModalViewAppearing += (s, e) => { /* hide UI / e.Cancel = true */ };
PdfViewer.StickyNoteModalViewDisappearing += (s, e) => { /* show UI */ };---
Text Markups
Supported: Highlight, Underline, Squiggly, Strikethrough.
PdfViewer.AnnotationMode = AnnotationMode.Highlight; // or Underline/Squiggly/Strikethrough
PdfViewer.AnnotationMode = AnnotationMode.None;
PdfViewer.AnnotationSettings.Highlight.Color = Colors.Yellow;
PdfViewer.AnnotationSettings.Highlight.Opacity = 0.75f;
PdfViewer.AnnotationSettings.Underline.Color = Colors.Green;
PdfViewer.AnnotationSettings.Squiggly.Color = Colors.Orange;
PdfViewer.AnnotationSettings.Strikethrough.Color = Colors.Red;
List<RectF> textBounds = new() { new RectF(100, 100, 100, 20) };
HighlightAnnotation ha = new HighlightAnnotation(pageNumber: 1, textBounds);
UnderlineAnnotation ua = new UnderlineAnnotation(pageNumber: 1, textBounds);
SquigglyAnnotation qa = new SquigglyAnnotation(pageNumber: 1, textBounds);
StrikethroughAnnotation sta = new StrikethroughAnnotation(pageNumber: 1, textBounds);
ha.Color = Colors.Yellow; ha.Opacity = 0.5f;
PdfViewer.AddAnnotation(ha);
if (selected is HighlightAnnotation h) { h.Color = Colors.Blue; h.Opacity = 0.75f; }Users can also select text and use the context menu to add markups without enabling annotation mode.
Basic PDF Viewer Setup - .NET MAUI
This guide demonstrates the minimal setup to initialize and display a PDF in SfPdfViewer.
---
Prerequisites
- .NET 9 SDK or later
- Visual Studio 2022 (v17.3 or later)
- Syncfusion.Maui.PdfViewer NuGet package installed
- Syncfusion.Maui.Core NuGet package (installed as dependency)
---
Step 1: Register Syncfusion Core Handler
Update MauiProgram.cs to register the Syncfusion core handler:
C#:
using Syncfusion.Maui.Core.Hosting;
namespace PdfViewerExample
{
public class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
// Register Syncfusion core handler
builder.ConfigureSyncfusionCore();
return builder.Build();
}
}
}---
Step 2: Add PDF Viewer to XAML
Add the SfPdfViewer control to MainPage.xaml:
XAML:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:syncfusion="clr-namespace:Syncfusion.Maui.PdfViewer;assembly=Syncfusion.Maui.PdfViewer"
x:Class="PdfViewerExample.MainPage">
<ContentPage.Content>
<syncfusion:SfPdfViewer x:Name="pdfViewer" />
</ContentPage.Content>
</ContentPage>---
Step 3: Create ViewModel for PDF Loading
Create PdfViewerViewModel.cs to handle PDF stream binding:
C#:
using System.Reflection;
using System.ComponentModel;
namespace PdfViewerExample
{
class PdfViewerViewModel : INotifyPropertyChanged
{
private Stream pdfDocumentStream;
/// <summary>
/// Occurs when a property value changes.
/// </summary>
public event PropertyChangedEventHandler? PropertyChanged;
/// <summary>
/// Gets or sets the stream of the currently loaded PDF document.
/// </summary>
public Stream PdfDocumentStream
{
get
{
return pdfDocumentStream;
}
set
{
pdfDocumentStream = value;
OnPropertyChanged(nameof(PdfDocumentStream));
}
}
/// <summary>
/// Initializes a new instance of the PdfViewerViewModel class.
/// </summary>
public PdfViewerViewModel()
{
// Load the embedded PDF document stream
// Make sure PDF file is added to Assets folder and Build Action is set to "Embedded Resource"
pdfDocumentStream = typeof(App).GetTypeInfo().Assembly
.GetManifestResourceStream("PdfViewerExample.Assets.PDF_Succinctly.pdf");
}
/// <summary>
/// Raises the PropertyChanged event for the specified property name.
/// </summary>
/// <param name="name">The name of the property that changed.</param>
public void OnPropertyChanged(string name)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}
}---
Step 4: Bind ViewModel and Load PDF
Update MainPage.xaml to set the BindingContext and bind DocumentSource:
XAML:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:PdfViewerExample"
xmlns:syncfusion="clr-namespace:Syncfusion.Maui.PdfViewer;assembly=Syncfusion.Maui.PdfViewer"
x:Class="PdfViewerExample.MainPage">
<ContentPage.BindingContext>
<local:PdfViewerViewModel x:Name="viewModel" />
</ContentPage.BindingContext>
<ContentPage.Content>
<syncfusion:SfPdfViewer x:Name="pdfViewer"
DocumentSource="{Binding PdfDocumentStream}" />
</ContentPage.Content>
</ContentPage>---
Step 5: Prepare PDF Asset
1. Create an Assets folder in the project root 2. Add your PDF file to the Assets folder (e.g., PDF_Succinctly.pdf) 3. Right-click the PDF file in Solution Explorer 4. Set Build Action to Embedded Resource
---
Running the Application
1. Select your target framework, device, or emulator 2. Press F5 to run the application 3. The PDF document will be displayed in the SfPdfViewer control
---
Important Notes
- Automatic Unloading: When changing or opening different documents on the same page, the previously loaded document is automatically unloaded
- Memory Management: If using multiple pages, call the
UnloadDocument()method before navigating away to release memory and resources - Document Source Options: You can also load PDFs from:
- Local file system using
FilePicker - Base64 encoded strings
- Password-protected files
---
Document Operations
This guide demonstrates how to open, save, and print PDF documents programmatically.
Table of Contents
Open Document
// Load PDF (inputs : Stream, byte[])
pdfViewer.DocumentSource = stream;
pdfViewer.LoadDocument(stream);
await pdfViewer.LoadDocumentAsync(stream);
// Password-protected
pdfViewer.LoadDocument(pdfStream, "password");Load Events
XAML:
<syncfusion:SfPdfViewer x:Name="PdfViewer"
DocumentLoaded="PdfViewer_DocumentLoaded"
DocumentLoadFailed="PdfViewer_DocumentLoadFailed"/>Code:
private void PdfViewer_DocumentLoaded(object sender, EventArgs e)
=> pdfViewer.GoToPage(1);
private void PdfViewer_DocumentLoadFailed(object sender, DocumentLoadFailedEventArgs e)
{
e.Handled = true; // suppress default error UI
Debug.WriteLine($"Failed: {e.Message}");
if (e.Message == "This PDF cannot be loaded because it contains XFA form.")
{ /* handle XFA */ }
}Save Document
// Synchronous
private void SaveDocument()
{
using FileStream fs = File.Create(Path.Combine(FileSystem.Current.AppDataDirectory, "Modified.pdf"));
PdfViewer.SaveDocument(fs);
}
// Asynchronous (recommended)
private async Task SaveDocumentAsync()
{
using FileStream fs = File.Create(Path.Combine(FileSystem.Current.AppDataDirectory, "Modified.pdf"));
await PdfViewer.SaveDocumentAsync(fs);
}
// Flatten annotation on save
PdfViewer.Annotations[0].FlattenOnSave = true;
// Flatten form field on save
PdfViewer.FormFields[0].FlattenOnSave = true;When flattening sticky note annotations, icon always renders as default comment icon.
Print Document
// Programmatic
PdfViewer.PrintDocument();
// Windows print quality (Low / Default / Medium / High / Ultra)
PdfViewer.PrintSettings.PrintQuality = PrintQuality.High;XAML command binding:
<Button Text="Print" Command="{Binding Source={x:Reference PdfViewer}, Path=PrintDocumentCommand}"/>PrintQuality is Windows-only. Sticky note icon always renders as default on print.Unload Document
Methods
UnloadDocument()UnloadDocumentAsync()
Use the async method for non‑blocking operations.
Opening a new document automatically unloads the previous one. Call an unload method before leaving a page.
Note: Unload actions cannot be undone.
Electronic Signature in .NET MAUI PDF Viewer
This guide demonstrates how to add and manage electronic signatures in PDF documents, including handwritten, text-based, and image-based signatures.
Signature Types
1. Handwritten Signature - User draws a signature 2. Text Signature - Text-based signature 3. Image Signature - Image-based signature
Add Signature via UI
Enable signature mode to allow users to add signatures through the signature dialog.
C#:
// Enable signature mode - opens signature dialog
void EnableSignatureMode()
{
PdfViewer.AnnotationMode = AnnotationMode.Signature;
}
// Disable signature mode after adding signature
void DisableSignatureMode()
{
PdfViewer.AnnotationMode = AnnotationMode.None;
}Add Handwritten Signature Programmatically
Create and add handwritten signatures using ink annotations.
C#:
int pageNumber = 1;
// Provide the points collection to draw a stroke (single stroke example)
List<List<float>> pointsCollection = new List<List<float>>()
{
new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 }
};
// Create an ink annotation
InkAnnotation annotation = new InkAnnotation(pointsCollection, pageNumber);
// Set IsSignature as true to mark as signature
annotation.IsSignature = true;
// Add the ink annotation to the PDF page as a signature
PdfViewer.AddAnnotation(annotation);Add Image Signature Programmatically
Create and add image-based signatures using stamp annotations.
C#:
int pageNumber = 1;
// Define the position and size for the stamp
RectF bounds = new RectF(50, 50, 200, 100);
// Create an image stream from the image resource
Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("Annotations.Assets.Logo.png");
// Create a custom stamp annotation using the image stream
StampAnnotation customStamp = new StampAnnotation(imageStream, pageNumber, bounds);
// Set IsSignature as true to mark as signature
customStamp.IsSignature = true;
// Add the stamp annotation to the PDF page as a signature
PdfViewer.AddAnnotation(customStamp);Handle Signature Modal View Events
Handle events when the signature dialog appears or disappears.
C#:
// Subscribe to events
pdfViewer.SignatureModalViewAppearing += PdfViewer_SignatureModalViewAppearing;
pdfViewer.SignatureModalViewDisappearing += PdfViewer_SignatureModalViewDisappearing;
// Event triggered when signature modal view opens
private void PdfViewer_SignatureModalViewAppearing(object? sender, FormFieldModalViewAppearingEventArgs e)
{
// Hide unwanted UI elements like toolbars
}
// Event triggered when signature modal view closes
private void PdfViewer_SignatureModalViewDisappearing(object? sender, EventArgs e)
{
// Show the UI elements that were hidden
}Suppress Modal View and Use Custom UI
Replace the built-in signature dialog with a custom UI.
C#:
Stream signatureImageStream;
pdfViewer.SignatureModalViewAppearing += PdfViewer_SignatureModalViewAppearing;
pdfViewer.Tapped += PdfViewer_Tapped;
// Suppress the built-in signature modal
private void PdfViewer_SignatureModalViewAppearing(object? sender, FormFieldModalViewAppearingEventArgs e)
{
e.Cancel = true; // Prevent default signature dialog
// Show your custom signature UI dialog
ShowCustomDialog();
}
// When user completes drawing signature in custom dialog
private void CustomDialogOkButton_Clicked(object sender, EventArgs e)
{
// Get the signature as an image stream
signatureImageStream = GetSignatureImageStream();
}
// Add signature when user taps on PDF
private void PdfViewer_Tapped(object sender, GestureEventArgs e)
{
PointF position = e.PagePosition;
int pageNumber = e.PageNumber;
// Create and add stamp annotation as signature
StampAnnotation stamp = new StampAnnotation(signatureImageStream, pageNumber,
new RectF(position.X, position.Y, 200, 200));
pdfViewer.AddAnnotation(stamp);
}Customize Handwritten Signature Appearance
Use the SignatureCreated event to customize signature properties after creation.
C#:
// Subscribe to SignatureCreated event
pdfViewer.SignatureCreated += PdfViewer_SignatureCreated;
// Event handler triggered when a signature is created
private void PdfViewer_SignatureCreated(object? sender, SignatureCreatedEventArgs e)
{
// Check if the signature is a handwritten ink-based signature
if (e.Signature is InkAnnotation handWrittenSignature)
{
// Customize the appearance of the handwritten signature
handWrittenSignature.BorderWidth = 6; // Set stroke thickness
handWrittenSignature.Color = Colors.Yellow; // Set stroke color
handWrittenSignature.Opacity = 0.75f; // Set transparency level
}
}Reference
Form Fields
This guide demonstrates how to view, fill, and manage AcroForm-based PDF forms including editing, validation, import/export, events, and visibility control.
Note: Only AcroForms are supported. XFA forms will trigger DocumentLoadFailed.Table of Contents
- Supported Types
- Access Collection
- Edit Form Fields
- Customize Appearance
- Show / Hide
- Events
- Import / Export
- Validation
Supported Types
TextBox, Checkbox, RadioButton, ComboBox, ListBox, Signature, Button (GoTo actions only).
Access Collection
// Available after DocumentLoaded
int count = PdfViewer.FormFields.Count;
// Get by name
FormField field = PdfViewer.FormFields.Where(x => x.Name == "name").FirstOrDefault();
// Restrict all fields
foreach (FormField f in PdfViewer.FormFields) f.ReadOnly = true;
// Clear data
PdfViewer.ClearFormData(); // all fields
PdfViewer.ClearFormData(2); // specific page
// Attach custom data (not saved in PDF)
PdfViewer.FormFieldValueChanged += (s, e) =>
e.FormField.CustomData = "Modified: " + DateTime.Now.ToString();Edit Form Fields
// Text
if (PdfViewer.FormFields.Where(x => x.Name == "name").FirstOrDefault() is TextFormField tb)
tb.Text = "John Doe";
// Checkbox
if (PdfViewer.FormFields.Where(x => x.Name == "newsletter").FirstOrDefault() is CheckboxFormField cb)
cb.IsChecked = true;
// ComboBox
if (PdfViewer.FormFields.Where(x => x.Name == "state").FirstOrDefault() is ComboBoxFormField combo)
combo.SelectedItem = combo.Items[4];
// ListBox (single or multi)
if (PdfViewer.FormFields.Where(x => x.Name == "courses").FirstOrDefault() is ListBoxFormField lb)
{
lb.SelectedItems = new ObservableCollection<string> { lb.Items[0] }; // single
lb.SelectedItems = new ObservableCollection<string> { lb.Items[1], lb.Items[2] }; // multi
}
// RadioButton
if (PdfViewer.FormFields.Where(x => x.Name == "gender").FirstOrDefault() is RadioButtonFormField rb)
rb.SelectedItem = rb.Items[0];
// Signature assign InkAnnotation
if (PdfViewer.FormFields.Where(x => x.Name == "signature").FirstOrDefault() is SignatureFormField sig)
{
List<List<float>> pts = new();
pts.Add(new List<float> { 10f, 10f, 10f, 20f, 20f, 20f, 30f, 30f });
InkAnnotation ink = new InkAnnotation(pts, sig.PageNumber);
ink.Color = Colors.Red;
sig.Signature = ink;
}
// Suppress signature modal, use custom UI
pdfViewer.SignatureModalViewAppearing += (s, e) =>
{
e.Cancel = true;
var sf = e.FormField as SignatureFormField;
// show custom dialog; on confirm:
// sf.Signature = new StampAnnotation(imageStream, sf.PageNumber, new RectF(0,0,0,0));
};Customize Appearance
// Background color (all fields)
foreach (FormField f in pdfViewer.FormFields)
foreach (Widget w in f.Widgets)
w.BackgroundColor = Color.FromRgba(204, 215, 255, 200);
// Text color, border color, border width (TextFormField shown; same for others)
foreach (FormField f in pdfViewer.FormFields)
if (f is TextFormField tf)
foreach (var w in tf.Widgets)
{
w.ForegroundColor = Colors.Red;
w.BorderColor = Colors.Red;
w.BorderWidth = 2.0f;
}
// Detect widget property changes
foreach (FormField f in pdfViewer.FormFields)
foreach (var w in f.Widgets)
w.PropertyChanged += (s, e) =>
{
if (s is Widget widget && e.PropertyName == nameof(widget.BorderWidth))
Debug.WriteLine("BorderWidth changed: " + widget.BorderWidth);
};Show / Hide
foreach (FormField f in pdfViewer.FormFields) f.IsHidden = true; // hide all
foreach (FormField f in pdfViewer.FormFields) f.IsHidden = false; // show all
if (PdfViewer.FormFields.Where(x => x.Name == "name").FirstOrDefault() is TextFormField ntb)
ntb.IsHidden = true; // hide specificLocked fields cannot be hidden. Hidden state persists through import, export, print, and save. Supports undo/redo.
Events
XAML:
<syncfusion:SfPdfViewer x:Name="pdfViewer"
FormFieldValueChanged="PdfViewer_FormFieldValueChanged"
FormFieldFocusChanged="PdfViewer_FormFieldFocusChanged"/>Code:
// Value changed OldValue / NewValue vary by type (string, bool, etc.)
private void PdfViewer_FormFieldValueChanged(object? sender, FormFieldValueChangedEventArgs? e)
{
if (e?.FormField is TextFormField t)
{ string old = e.OldValue?.ToString(); string newVal = e.NewValue?.ToString(); }
}
// Focus changed text and signature fields only
private void PdfViewer_FormFieldFocusChanged(object? sender, FormFieldFocusChangedEvenArgs? e)
{
if (e != null) { FormField f = e.FormField; bool focused = e.HasFocus; }
}Import / Export
Supported formats: XFDF, FDF, JSON, XML.
// Import
Stream input = File.OpenRead(Path.Combine(FileSystem.Current.AppDataDirectory, "FormDataInfo.xfdf"));
input.Position = 0;
pdfViewer.ImportFormData(input, Syncfusion.Pdf.Parsing.DataFormat.XFdf);
pdfViewer.ImportFormData(input, Syncfusion.Pdf.Parsing.DataFormat.XFdf, true); // continue on errors
// Export
FileStream output = File.Create(Path.Combine(FileSystem.Current.AppDataDirectory, "ExportedFormData.xfdf"));
pdfViewer.ExportFormData(output, Syncfusion.Pdf.Parsing.DataFormat.XFdf);Validation
async void ValidateAndSaveForm()
{
List<string> errors = new();
foreach (FormField formField in PdfViewer.FormFields)
{
if (formField is TextFormField t)
{
if (t.Name == "Name")
{
if (string.IsNullOrEmpty(t.Text)) errors.Add("Name is required.");
else if (t.Text.Length < 3) errors.Add("Name min 3 chars.");
else if (t.Text.Length > 30) errors.Add("Name max 30 chars.");
else if (Regex.IsMatch(t.Text, @"[0-9]")) errors.Add("Name: no numbers.");
}
else if (t.Name == "email" && !Regex.IsMatch(t.Text ?? "", @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"))
errors.Add("Invalid email format.");
else if (t.Name == "dob" && !DateTime.TryParseExact(t.Text, "dd/MM/yyyy",
CultureInfo.InvariantCulture, DateTimeStyles.None, out _))
errors.Add("Date of birth must be dd/MM/yyyy.");
}
else if (formField is ListBoxFormField lb && lb.SelectedItems.Count == 0)
errors.Add("Select at least one course.");
else if (formField is SignatureFormField sf && sf.Signature == null)
errors.Add("Signature is required.");
}
if (errors.Count > 0)
await DisplayAlert("Validation Errors", string.Join("\n", errors), "Try Again");
else
{
using FileStream fs = File.Create(Path.Combine(FileSystem.Current.AppDataDirectory, "FilledForm.pdf"));
PdfViewer.SaveDocument(fs);
await DisplayAlert("Success", "Form submitted.", "OK");
}
}Gesture Events
This guide demonstrates how to handle tap gestures on the PDF document with page and position context.
XAML:
<syncfusion:SfPdfViewer x:Name="PdfViewer" Tapped="PdfViewer_Tapped"/>Code:
private void PdfViewer_Tapped(object sender, GestureEventArgs e)
{
Point position = e.Position; // position on the PdfViewer control
int pageNumber = e.PageNumber; // 1-based; -1 if outside any page
Point pagePosition = e.PagePosition; // PDF page coordinates; (-1,-1) if outside page
if (pageNumber != -1)
{
// tap occurred within a page boundary
}
}`GestureEventArgs` properties:
| Property | Type | Description |
|---|---|---|
Position | Point | Tapped position on the viewer control |
PageNumber | int | Page number (1-based); -1 if outside pages |
PagePosition | Point | Page coordinates; (-1,-1) if outside pages |
Migrate from Xamarin.Forms SfPdfViewer to .NET MAUI SfPdfViewer
Xamarin Namespace: Syncfusion.SfPdfViewer.XForms → MAUI Namespace: Syncfusion.Maui.PdfViewer
Breaking Changes:
- Search method is now async:SearchText()→await SearchTextAsync()
- Multiple annotation events consolidated into single events (e.g.,InkAdded+ShapeAnnotationAdded→AnnotationAdded)
- Boolean inversion:FormField.CanEdit = false→FormField.ReadOnly = true
- ExportAsImageAsync() removed — use the PDF to Image Converter library instead-AnnotationSettings.HandwrittenSignatureremoved — useSignatureCreatedevent
---
Namespaces
| Xamarin SfPdfViewer | .NET MAUI SfPdfViewer |
|---|---|
| Syncfusion.SfPdfViewer.XForms | Syncfusion.Maui.PdfViewer |
Properties
| Xamarin SfPdfViewer | .NET MAUI SfPdfViewer | Description |
|---|---|---|
| InputFileStream | DocumentSource | Load PDF from stream or byte array |
| ZoomPercentage | ZoomFactor | Set zoom level (1-4, default: 1) |
| MinimumZoomPercentage | MinZoomFactor | Minimum zoom factor (default: 0.25) |
| MaximumZoomPercentage | MaxZoomFactor | Maximum zoom factor (default: 4) |
| EnableScrollHead | ShowScrollHead | Show/hide scroll head |
| BookmarkPaneVisible | IsOutlineViewVisible | Show/hide outline view |
| EnableDocumentLinkAnnotation | EnableDocumentLinkNavigation | Enable TOC interaction |
| AllowHyperlinkNavigation | EnableHyperlinkNavigation | Enable hyperlink navigation |
| Bookmarks | DocumentOutline | Get document outline |
| IsTextSelectionEnabled | EnableTextSelection | Enable text selection |
| TextSelectionColor | HighlightColor | Selected text highlight color |
| CurrentInstanceColor | CurrentMatchHighlightColor | Current search match color |
| OtherInstanceColor | OtherMatchesHighlightColor | Other matches highlight color |
| AnnotationMode | AnnotationMode | Annotation type to draw |
| Annotations | Annotations | Get list of annotations |
| AnnotationSettings | AnnotationSettings | Default annotation settings |
| ClearAllAnnotationsCommand | RemoveAllAnnotationsCommand | Remove all annotations command |
| PerformUndoCommand | UndoCommand | Undo command |
| PerformRedoCommand | RedoCommand | Redo command |
| InkPointsCollection | PointsCollection | Ink annotation points |
| InkAnnotationSettings.Thickness | InkAnnotationSettings.BorderWidth | Ink border thickness |
| ShapeAnnotationSettings.Thickness | ShapeAnnotationSettings.BorderWidth | Shape border thickness |
| InkAnnotationSettings.EnableSeparateAttributesForEachStroke | InkAnnotationSettings.AggregateInkStrokes | Treat each stroke separately |
| ShapeAnnotationSettings.StrokeColor | ShapeAnnotationSettings.Color | Shape stroke color |
| SelectorSettings.StrokeColor | AnnotationSelectorSettings.Color | Selector color |
| LockedStrokeColor | LockedColor | Locked annotation selector color |
| LinePoints | LineAnnotation.Points | Line annotation coordinates |
| Rectangle | ShapeAnnotationSettings.Square | Square annotation settings |
| Circle | AnnotationSettings.Circle | Circle annotation settings |
| Line | AnnotationSettings.Line | Line annotation settings |
| Arrow | AnnotationSettings.Arrow | Arrow annotation settings |
| Ink | AnnotationSettings.Ink | Ink annotation settings |
| Stamp | AnnotationSettings.Stamp | Stamp annotation settings |
| AnnotationMode.HandwrittenSignature | AnnotationMode.Signature | Signature dialog |
| Selector | AnnotationSettings.Selector | Selector settings |
| FormField.CanEdit | FormField.ReadOnly | Set form field editable |
| SignatureFormField.HandwrittenSignature | SignatureFormField.Signature | Signature in field |
| PageViewMode | PageLayoutMode | Page display layout |
| InkAnnotationSettings.TouchMode | InkAnnotationSettings.TouchScreenInputMode | Ink input mode |
| TouchMode.Direct | TouchScreenInputMode.FingerAndStylus | Finger and stylus input |
| IsToolbarVisible | ShowToolbars | Show/hide toolbars |
| AnnotationSettings.HandwrittenSignature | API Unavailable | Use SignatureCreated event |
Events
| Xamarin SfPdfViewer | .NET MAUI SfPdfViewer | Description |
|---|---|---|
| UnhandledConditionOccurred | DocumentLoadFailed | PDF load failed |
| SearchInitiated, SearchCompleted | TextSearchProgress | Text search in progress |
| TextSelectionCompleted | TextSelectionChanged | Text selection changed |
| InkAdded, ShapeAnnotationAdded, StampAnnotationAdded, PopupAnnotationAdded, FreeTextAnnotationAdded, TextMarkupAdded | AnnotationAdded | Annotation added |
| InkDeselected, ShapeAnnotationDeselected, StampAnnotationDeselected, PopupAnnotationDeselected, FreeTextAnnotationDeselected, TextMarkupDeselected | AnnotationDeselected | Annotation deselected |
| InkEdited, ShapeAnnotationEdited, StampAnnotationMovedOrResized, PopupAnnotationEdited, FreeTextAnnotationEdited, TextMarkupEdited | AnnotationEdited | Annotation edited |
| InkRemoved, ShapeAnnotationRemoved, StampAnnotationRemoved, PopupAnnotationRemoved, FreeTextAnnotationRemoved, TextMarkupRemoved | AnnotationRemoved | Annotation removed |
| InkSelected, ShapeAnnotationSelected, StampAnnotationSelected, PopupAnnotationSelected, FreeTextAnnotationSelected, TextMarkupSelected | AnnotationSelected | Annotation selected |
| PageChanged | PropertyChanged | Property modified |
| DocumentSaveInitiated | API Unavailable | Use SaveDocument method |
| CanUndoModified, CanRedoModified, CanRedoInkModified, CanUndoInkModified | API Unavailable | Use annotation/form events |
Methods
| Xamarin SfPdfViewer | .NET MAUI SfPdfViewer | Description |
|---|---|---|
| Unload | UnloadDocument | Unload PDF document |
| GoToBookmark | GoToOutlineElement | Go to outline element |
| SearchText | SearchTextAsync | Search text asynchronously |
| CancelSearch | Clear | Clear search and highlights |
| SearchNext | GoToNextMatch | Next search match |
| SearchPrevious | GoToPreviousMatch | Previous search match |
| ClearAllAnnotations | RemoveAllAnnotations | Remove all annotations |
| AddAnnotation, AddStamp | AddAnnotation | Add annotation |
| DeselectAnnotation | DeselectAnnotation | Deselect annotation |
| ExportAnnotations | ExportAnnotations | Export annotations |
| ExportAnnotationsAsync | ExportAnnotationsAsync | Export annotations async |
| ImportAnnotations | ImportAnnotations | Import annotations |
| RemoveAnnotation | RemoveAnnotation | Remove annotation |
| SaveDocument | SaveDocument | Save PDF document |
| SaveDocumentAsync | SaveDocumentAsync | Save PDF async |
| SelectAnnotation | SelectAnnotation | Select annotation |
| PrintDocument | Print PDF | |
| SaveDocument(bool flattenForm) | FormField.FlattenOnSave | Flatten form fields on save |
| ExportAsImageAsync | API Unavailable | Use PDF to Image Converter |
Classes
| Xamarin SfPdfViewer | .NET MAUI SfPdfViewer | Description |
|---|---|---|
| CustomBookmark | Bookmark | Custom bookmark class |
| TouchMode | TouchScreenInputMode | Input mode enumeration |
| TextSelectionCompletedEventArgs | TextSelectionChangedEventArgs | Text selection event args |
| UnhandledConditionEventArgs | DocumentLoadFailedEventArgs | Load failed event args |
| TextMarkupAnnotation | HighlightAnnotation, SquigglyAnnotation, StrikeOutAnnotation, UnderlineAnnotation | Text markup annotations |
| ShapeAnnotation | CircleAnnotation, LineAnnotation, SquareAnnotation | Shape annotations |
| PopupAnnotation | StickyNoteAnnotation | Sticky note annotation |
| AnnotationMovedOrResizedEventArgs, InkAddedEventArgs, InkDeselectedEventArgs, InkEditedEventArgs, InkRemovedEventArgs, InkSelectedEventArgs, ShapeAnnotationAddedEventArgs, ShapeAnnotationDeselectedEventArgs, ShapeAnnotationEditedEventArgs, ShapeAnnotationRemovedEventArgs, ShapeAnnotationSelectedEventArgs, StampAnnotationAddedEventArgs, StampAnnotationDeselectedEventArgs, StampAnnotationMovedOrResizedEventArgs, StampAnnotationRemovedEventArgs, StampAnnotationSelectedEventArgs, TextMarkupAddedEventArgs, TextMarkupDeselectedEventArgs, TextMarkupEditedEventArgs, TextMarkupRemovedEventArgs | AnnotationEventArgs | Annotation event args |
Redaction in .NET MAUI PDF Viewer
This guide demonstrates how to permanently remove sensitive data from PDF documents using redaction. Unlike annotations, redacted content cannot be recovered once saved.
Redaction Types
1. Text-based Redaction - Manually select text and apply redaction 2. Selected Area Redaction - Redact specific rectangular regions 3. Page-based Redaction - Redact entire pages
Enable Redaction Modes
Set the RedactionMode property to activate redaction mode for user interaction.
C#:
// Enable text-based redaction mode
void EnableTextBasedRedactionMode()
{
PdfViewer.RedactionMode = RedactionMode.Text;
}
// Enable area redaction mode
void EnableSelectedAreaRedactionMode()
{
PdfViewer.RedactionMode = RedactionMode.Rect;
}
// Disable redaction mode after marking regions
void DisableRedactionMode()
{
PdfViewer.RedactionMode = RedactionMode.None;
}Add Redaction Marks Programmatically
Add redaction marks to specific regions or entire pages using code.
C#:
void AddRedactionMarkOnSpecificRegionAndPages()
{
// Define the bounds of the area to redact (x, y, width, height) on page number 2
RedactionMark redactionMark = new RedactionMark(new RectF(30, 40, 100, 100), 2);
// Set the appearance for the redaction mark
redactionMark.MarkerBorderColor = Colors.Black;
redactionMark.MarkerFillColor = Colors.Yellow;
// Add the redaction mark to the specified region
PdfViewer.AddRedactionMark(redactionMark);
// Add redaction marks to specific pages (pages 3, 5, and 1)
PdfViewer.AddPageRedactionMarks(new List<int>([3, 5, 1]));
}Remove Redaction Marks
Remove single or all redaction marks programmatically.
C#:
// Remove the selected redaction mark
void RemoveSelectedRedactionMark()
{
// Check if any redaction mark is currently selected
if (PdfViewer.SelectedRedactionMark != null)
{
// Remove the selected redaction mark from the PDF
PdfViewer.RemoveRedactionMark(PdfViewer.SelectedRedactionMark);
}
}
// Remove all redaction marks
void RemoveAllRedactionMarksDrawn()
{
// Removes all the redaction marks from a PDF document
PdfViewer.RemoveAllRedactionMarks();
}Apply Redaction
Permanently redact all marked regions using the RedactAsync method. This saves the document with irreversible changes.
C#:
private async void RedactMarkedRegion()
{
// Apply redaction to all marked regions in the PDF document
await PdfViewer.RedactAsync();
}Customize Redaction Appearance
Use RedactionSettings to customize the default appearance of redaction marks and final result.
C#:
void CustomizeDefaultRedactionSettings()
{
// Access the default redaction settings from the SfPdfViewer instance
PdfViewer.RedactionSettings.MarkerBorderColor = Colors.Blue; // Border color for marked region
PdfViewer.RedactionSettings.FillColor = Colors.Red; // Fill color after redaction is applied
PdfViewer.RedactionSettings.FontColor = Colors.Black; // Font color for overlay text
PdfViewer.RedactionSettings.OverlayText = "text"; // Text to display on redacted area
PdfViewer.RedactionSettings.IsRepeat = true; // Repeat overlay text across area
}Reference
Text Search
This guide demonstrates how to search and navigate text matches in a PDF document.
// Search
TextSearchResult result = await PdfViewer.SearchTextAsync("keyword");
// Results info
int total = result.TotalMatchesCount;
int current = result.CurrentMatchIndex;
// Navigate matches
result.GoToNextMatch();
result.GoToPreviousMatch();
// Clear highlights
result.Clear();Search Options
await PdfViewer.SearchTextAsync("keyword", TextSearchOptions.CaseSensitive);
await PdfViewer.SearchTextAsync("keyword", TextSearchOptions.WholeWords);Highlight Colors
XAML:
<syncfusion:SfPdfViewer x:Name="PdfViewer">
<syncfusion:SfPdfViewer.TextSearchSettings>
<syncfusion:TextSearchSettings
CurrentMatchHighlightColor="#438F00FF"
OtherMatchesHighlightColor="#4300FF00"/>
</syncfusion:SfPdfViewer.TextSearchSettings>
</syncfusion:SfPdfViewer>Code:
pdfViewer.TextSearchSettings.CurrentMatchHighlightColor = Color.FromArgb("#438F00FF");
pdfViewer.TextSearchSettings.OtherMatchesHighlightColor = Color.FromArgb("#4300FF00");Progress Event
XAML:
<syncfusion:SfPdfViewer x:Name="PdfViewer" TextSearchProgress="OnSearchProgress"/>Code:
private void OnSearchProgress(object sender, TextSearchProgressEventArgs e)
{
float pct = (float)e.TotalPagesSearched / PdfViewer.PageCount;
// e.SearchResult?.Clear(); // cancel search
}Text Selection
This guide demonstrates how to select text in a PDF document and handle selection events.
// Enable / disable
pdfViewer.EnableTextSelection = true;
pdfViewer.EnableTextSelection = false;
// Highlight color
pdfViewer.TextSelectionSettings.HighlightColor = Color.FromArgb("#43FFFF00");
// Selection event
PdfViewer.TextSelectionChanged += (s, e) =>
{
string text = e.SelectedText;
int pageNo = e.PageNumber;
e.Handled = true; // suppress default copy context menu
};XAML:
<syncfusion:SfPdfViewer x:Name="PdfViewer" EnableTextSelection="False">
<syncfusion:SfPdfViewer.TextSelectionSettings>
<syncfusion:TextSelectionSettings HighlightColor="#43FFFF00"/>
</syncfusion:SfPdfViewer.TextSelectionSettings>
</syncfusion:SfPdfViewer>Input methods:
- Desktop: click and drag
- Mobile: long-press + selection handles
- Copy:
Ctrl+C(desktop) / Copy button (mobile)
Text from images cannot be selected. Multi-page selection is not supported.
PDF Viewer Toolbar Customization - Complete Reference
This guide demonstrates how to customize PDF Viewer toolbars by toolbar type and platform, including removing, adding, hiding, and inserting toolbar items.
---
Desktop Toolbar Items - Complete Reference
Comprehensive guide for customizing PDF Viewer toolbars on Desktop platforms.
---
Desktop 1. Primary Toolbar Items
Location: Main toolbar at top Toolbar Name: PrimaryToolbar
Navigation & Document Controls
| Item | Description |
|---|---|
Undo | Undo the last action |
Redo | Redo the last undone action |
Previous page | Navigate to previous page |
Next page | Navigate to next page |
Page number entry | Enter page number to jump to |
Page count | Display total number of pages |
View & Tools
| Item | Description |
|---|---|
Zoom mode | Adjust magnification/zoom level |
Annotations | Access annotation toolbar |
Print | Print the PDF document |
Outline | View document outline/bookmarks |
Search | Find specific text in document |
Page layout mode | Customize page display and layout |
Separators
| Item | Description |
|---|---|
PageCountSeparator | Separator between page number and count |
ZoomIconSeparator | Separator before zoom button |
AnnotationSeparator | Separator before annotations button |
PrintSeparator | Separator after print button |
MoreOptionSeparator | Separator before page layout mode |
---
Desktop 2. Annotations Toolbar Items
Location: Annotation toolbar (appears below PrimaryToolbar) Toolbar Name: AnnotationsToolbar
Text Markup
| Item | Description |
|---|---|
Text markups | Annotate text in document |
Highlight | Highlight selected text |
Underline | Underline selected text |
Strikeout | Strike-through selected text |
Squiggly | Add squiggly line under text |
Drawing & Freehand
| Item | Description |
|---|---|
Ink | Draw freehand annotations |
Ink eraser | Erase ink annotations |
Free text | Add text annotations |
Shapes
| Item | Description |
|---|---|
Shapes | Add shapes menu |
Square | Draw a square/rectangle |
Circle | Draw a circle/ellipse |
Line | Draw a straight line |
Arrow | Draw an arrow |
Polyline | Draw multi-segment lines |
Polygon | Draw a polygon |
Cloud | Draw a cloud shape |
Special Annotations
| Item | Description |
|---|---|
Stamps | Add built-in or custom stamps |
Sticky note | Add sticky notes |
Signature | Create and add signature |
Formatting & Styling
| Item | Description |
|---|---|
Color picker | Select and apply colors |
Thickness | Set line/border thickness |
Font size | Change text size |
Sticky note icons | Select sticky note types |
Actions
| Item | Description |
|---|---|
Delete | Delete selected annotation |
ColorPickerSeparator | Separator before color picker |
Close | Close annotation toolbar |
---
Desktop 3. Annotation Edit Toolbars
Location: Edit toolbar (appears when editing annotations) Used in: All 15 annotation edit toolbars
These toolbars share items with AnnotationsToolbar:
HighlightAnnotationEditToolbarUnderlineAnnotationEditToolbarStrikeOutAnnotationEditToolbarSquigglyAnnotationEditToolbarLineAnnotationEditToolbarArrowAnnotationEditToolbarRectangleAnnotationEditToolbarCircleAnnotationEditToolbarPolygonAnnotationEditToolbarPolylineAnnotationEditToolbarFreeTextAnnotationEditToolbarInkAnnotationEditToolbarEraserEditToolbarStickyNoteAnnotationEditToolbarStampAnnotationEditToolbar
Common items in all edit toolbars:
Text markups | Highlight | Underline | Strikeout | Squiggly | Ink | Ink eraser
Free text | Shapes | Square | Circle | Line | Arrow | Polyline | Polygon | Cloud
Stamps | Sticky note | Signature | Color picker | Thickness | Font size
Sticky note icons | Delete | Close---
Desktop Quick Reference
PrimaryToolbar
Undo | Redo | Previous page | Next page | Page number entry | Page count
Zoom mode | Annotations | Print | Outline | Search | Page layout mode
[Separators: PageCountSeparator, ZoomIconSeparator, AnnotationSeparator, PrintSeparator, MoreOptionSeparator]AnnotationsToolbar
Text markups | Highlight | Underline | Strikeout | Squiggly | Ink | Ink eraser
Free text | Shapes | Square | Circle | Line | Arrow | Polyline | Polygon | Cloud
Stamps | Sticky note | Signature | Color picker | Thickness | Font size
Sticky note icons | Delete | ColorPickerSeparator | CloseAnnotation Edit Toolbars (All Types)
All items from AnnotationsToolbar---
Mobile Toolbar Items - Complete Reference
Easy-to-understand guide for customizing PDF Viewer toolbars on Mobile platforms.
---
Mobile 1. Top Toolbar Items
Location: Top of the PDF Viewer Toolbar Name: TopToolbar
| Item | Description |
|---|---|
Undo | Undo the last action |
Redo | Redo the last undone action |
ZoomMode | Adjust magnification/zoom level |
PageSettings | Customize page display and layout |
Search | Find specific text in document |
MoreItem | Expand additional options |
---
Mobile 2. Bottom Toolbar Items
Location: Bottom of the PDF Viewer Toolbar Name: BottomToolbar
| Item | Description |
|---|---|
TextMarkup | Annotate text (highlight, underline, etc.) |
FreeText | Add text annotations to document |
Ink | Draw freehand annotations |
Eraser | Erase ink annotations |
Shape | Add shapes (lines, rectangles, circles) |
Stamp | Add built-in or custom stamps |
Signature | Create and add signature annotations |
StickyNote | Add sticky notes to document |
---
Mobile 3. Text Markup Toolbar Items
Location: Appears when text markup annotation selected Toolbar Name: TextMarkupToolbar
| Item | Description |
|---|---|
TextMarkupToolbarBackIcon | Navigate back from toolbar |
Highlight | Highlight selected text |
Underline | Underline selected text |
StrikeOut | Strike-through selected text |
Squiggly | Add squiggly line under text |
---
Mobile 4. Shape Annotations Toolbar Items
Location: Appears when shape annotation selected Toolbar Name: ShapeAnnotationsToolbar
| Item | Description |
|---|---|
ShapeToolbarBackIcon | Navigate back from toolbar |
Line | Draw a straight line |
Arrow | Draw an arrow line |
Rectangle | Draw a rectangle |
Circle | Draw a circle/ellipse |
Polygon | Draw a polygon |
Polyline | Draw multi-segment lines |
Cloud | Draw a cloud shape |
---
Mobile 5. Annotation Edit Toolbar Items
Location: Appears when editing any annotation Used in: All annotation type edit toolbars
Navigation & Type
| Item | Description |
|---|---|
SecondaryAnnotationBackIcon | Navigate back from edit toolbar |
BackIconSeparator | Separator after back button |
AnnotationType | Show/indicate annotation type |
BorderStyle | Set border/cloud style |
Text & Size
| Item | Description |
|---|---|
TextColor | Change text color |
TextSize | Change text size |
TextPropertySeparator | Separator after text properties |
TextFillColor | Set text box fill color |
Color & Style
| Item | Description |
|---|---|
StokeColor | Set stroke/outline color |
FillColor | Set fill color |
Thickness | Set line/border thickness |
Opacity | Set annotation opacity |
Content & Actions
| Item | Description |
|---|---|
Edit | Edit annotation content |
Notes | Show sticky note icons |
DeleteSeparator | Separator before delete button |
Delete | Delete the annotation |
Used in these edit toolbars:
HighlightAnnotationEditToolbarUnderlineAnnotationEditToolbarStrikeOutAnnotationEditToolbarSquigglyAnnotationEditToolbarLineAnnotationEditToolbarArrowAnnotationEditToolbarRectangleAnnotationEditToolbarCircleAnnotationEditToolbarPolygonAnnotationEditToolbarPolylineAnnotationEditToolbarFreeTextAnnotationEditToolbarInkAnnotationEditToolbarEraserEditToolbarStickyNoteAnnotationEditToolbarStampAnnotationEditToolbar
---
Mobile 6. Sticky Note Icons Toolbar Items
Location: Sticky note type selection Toolbar Name: StickyNoteIconsToolbarView
| Item | Description |
|---|---|
Note | Add a note type sticky note |
Insert | Add an insert type sticky note |
Comment | Add a comment type sticky note |
Key | Add a key type sticky note |
Help | Add a help type sticky note |
Paragraph | Add a paragraph type sticky note |
New Paragraph | Add a new paragraph type sticky note |
---
Mobile 7. More Option Toolbar Items
Location: More options menu Toolbar Name: MoreOptionToolbar
| Item | Description |
|---|---|
Outline | View document outline/bookmarks |
Print | Print the PDF document |
---
Mobile 8. Search Toolbar Items
Location: Search panel Toolbar Name: SearchToolbar
| Item | Description |
|---|---|
SearchBackIcon | Navigate back from search toolbar |
SearchEntry | Text input field for search query |
SearchBusyIndicator | Shows search is in progress |
ClearSearch | Clear current search text |
ClearSeparator | Separator after clear button |
PreviousSearch | Go to previous search result |
NextSearch | Go to next search result |
MoreOption | Search with case sensitivity option |
---
Mobile Quick Reference by Toolbar
TopToolbar
Undo | Redo | ZoomMode | PageSettings | Search | MoreItemBottomToolbar
TextMarkup | FreeText | Ink | Eraser | Shape | Stamp | Signature | StickyNoteTextMarkupToolbar
TextMarkupToolbarBackIcon | Highlight | Underline | StrikeOut | SquigglyShapeAnnotationsToolbar
ShapeToolbarBackIcon | Line | Arrow | Rectangle | Circle | Polygon | Polyline | CloudEdit Toolbars (All Annotation Types)
SecondaryAnnotationBackIcon | BackIconSeparator | AnnotationType | BorderStyle
TextColor | TextSize | TextPropertySeparator | TextFillColor
StokeColor | FillColor | Thickness | Opacity
Edit | Notes | DeleteSeparator | DeleteStickyNoteIconsToolbarView
Note | Insert | Comment | Key | Help | Paragraph | New ParagraphMoreOptionToolbar
Outline | PrintSearchToolbar
SearchBackIcon | SearchEntry | SearchBusyIndicator | ClearSearch | ClearSeparator
PreviousSearch | NextSearch | MoreOption---
Code Examples - Customize Toolbar Items
1. Remove Item by Name
Remove a specific toolbar item by its name using the GetByName() method:
// Remove the "Undo" button from TopToolbar
var item = pdfViewer.Toolbars?.GetByName("TopToolbar")?.Items?.GetByName("Undo");
if (item != null)
{
pdfViewer.Toolbars?.GetByName("TopToolbar")?.Items?.Remove(item);
}2. Remove Item by Index
Remove a toolbar item by accessing it through its index:
// Get the top toolbar of the PDF Viewer
Syncfusion.Maui.PdfViewer.Toolbar? topToolbar = pdfViewer.Toolbars?.GetByName("TopToolbar");
if (topToolbar != null)
{
// Get the first item from the toolbar
Syncfusion.Maui.PdfViewer.ToolbarItem? firstItem = topToolbar.Items?[0];
if (firstItem != null)
{
// Remove the first item from the toolbar
topToolbar?.Items?.Remove(firstItem);
}
}3. Remove Item from All Toolbars
Remove a specific item from all toolbars by iterating through the toolbar collection:
// Remove "Sticky note" item from all toolbars
for (int i = 0; i < pdfViewer?.Toolbars?.Count; i++)
{
var item = pdfViewer.Toolbars?[i]?.Items?.GetByName("Sticky note");
if (item != null)
{
pdfViewer?.Toolbars?[i]?.Items?.Remove(item);
}
}4. Add Custom Item to Toolbar
Add a new custom button to a toolbar:
// Create a custom button
Button fileOpenButton = new Button
{
Text = "Open",
FontSize = 14,
FontFamily = "Helvetica",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
BackgroundColor = Colors.Transparent,
BorderColor = Colors.Transparent,
Padding = 10,
Margin = new Thickness(5, 0, 0, 0)
};
// Add the button to PrimaryToolbar
pdfViewer.Toolbars?.GetByName("PrimaryToolbar")?.Items?.Add(
new Syncfusion.Maui.PdfViewer.ToolbarItem(fileOpenButton, "FileOpenButton")
);5. Insert Item at Specific Index
Insert a toolbar item at a specific position:
// Create a custom button
Button fileSaveButton = new Button
{
Text = "Save",
FontSize = 14,
FontFamily = "Helvetica",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
BackgroundColor = Colors.Transparent,
BorderColor = Colors.Transparent,
Padding = 10
};
// Find the Print item in PrimaryToolbar
var printItem = pdfViewer?.Toolbars?.GetByName("PrimaryToolbar")?.Items?.GetByName("Print");
if (printItem != null)
{
// Insert the new button after the Print button
pdfViewer?.Toolbars?.GetByName("PrimaryToolbar")?.Items?.Insert(
printItem.Index + 1,
new Syncfusion.Maui.PdfViewer.ToolbarItem(fileSaveButton, "FileSaveButton")
);
}6. Hide Item by Name (Keep Visible Layout)
Hide a toolbar item while keeping the toolbar visible:
// Hide the "Search" item in PrimaryToolbar
var item = pdfViewer.Toolbars?.GetByName("PrimaryToolbar")?.Items?.GetByName("Search");
if (item != null)
{
item.IsVisible = false; // Hide the item
}7. Hide Item by Index
Hide a toolbar item by its index position:
// Hide item at index 2 in PrimaryToolbar
int indexToHide = 2;
var toolbar = pdfViewer.Toolbars?.GetByName("PrimaryToolbar");
if (toolbar != null && indexToHide >= 0 && indexToHide < toolbar.Items?.Count)
{
var item = toolbar.Items[indexToHide];
item.IsVisible = false; // Hide the item
}8. Hide Entire Toolbar
Hide an entire toolbar including all its items:
// Hide the bottom toolbar (annotation toolbar on mobile)
var bottomToolbar = pdfViewer.Toolbars?.GetByName("BottomToolbar");
if (bottomToolbar != null)
{
bottomToolbar.IsVisible = false;
}9. Hide Item from All Toolbars
Hide a specific item from all toolbars:
// Hide "Signature" item from all toolbars
for (int i = 0; i < pdfViewer?.Toolbars?.Count; i++)
{
var item = pdfViewer.Toolbars?[i]?.Items?.GetByName("Signature");
if (item != null)
{
item.IsVisible = false; // Hide the Signature item
}
}10. Keep Only Specific Items
Customize toolbar to show only selected items:
// Keep only Undo, Redo, and ZoomMode in TopToolbar
var topToolbar = pdfViewer.Toolbars?.GetByName("TopToolbar");
if (topToolbar?.Items != null)
{
var itemsToKeep = new[] { "Undo", "Redo", "ZoomMode" };
var itemsToRemove = topToolbar.Items
.Where(i => !itemsToKeep.Contains(i.Name))
.ToList();
foreach (var item in itemsToRemove)
topToolbar.Items.Remove(item);
}11. Show/Hide All Toolbars
Control visibility of all built-in toolbars:
// Hide all toolbars
pdfViewer.ShowToolbars = false;
// Show all toolbars
pdfViewer.ShowToolbars = true;12. Hide Specific Toolbar by Index
Hide a toolbar by its index in the collection:
// Hide the first and second toolbars
if (pdfViewer?.Toolbars?.Count > 1)
{
var firstToolbar = pdfViewer?.Toolbars[0];
if (firstToolbar != null)
firstToolbar.IsVisible = false; // Hide first toolbar
var secondToolbar = pdfViewer?.Toolbars[1];
if (secondToolbar != null)
secondToolbar.IsVisible = false; // Hide second toolbar
}---
Important Notes
✅ Separator items provide visual breaks between tools ✅ Edit toolbar items work with all 15 annotation types ✅ Customize based on requirements - not all items need to be visible
---
---
Desktop vs Mobile Toolbar Comparison
| Feature | Desktop | Mobile |
|---|---|---|
| Primary Toolbar | PrimaryToolbar | TopToolbar |
| Annotations | AnnotationsToolbar | BottomToolbar |
| Text Markup | Built into AnnotationsToolbar | TextMarkupToolbar |
| Shapes | Built into AnnotationsToolbar | ShapeAnnotationsToolbar |
| Pages | Previous, Next, Entry, Count | None (manual scroll) |
| Outline | Built into PrimaryToolbar | MoreOptionToolbar |
| Separators | 5 separator items | 8+ separator items |
| Edit Toolbars | 15 shared toolbars | 15 separate toolbars |
---
References
UI Settings
This guide demonstrates localization, right-to-left layout configuration, and liquid glass effect implementation.
Localization
Translate PDF Viewer UI strings. Default culture is en-US.
Setup (App.xaml.cs)
using System.Globalization;
using System.Resources;
using Syncfusion.Maui.PdfViewer;
public partial class App : Application
{
public App()
{
InitializeComponent();
CultureInfo.CurrentUICulture = new CultureInfo("fr-FR");
// Single control
SfPdfViewerResources.ResourceManager = new ResourceManager(
"PdfViewerLocalization.Resources.SfPdfViewer",
Application.Current.GetType().Assembly);
// Multiple Syncfusion controls use unified resource file
// Syncfusion.Maui.Core.Localization.LocalizationResourceAccessor.ResourceManager =
// new ResourceManager("Localization.Resources.SyncfusionControls",
// Application.Current.GetType().Assembly);
MainPage = new AppShell();
}
}Create Resource File
1. Add SfPdfViewer.<culture>.resx (e.g. SfPdfViewer.fr.resx) to Resources/ 2. Set Build Action Embedded Resource 3. Add key-value pairs (sample keys below)
| Key | Default Value |
|---|---|
| Add Signature | Add Signature |
| AddBookmark | Add bookmark |
| AddFreeTextToastMessage | Tap on the page to add the free text annotation |
| AddHighlightToastMessage | Drag over a text to highlight it |
| AddReply | Add Reply |
| AddSignature | Add signature |
| AddSignatureToastMessage | Tap to add the signature |
| AddSquigglyToastMessage | Drag over a text to add a squiggly underline |
| AddStampToastMessage | Tap to add the stamp |
| AddStickyNoteToastMessage | Tap to add a sticky note |
| AddStrikeoutToastMessage | Drag over a text to strike it through |
| AddUnderlineToastMessage | Drag over a text to underline it |
| AddYourComment | Add comment |
| Annotations | Annotations |
| Apply | Apply |
| ApplyRedactionsConfirmation | You are about to permanently remove all content that has been marked for redaction. Once the document is saved, this operation cannot be undone. Are you sure you want to continue? |
| Arrow | Arrow |
| Back | Back |
| Bookmarks | Bookmarks |
| Border | Border |
| Cancel | Cancel |
| CanOpenWebPage | Do you want to open |
| Circle | Circle |
| Clear | Clear |
| Close | CLOSE |
| Cloud | Cloud |
| Color | Color |
| ColorPicker | Color picker |
| Comment | Comment |
| Comments | Comments |
| ContinuousPage | Continuous page |
| Copy | Copy |
| Create | Create |
| CreateSignature | Create Signature |
| CreateStamps | Create Stamps |
| CurrentPage | Current page |
| CustomStamps | Custom Stamps |
| CustomText | Custom text |
| Delete | Delete |
| DocumentLoadFailed | Failed to load the PDF document. |
| Drag and drop an image here | Drag and drop an image here |
| DragAndDropImage | Drag and drop an image here. |
| Draw | Draw |
| Draw your signature | Draw your signature |
| DrawArrowToastMessage | Drag to draw an arrow |
| DrawCircleToastMessage | Drag to draw a circle |
| DrawCloudToastMessage | Tap to begin drawing a cloud |
| DrawInkToastMessage | Drag to draw an ink |
| DrawLineToastMessage | Drag to draw a line |
| DrawPolygonToastMessage | Tap to begin drawing a polygon |
| DrawPolylineToastMessage | Tap to begin drawing a polyline |
| DrawSquareToastMessage | Drag to draw a square |
| Edit | Edit |
| EditYourComment | Edit comment |
| Enter | Enter |
| EnterPassword | Enter Password |
| EraseInkToastMessage | Drag over an ink to erase it |
| Error | Error |
| EvenPagesOnly | Even pages only |
| Fill | Fill |
| FillColor | Fill color |
| FillOpacity | Fill opacity |
| FitToPage | Fit to Page |
| FitToWidth | Fit to Width |
| Font | Font |
| FontColor | Font color |
| FontSize | Font size |
| FreeText | Free text |
| FreeTextEditorPlaceHolder | Text… |
| GoToPage | Go to Page |
| GuestUser | Guest User |
| Help | Help |
| Highlight | Highlight |
| Ink | Ink |
| InkEraser | Ink eraser |
| Insert | Insert |
| InvalidPageNumber | Invalid page number |
| InvalidPasswordError | Can't open an encrypted document. The password is invalid. |
| Key | Key |
| Line | Line |
| MarkForRedaction | Mark for Redaction |
| MarkPageRange | Mark page range |
| MatchCase | Match Case |
| MoreItems | More items |
| NewParagraph | New Paragraph |
| NextPage | Next page |
| NoBookmark | No Bookmark |
| NoBookmarks | No Bookmarks |
| NoColor | No Color |
| NoComments | No Comments available |
| NoMatchesWereFoundToastMessage | No matches were found. |
| NoMoreMatchesWereFoundToastMessage | No more matches were found |
| NoOutline | No outline |
| Note | Note |
| OddPagesOnly | Odd pages only |
| of | of |
| Ok | OK |
| Opacity | Opacity |
| Open | OPEN |
| OpenWebPage | Open Web Page |
| Outline | Outline |
| OutlineColor | Outline color |
| Page | Page |
| PageByPage | Page by page |
| PageCount | Page count |
| PageLayoutMode | Page layout mode |
| PageNumberEntry | Page number entry |
| PageNumberHint | Enter page number here |
| PageRange | Page range |
| Paragraph | Paragraph |
| PasswordErrorHint | Check your password |
| Polygon | Polygon |
| Polyline | Polyline |
| PreviousPage | Previous page |
| Properties | Properties |
| RedactArea | Redact area |
| RedactedAreaFillColor | Redacted area fill color |
| RedactionMarkAppearance | Redaction mark appearance |
| RedactionProperties | Redaction properties |
| RedactPages | Redact pages |
| RedactText | Redact text |
| Redo | Redo |
| Rename | Rename |
| RepeatOverlayText | Repeat overlay text |
| Replies | Replies |
| RequestPassword | This PDF file is protected. Please enter the password to open it. |
| Save | Save |
| SaveSignature | Save Signature |
| Search | Search |
| SearchPlaceholder | Find in the document |
| Shapes | Shapes |
| Signature | Signature |
| SpecificPage | Specific page |
| Square | Square |
| Squiggly | Squiggly |
| Stamps | Stamps |
| StandardStamps | Standard Stamps |
| StickyNote | Sticky note |
| StickyNoteEditorPlaceholder | Write Your Note... |
| StickyNoteIcons | Sticky note icons |
| Strikeout | Strikeout |
| Stroke | Stroke |
| Text | Text |
| TextColor | Text color |
| TextFillColor | Text fill color |
| TextMarkups | Text markups |
| Thickness | Thickness |
| Type | Type |
| Type your signature | Type your signature |
| TypeSignaturePlaceHolder | Type your signature |
| Underline | Underline |
| Undo | Undo |
| Upload | Upload |
| Upload an image | Upload an image |
| UploadImage | Upload an image |
| UseOverlayText | Use overlay text |
| XFAFormNotSupportedMessage | This PDF cannot be loaded because it contains an XFA form. |
| ZoomMode | Zoom mode |
For the full key list refer to the Syncfusion Localization docs.
---
Right-to-Left Layout
pdfViewer.FlowDirection = FlowDirection.RightToLeft;XAML:
<syncfusion:SfPdfViewer x:Name="PdfViewer" FlowDirection="RightToLeft"/>All built-in controls within the viewer flow right-to-left automatically.
---
Liquid Glass Effect
Requires iOS 26+ / macOS 26+ / .NET 10+.
XAML:
<Grid>
<Grid.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#0F4C75" Offset="0.0"/>
<GradientStop Color="#3282B8" Offset="0.5"/>
<GradientStop Color="#1B262C" Offset="1.0"/>
</LinearGradientBrush>
</Grid.Background>
<core:SfGlassEffectView EffectType="Regular" CornerRadius="20">
<syncfusion:SfPdfViewer x:Name="pdfViewer"
Background="Transparent"
EnableLiquidGlassEffect="True"/>
</core:SfGlassEffectView>
</Grid>Viewing
This guide demonstrates page navigation, zoom/magnification, and coordinate conversion for PDF documents.
Table of Contents
Page Navigation
// Layout mode
PdfViewer.PageLayoutMode = PageLayoutMode.Continuous; // default
PdfViewer.PageLayoutMode = PageLayoutMode.Single;
// Page info
int total = PdfViewer.PageCount;
int current = PdfViewer.PageNumber;
// Navigate
PdfViewer.GoToPage(4);
PdfViewer.GoToNextPage();
PdfViewer.GoToPreviousPage();
PdfViewer.GoToFirstPage();
PdfViewer.GoToLastPage();Scrolling
PdfViewer.ScrollToOffset(100, 1000);
PdfViewer.ShowScrollHead = false; // mobile only
PdfViewer.OverscanCount = 15; // pre-render pages for smooth scrolling
// Detect scroll end
PdfViewer.PropertyChanged += (s, e) =>
{
if (e.PropertyName == nameof(SfPdfViewer.VerticalOffset))
{
bool atEnd = PdfViewer.VerticalOffset + PdfViewer.ClientRectangle.Height >= PdfViewer.ExtentHeight;
}
};Never nest PdfViewer inside a ScrollView.
Document Outline (Bookmarks)
pdfViewer.IsOutlineViewVisible = true;
// Access hierarchy
OutlineElement el = pdfViewer.DocumentOutline[0];
OutlineElement nested = el.Children[0];
// Navigate to outline element
OutlineElement target = pdfViewer.DocumentOutline.FirstOrDefault(x => x.Title.Contains("Chapter 2"));
if (target != null) pdfViewer.GoToOutlineElement(target);Custom Bookmarks
pdfViewer.IsOutlineViewVisible = true;
var bm = new Bookmark { Name = "Chapter 1", PageNumber = 5 };
pdfViewer.CustomBookmarks.Add(bm);
pdfViewer.CustomBookmarks[0].Name = "Renamed";
pdfViewer.CustomBookmarks.Remove(bm);
// Navigate
pdfViewer.GoToBookmark(bm);
Bookmark found = pdfViewer.CustomBookmarks.FirstOrDefault(x => x.Name.Contains("Chapter 2"));
if (found != null) pdfViewer.GoToBookmark(found);
// Track changes
pdfViewer.CustomBookmarks.CollectionChanged += (s, e) => { /* handle add/remove */ };Hyperlinks & Document Links
pdfViewer.HyperlinkClicked += (s, e) =>
{
e.Handled = true; // suppress default browser dialog
Launcher.Default.OpenAsync(e.Hyperlink);
};
pdfViewer.EnableHyperlinkNavigation = true;
pdfViewer.EnableDocumentLinkNavigation = true; // default true; auto-navigates within PDF---
Magnification
// Zoom factor
pdfViewer.ZoomFactor = 2.5;
pdfViewer.MinZoomFactor = 0.5;
pdfViewer.MaxZoomFactor = 4.0;
// Default ranges: Mobile 1.04.0 / Desktop 0.254.0
// Zoom modes
pdfViewer.ZoomMode = ZoomMode.FitToPage; // or FitToWidth / Default
// Note: manually changing ZoomFactor resets ZoomMode to Default
// Persist zoom on page navigation (SinglePage mode only)
pdfViewer.PersistZoomOnPageChange = true;XAML:
<syncfusion:SfPdfViewer x:Name="PdfViewer"
ZoomFactor="2"
MinZoomFactor="0.5"
MaxZoomFactor="4"
ZoomMode="FitToWidth"
PageLayoutMode="SinglePage"
PersistZoomOnPageChange="True"/>---
Coordinates Conversion
Three coordinate systems:
- Client viewport origin top-left of visible area
- Page PDF user space, 1 unit = 1/72 inch
- Scroll pixel positions across entire document
// Viewport area
Rect viewport = PdfViewer.ClientRectangle;
pdfViewer.Tapped += (s, e) =>
{
Point clientPt = e.Position;
int pageNum = PdfViewer.GetPageNumberFromClientPoint(clientPt);
Point pagePt = PdfViewer.ConvertClientPointToPagePoint(clientPt, pageNum);
};
// Annotation bounds client point
if (PdfViewer.Annotations[0] is SquareAnnotation sq)
{
Point pagePt = new Point(sq.Bounds.X, sq.Bounds.Y);
Point clientPt = PdfViewer.ConvertPagePointToClientPoint(pagePt, sq.PageNumber);
Point scrollPt = PdfViewer.ConvertPagePointToScrollPoint(pagePt, sq.PageNumber);
}