Syncfusion AI Assistant

How can I help you?

Show and Hide Form Fields in .NET MAUI PDF Viewer (SfPdfViewer)

25 Mar 20262 minutes to read

The SfPdfViewer allows you to control the visibility of form fields using the IsHidden property. This is useful when you need to hide fields containing confidential data before sharing or presenting a document, or to reduce visual clutter in forms with many fields.

NOTE

  • Hiding and showing form fields supports undo and redo.
  • A form field that is locked cannot be hidden.
  • Hidden form fields remain hidden during import, export, printing, and saving.

Hide all form fields

To hide all form fields at once — for example, when presenting a document in view-only mode — set the IsHidden property to true for every field in the collection.

foreach (FormField formField in PdfViewer.FormFields)
{
    formField.IsHidden = true;
}

To show all form fields again, set IsHidden to false for each field.

foreach (FormField formField in PdfViewer.FormFields)
{
    formField.IsHidden = false;
}

Hide a specific form field

You can hide a specific form field by retrieving it from the collection and setting its IsHidden property. The following example hides a text form field named "name".

FormField formField = PdfViewer.FormFields.Where(x => x.Name == "name").FirstOrDefault();

if (formField is TextFormField nameTextBox)
{
    // Hide the text box field.
    nameTextBox.IsHidden = true;
}

To show the field again, set IsHidden to false.

if (formField is TextFormField nameTextBox)
{
    nameTextBox.IsHidden = false;
}

See Also