# pdf-viewer-read-only

> PDF viewer disables text selection and form fields for read-only support.

**Framework:** maui  **Component:** PdfViewer  **Variant:** read-only

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/maui/pdf-viewer-read-only.json
```

**Install Package(s)**

```bash
dotnet add package Syncfusion.Maui.PdfViewer
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/pdf-viewer-read-only/PdfViewer.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:pdf="clr-namespace:Syncfusion.Maui.PdfViewer;assembly=Syncfusion.Maui.PdfViewer"
             xmlns:model="clr-namespace:MAUI.Controls.PdfViewer.ReadOnly"
             x:Class="MAUI.Controls.PdfViewer.ReadOnly.PdfViewerView"
             x:DataType="model:PdfViewerViewModel"
             Title="PDF Viewer - Read Only">
    <ContentPage.Content>
        <syncfusion:SfPdfViewer
            x:Name="PdfViewer"
            DocumentSource="{Binding DocumentStream}"
            EnableTextSelection="False"
            DocumentLoaded="PdfViewer_DocumentLoaded">
        </syncfusion:SfPdfViewer>
    </ContentPage.Content>
</ContentPage>

```

### src/components/pdf-viewer-read-only/PdfViewer.xaml.cs

```cs
namespace MAUI.Controls.PdfViewer.ReadOnly
{
    public partial class PdfViewerView : ContentPage
    {
        TextSearchResult? SearchResult;
        public PdfViewerView(PdfViewerViewModel viewModel)
        {
            InitializeComponent();
            BindingContext = viewModel;

        }
        private void PdfViewer_DocumentLoaded(object sender, EventArgs e)
        {
            LockAllAnnotationsAndFields();
        }

        // Locks all the annotations and form fields in the document.
        void LockAllAnnotationsAndFields()
        {
            PdfViewer.AnnotationSettings.IsLocked = true;
            if (PdfViewer.FormFields?.Count > 0)
            {
                foreach (var field in PdfViewer.FormFields)
                {
                    field.ReadOnly = true;
                }
            }
        }
    }
}

```
