Working with Toolbar in .NET MAUI Pdf Viewer (SfPdfViewer)
16 Aug 202424 minutes to read
The SfPdfViewer has a built-in toolbar, which enhances PDF viewing and editing capabilities, allowing you to perform operations such as adding and modifying annotations, searching text, and more.
Toolbars structure
The SfPdfViewer features a built-in toolbar that utilizes multiple or multilevel toolbars. This design ensures that the user interface remains clean and accessible. We have incorporated multiple toolbars, such as top, bottom, and sub-toolbars for editing and choosing types, to ensure comprehensive functionality across various platforms. These toolbars are strategically organized based on the available screen space, adapting to different screen sizes on both mobile and desktop platforms. This approach ensures that tools are easily accessible, preventing the interface from becoming cluttered.
Need for using multiple toolbars
Depending on the available screen space, the SfPdfViewer organizes its tools into multiple or multilevel toolbars on mobile and desktop platforms. The use of multiple toolbars in the SfPdfViewer is essential to maintain a user-friendly interface. By separating tools into different toolbars, users can quickly find and use the tools they need without the interface becoming cluttered.
The names of these toolbars and its description are listed in the following sections.
Mobile toolbar names
Key | Description |
---|---|
TopToolbar | The toolbar appears at the top of the mobile PDF viewer. |
BottomToolbar | The annotation toolbar appears at the bottom of the mobile PDF viewer. |
RectangleAnnotationEditToolbar | The toolbar for editing rectangle annotations appears at the bottom of the mobile PDF viewer. |
CircleAnnotationEditToolbar | The toolbar for editing circle annotations appears at the bottom of the mobile PDF viewer. |
LineAnnotationEditToolbar | The toolbar for editing line annotations appears at the bottom of the mobile PDF viewer. |
ArrowAnnotationEditToolbar | The toolbar for editing arrow annotations appears at the bottom of the mobile PDF viewer. |
PolygonAnnotationEditToolbar | The toolbar for editing polygon annotations appears at the bottom of the mobile PDF viewer. |
PolylineAnnotationEditToolbar | The toolbar for editing polyline annotations appears at the bottom of the mobile PDF viewer. |
InkAnnotationEditToolbar | The toolbar for editing ink annotations appears at the bottom of the mobile PDF viewer. |
EraserEditToolbar | The toolbar for editing eraser annotations appears at the bottom of the mobile PDF viewer. |
FreeTextAnnotationEditToolbar | The toolbar for editing free text annotations appears at the bottom of the mobile PDF viewer. |
StickyNoteAnnotationEditToolbar | The toolbar for editing sticky note annotations appears at the bottom of the mobile PDF viewer. |
HighlightAnnotationEditToolbar | The toolbar for editing highlight annotations appears at the bottom of the mobile PDF viewer. |
StrikeOutAnnotationEditToolbar | The toolbar for editing strikeout annotations appears at the bottom of the mobile PDF viewer. |
UnderlineAnnotationEditToolbar | The toolbar for editing underline annotations appears at the bottom of the mobile PDF viewer. |
SquigglyAnnotationEditToolbar | The toolbar for editing squiggly annotations appears at the bottom of the mobile PDF viewer. |
StampAnnotationEditToolbar | The toolbar for editing stamp annotations appears at the bottom of the mobile PDF viewer. |
TextMarkupToolbar | The toolbar for editing text markup annotations appears at the bottom of the mobile PDF viewer. |
ShapeAnnotationsToolbar | The toolbar for editing shapes annotations appears at the bottom of the mobile PDF viewer. |
StickyNoteIconsToolbar | The toolbar for editing sticky note icons appears at the bottom of the mobile PDF viewer. |
SearchToolbar | The toolbar for text search appears at the top of the mobile PDF viewer. |
MoreOptionToolbar | The toolbar for more options appears at the top of the mobile PDF viewer. |
Desktop toolbar names
Keys | Description |
PrimaryToolbar | The toolbar, appears at the top of the desktop PDF viewer. |
AnnotationsToolbar | The annotation toolbar, appears at the below PrimaryToolbar of the desktop PDF viewer. |
RectangleAnnotationEditToolbar | The toolbar for editing rectangle annotations appears at the bottom of the desktop PDF viewer. |
CircleAnnotationEditToolbar | The toolbar for editing circle annotations appears at the bottom of the desktop PDF viewer. |
LineAnnotationEditToolbar | The toolbar for editing line annotations appears at the bottom of the desktop PDF viewer. |
ArrowAnnotationEditToolbar | The toolbar for editing arrow annotations appears at the bottom of the desktop PDF viewer. |
PolygonAnnotationEditToolbar | The toolbar for editing polygon annotations appears at the bottom of the desktop PDF viewer. |
PolylineAnnotationEditToolbar | The toolbar for editing polyline annotations appears at the bottom of the desktop PDF viewer. |
InkAnnotationEditToolbar | The toolbar for editing ink annotations appears at the bottom of the desktop PDF viewer. |
EraserEditToolbar | The toolbar for editing eraser annotations appears at the bottom of the desktop PDF viewer. |
FreeTextAnnotationEditToolbar | The toolbar for editing free text annotations appears at the bottom of the desktop PDF viewer. |
StickyNoteAnnotationEditToolbar | The toolbar for editing sticky note annotations appears at the bottom of the desktop PDF viewer. |
HighlightAnnotationEditToolbar | The toolbar for editing highlight annotations appears at the bottom of the desktop PDF viewer. |
StrikeOutAnnotationEditToolbar | The toolbar for editing strikeout annotations appears at the bottom of the desktop PDF viewer. |
UnderlineAnnotationEditToolbar | The toolbar for editing underline annotations appears at the bottom of the desktop PDF viewer. |
SquigglyAnnotationEditToolbar | The toolbar for editing squiggly annotations appears at the bottom of the desktop PDF viewer. |
StampAnnotationEditToolbar | The toolbar for editing stamp annotations appears at the bottom of the desktop PDF viewer. |
Show/hide the toolbars
The built-in toolbars are visible by default. In certain scenarios, you might want to hide all the toolbars in the PDF Viewer to display the document in full view or to use customized toolbars based on your application needs. You can do this by setting the ShowToolbars property of the PDF Viewer to false
. And you can show the built-in toolbar by setting the ShowToolbars property of the PDF Viewer to true
.
//set the ShowToolbars to false
public MainPage()
{
SfPdfViewer pdfViewer=new SfPdfViewer();
pdfViewer.ShowToolbars = false;
}
<ContentPage.Content>
<syncfusion:SfPdfViewer x:Name="pdfViewer" DocumentSource ="{Binding PdfDocumentStream} " ShowToolbars="False" />
</ContentPage.Content>
You can find the sample project from the link provided here.
Customize the toolbar
Sometimes, you might need to hide specific toolbars instead of all. This can be useful if you want to simplify the user interface by removing unnecessary tools or creating a more focused environment for certain tasks. The Toolbars collection property in the PDF Viewer allows you to hide a specific toolbar by using its index or name.
Hide specific toolbars by index
If you know the position of the toolbar you want to hide within the Toolbars collection, you can access and hide it using its index. For example, you can use the following code to hide the first and second toolbars in the collection.
/if (PdfViewer.Toolbars.Count > 1)
{
PdfViewer.Toolbars[0].IsVisible = false; // Hide the first toolbar
PdfViewer.Toolbars[1].IsVisible = false; // Hide the second toolbar
}
Hide specific toolbars by name
By using the GetByName method with its specified toolbar names, you can access the properties of those toolbars. After accessing the toolbar, you can modify its visibility by setting the IsVisible property. Here, we retrieve the toolbar “BottomToolbar” using the GetByName method and hide it by setting its visibility to false.
// On the mobile, we access the primary toolbar using the GetByName method.
var toolbar = pdfViewer.Toolbars?.GetByName("BottomToolbar");
if (toolbar != null)
{
toolbar.IsVisible = false; // Hide the bottom toolbar
}
Toolbar items
In SfPdfViewer, user can also manage the items within each toolbar of the PDF Viewer. This allows you to control which tools are available and how they are arranged, providing a tailored user experience that aligns with your application’s requirements.
The names of these toolbar items, along with their descriptions and availability in the toolbars, are listed in the following sections.
Mobile toolbar item names
Keys | Description | Item available in toolbars |
Undo | The button that appears in the top toolbar allows you to undo an action. | TopToolbar |
Redo | The button that appears in the top toolbar allows you to redo an action. | TopToolbar |
ZoomMode | The button that appears in the top toolbar allows you to adjust the magnification level of the PDF viewer content. | TopToolbar |
PageSettings | The button that appears in the top toolbar allows you to customize the page display and layout of the PDF viewer content. | TopToolbar |
Search | The button that appears in the top toolbar allows you to locate specific text or content in the document quickly. | TopToolbar |
MoreItem | The button that appears in the top toolbar allows you to expand the options available in the PDF Viewer. | TopToolbar |
TextMarkup | The button that appears in the bottom toolbar allows you to annotate text in the PDF Viewer. | BottomToolbar |
FreeText | The button that appears in the bottom toolbar allows you to add text annotations directly to the document in the PDF Viewer. | BottomToolbar |
Ink | The button that appears in the bottom toolbar allows you to draw freehand annotations. | BottomToolbar |
Eraser | The button that appears in the bottom toolbar allows you to erase the ink annotations in the PDF Viewer. | BottomToolbar |
Shape | The button that appears in the bottom toolbar allows you to add shapes to the document. | BottomToolbar |
Stamp | The button that appears in the bottom toolbar allows you to add the in-built and custom stamps. | BottomToolbar |
Signature | The button that appears in the bottom toolbar allows you to create and add the signature and indicate the signature annotation type. | BottomToolbar |
StickyNote | The button that appears in the bottom toolbar allows you to add the sticky note to the document. | BottomToolbar |
TextMarkupToolbarBackIcon | The button that appears in the text markup toolbar allows you to navigate back from the text markup toolbar. | TextMarkupToolbar |
Highlight | The button that appears in the text markup toolbar allows you to highlight the text in the document. | TextMarkupToolbar |
Underline | The button that appears in the text markup toolbar allows you to underline the text in the document. | TextMarkupToolbar |
StrikeOut | The button that appears in the text markup toolbar allows you to strikeout the text in the document. | TextMarkupToolbar |
Squiggly | The button that appears in the text markup toolbar allows you to add squiggly lines to the text in the document. | TextMarkupToolbar |
ShapeToolbarBackIcon | The button that appears in the shape toolbar allows you to navigate back from the shape toolbar. | ShapeAnnotationsToolbar |
Line | The button that appears in the shape toolbar allows you to draw a line in the document. | ShapeAnnotationsToolbar |
Arrow | The button that appears in the shape toolbar allows you to draw an arrow in the document. | ShapeAnnotationsToolbar |
Rectangle | The button that appears in the shape toolbar allows you to draw a rectangle in the document. | ShapeAnnotationsToolbar |
Circle | The button that appears in the shape toolbar allows you to draw a circle in the document. | ShapeAnnotationsToolbar |
Polygon | The button that appears in the shape toolbar allows you to draw polygons in the document. | ShapeAnnotationsToolbar |
Polyline | The button that appears in the shape toolbar allows you to draw polylines in the document. | ShapeAnnotationsToolbar |
Cloud | The button that appears in the shape toolbar allows you to draw a cloud in the document. | ShapeAnnotationsToolbar |
SecondaryAnnotationBackIcon | The button that appears in the annotation edit toolbars allows you to navigate back from the annotation edit toolbar. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar,StampAnnotationEditToolbar |
BackIconSeparator | The separator that appears in the annotation edit toolbar is positioned after the back button. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar,StampAnnotationEditToolbar |
AnnotationType | The button that appears in the annotation edit toolbar allows you to indicate the annotation type. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar |
BorderStyle | The button that appears in the cloud annotation edit toolbar allows you to indicate the cloud annotation. | PolygonAnnotationEditToolbar |
TextColor | The button that appears in the free text annotation edit toolbar allows you to change the free text color. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar. |
TextSize | The button that appears in the free text annotation edit toolbar allows you to change the text size. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, and StampAnnotationEditToolbar. |
TextPropertySeparator | The separator that appears in the free text annotation edit toolbar is positioned after the text size button. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, and StampAnnotationEditToolbar. |
Edit | The button that appears in the sticky note annotation edit toolbar allows you to edit text in the sticky note. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, and StampAnnotationEditToolbar. |
TextFillColor | The button that appears in the free text annotation edit toolbar allows you to set the fill color of the text box. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, and StampAnnotationEditToolbar. |
Thickness | The button that appears in the annotation edit toolbar allows you to set the thickness of the annotations. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, and StampAnnotationEditToolbar |
StokeColor | The button that appears in the annotation edit toolbar allows you to set the stroke color of the annotations. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, and StampAnnotationEditToolbar |
Notes | The button that appears in the top toolbar allows you to show the sticky note icons. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, and StampAnnotationEditToolbar |
FillColor | The button that appears in the annotation edit toolbar allows you to set the fill color of the annotations. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, and StampAnnotationEditToolbar. |
Opacity | The button that appears in the annotation edit toolbar allows you to set the opacity of the annotations. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, and StampAnnotationEditToolbar. |
DeleteSeparator | The separator that appears in the annotation edit toolbar positioned before the delete button. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, and StampAnnotationEditToolbar. |
Delete | The button that appears in the annotation edit toolbar allows you to delete the selected annotations. | HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, SquigglyAnnotationEditToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, and StampAnnotationEditToolbar. |
Note | The button that appears in the sticky note icons toolbar allows you to add note type of the sticky note. | StickyNoteIconsToolbarView |
Insert | The button that appears in the sticky note icons toolbar allows you to add insert type of the sticky note. | StickyNoteIconsToolbarView |
Comment | The button that appears in the sticky note icons toolbar allows you to add comment type of the sticky note. | StickyNoteIconsToolbarView |
Key | The button that appears in the sticky note icons toolbar allows you to add key type of the sticky note. | StickyNoteIconsToolbarView |
Help | The button that appears in the sticky note icons toolbar allows you to add help type of the sticky note. | StickyNoteIconsToolbarView |
Paragraph | The button that appears in the sticky note icons toolbar allows you to add paragraph type of the sticky note. | StickyNoteIconsToolbarView |
New Paragraph | The button that appears in the sticky note icons toolbar allows you to add new paragraph type of the sticky note. | StickyNoteIconsToolbarView |
Outline | The button that appears in the more option toolbar allows you to see the outline view of document. | MoreOptionToolbar |
The button that appears in the more option toolbar allows you to print the document from the PDF Viewer. | MoreOptionToolbar | |
SearchBackIcon | The button that appears in the search toolbar allows you to navigate back from the search toolbar. | SearchToolbar |
SearchEntry | The entry that appears in the search toolbar allows you to enter the text you want to search. | SearchToolbar |
SearchBusyIndicator | The button that appears in the search toolbar indicates an ongoing search. | SearchToolbar |
ClearSearch | The button that appears in the search toolbar allows you to clear the current search text. | SearchToolbar |
ClearSeparator | The separator that appears in the search toolbar is positioned after the clear button. | SearchToolbar |
PreviousSearch | The button that appears in the search toolbar allows you to navigate to the previous search result. | SearchToolbar |
NextSearch | The button that appears in the search toolbar allows you to navigate to the next search result. | SearchToolbar |
MoreOption | The button that appears in the search toolbar allows you to search with case sensitivity. | SearchToolbar |
Desktop toolbar item names
Keys | Description | Item available in toolbars |
Undo | The button that appears in the primary toolbar allows you to undo an action. | PrimaryToolbar |
Redo | The button that appears in the primary toolbar allows you to redo an action. | PrimaryToolbar |
Previous page | The button that appears in the primary toolbar allows you to navigate to the page before the current one in the PDF Viewer. | PrimaryToolbar |
Next page | The button that appears in the primary toolbar allows you to navigate to the page next to the current one in the PDF Viewer. | PrimaryToolbar |
Page number entry | The entry that appears in the primary toolbar allows you to navigate to the entered page number. | PrimaryToolbar |
Page count | The button that appears in the primary toolbar represents the total number of pages in the document. | PrimaryToolbar |
Zoom mode | The button that appears in the primary toolbar allows you to adjust the magnification level of the PDF viewer content. | PrimaryToolbar |
Annotations | The button that appears in the primary toolbar allows you to access the annotation toolbar. | |
The button that appears in the primary toolbar allows you to print the document from the PDF Viewer. | PrimaryToolbar | |
Outline | The button that appears in the primary toolbar allows you to see the outline view of the document. | PrimaryToolbar |
Search | The button that appears in the primary toolbar allows you to locate specific text or content in the document quickly. | PrimaryToolbar |
Page layout mode | The button that appears in the primary toolbar allows you to customize page display and layout in the PDF Viewer. | PrimaryToolbar |
Text markups | The button that appears in the annotation toolbar allows you to annotate text in the PDF Viewer. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Highlight | The button that appears in the annotation toolbar allows you to highlight the text in the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Underline | The button that appears in the annotation toolbar allows you to underline the text in the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Strikeout | The button that appears in the annotation toolbar allows you to strikeout the text in the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Squiggly | The button that appears in the annotation toolbar allows you to add squiggly lines to the text in the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Ink | The button that appears in the annotation toolbar allows you to draw freehand annotations. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Ink eraser | The button that appears in the annotation toolbar allows you to erase the ink annotations drawn in the document | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Free text | The button that appears in the annotation toolbar allows you to add text annotations directly to the document in the PDF Viewer. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Shapes | The button that appears in the annotation toolbar allows you to add different shapes to the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Square | The button that appears in the annotation toolbar allows you to draw a square in the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Circle | The button that appears in the annotation toolbar allows you to draw a circle in the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Line | The button that appears in the annotation toolbar allows you to draw a line in the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Arrow | The button that appears in the annotation toolbar allows you to draw an arrow in the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Polyline | The button that appears in the annotation toolbar allows you to draw polylines in the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Polygon | The button that appears in the annotation toolbar allows you to draw polygons in the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Cloud | The button that appears in the annotation toolbar allows you to draw a cloud on the document. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Stamps | The button that appears in the annotation toolbar allows you to add the inbuilt stamps and custom stamps. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Sticky note | The button that appears in the annotation toolbar allows you to add the sticky note to the document in the PDF Viewer. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Signature | The button that appears in the annotation toolbar allows you to create and add a signature. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Color picker | The button that appears in the annotation toolbar allows you to select and apply colors to the annotations. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Thickness | The button that appears in the annotation toolbar allows you to set the thickness of the annotations. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Delete | The button that appears in the annotation toolbar allows you to delete the selected annotation. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Sticky note icons | The button that appears in the annotation toolbar allows you to select the types of sticky note. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar. |
Font size | The button that appears in the annotation toolbar allows you to change the size of the text. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar |
ColorPickerSeparator | The separator that appears in the annotation toolbar is positioned before the color picker button. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar |
Close | The button that appears in the annotation toolbar allows you to close the annotation toolbar. | AnnotationsToolbar, LineAnnotationEditToolbar, ArrowAnnotationEditToolbar, RectangleAnnotationEditToolbar, CircleAnnotationEditToolbar, PolygonAnnotationEditToolbar, PolylineAnnotationEditToolbar, FreeTextAnnotationEditToolbar, InkAnnotationEditToolbar, EraserEditToolbar, StickyNoteAnnotationEditToolbar, StampAnnotationEditToolbar, HighlightAnnotationEditToolbar, UnderlineAnnotationEditToolbar, StrikeOutAnnotationEditToolbar, and SquigglyAnnotationEditToolbar |
PageCountSeparator | The separator that appears in the primary toolbar allows you to separate the page number entry and page count buttons. | PrimaryToolbar |
ZoomIconSeparator | The separator that appears in the primary toolbar is positioned before the Zoom mode button. | PrimaryToolbar |
AnnotationSeparator | The separator that appears in the primary toolbar is positioned before the annotations button. | PrimaryToolbar |
PrintSeparator | The separator that appears in the primary toolbar is positioned after the print button. | PrimaryToolbar |
MoreOptionSeparator | The separator that appears in the primary toolbar is positioned before the page layout mode. | PrimaryToolbar |
Customize toolbar items
In addition to customizing the visibility of toolbars, you can customize the items within each toolbar of the .NET MAUI PDF Viewer. This includes adding new items, removing existing ones, or rearranging their order to suit your app’s workflow better.
Adding a new toolbar item
To add an item to the toolbar in SfPdfViewer, first, create the UI element you want to include. Then, convert that element into a ToolbarItem using the ToolbarItem
method. Finally, add the newly created ToolbarItem to the toolbar using the Add
method. Here we create the new button fileOpenButton and retrieve the “PrimaryToolbar” using the GetByName method. Add the new button to the “Primary Toolbar”.
//Create a button you want to add.
Button fileOpenButton = new Button
{
Text = "\ue712",
FontSize = 24,
IsEnabled = false,
FontFamily = "Maui Material Assets",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
BackgroundColor = Colors.Transparent,
BorderColor = Colors.Transparent,
Padding = 10,
Margin = new Thickness(5, 0, 0, 0),
Opacity = 0.5
};
//We access the PrimaryToolbar on the desktop using the GetByName method and add the item you created in it.
pdfViewer.Toolbars?.GetByName("PrimaryToolbar")?.Items?.Add(new Syncfusion.Maui.PdfViewer.ToolbarItem(fileOpenButton, "FileOpenButton"));
Adding a new toolbar item at a specific index
To add an item at a specific index in the toolbar in SfPdfViewer, first create the UI element you want to include. Then, convert that element into a ToolbarItem using the ToolbarItem method. Finally, add the newly created ToolbarItem to the toolbar using the Insert method. Use the Index property to get the index of the item you want to add after, and insert the new item at a specific index. Here we create the button fileSaveButton and retrieve the index of the “Print” button in the “PrimaryToolbar”. The new button is inserted into the toolbar right after the “Print” button.
//Create a button you want to add.
Button fileSaveButton = new Button
{
Text = "\ue75f",
FontSize = 24,
FontFamily = "Maui Material Assets",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
BackgroundColor = Colors.Transparent,
BorderColor = Colors.Transparent,
IsEnabled = false,
Opacity = 0.5,
Padding = 10
};
//We access the PrimaryToolbar on the desktop using the GetByName method and get the item index using Index property.
var index = (int)pdfViewer?.Toolbars?.GetByName("PrimaryToolbar")?.Items?.GetByName("Print")?.Index;
// We accessed the PrimaryToolbar on the desktop using the GetByName method and inserted the item after the last item index.
pdfViewer.Toolbars?.GetByName("PrimaryToolbar")?.Items?.Insert(index+1, new Syncfusion.Maui.PdfViewer.ToolbarItem(fileSaveButton, "FileSaveButton"));
Remove Items from the Toolbar
If you need to remove specific items from the toolbar in SfPdfViewer, you can do so from the Items collection. You can remove them either by index or by name.
Remove Item by Index
You can access the specific item using its index and then remove it from the toolbar’s item collection using the Remove method. Here we retrieve the first item from the “TopToolbar” using its index. If the item is found, it is removed from the toolbar.
// Get the top toolbar of the PDF Viewer that contains annotation tools on mobile platforms.
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);
}
}
Remove Item by Name
you can access the specific item using the GetByName method and then remove it from the toolbar’s item collection using the Remove method. Here we retrieve the “Outline” item from the “PrimaryToolbar” using the GetByName method. If the item is found, it is removed from the toolbar.
//We access the outline item in the PrimaryToolbar on the desktop using the GetByName method and remove it.
var item = pdfViewer.Toolbars?.GetByName("PrimaryToolbar")?.Items?.GetByName("Outline");
if (item != null)
{
pdfViewer.Toolbars?.GetByName("PrimaryToolbar")?.Items?.Remove(item); // Remove the outline item
}
Remove item in all toolbars
In SfPdfViewer, each toolbar operates independently. Removing an item from one toolbar does not affect others. For example, removing the Sticky note icon from the “AnnotationsToolbar” does not impact other toolbars.
To remove an item from all toolbars, iterate through the toolbar collection and remove the item from each toolbar. Here’s how to remove the “Sticky note” item from all toolbars:
// Iterate through the toolbar collection of the PDF Viewer
for (int i = 0; i < pdfViewer?.Toolbars.Count; i++)
{
// Get the toolbar item with the name "Sticky note" from the current toolbar
var item = pdfViewer.Toolbars[i]?.Items?.GetByName("Sticky note");
if (item != null)
{
// Remove the "Sticky note" item
pdfViewer.Toolbars[i].Items.Remove(item);
}
}
You can find the sample project for removing an item from the desktop toolbar using the link provided here.
Hide items from the toolbar
If you need to hide specific items in the SfPdfViewer, you can do so by modifying the visibility of the items. You can hide them either by index or by name.
Hide Item by Index
To hide a toolbar item by its index, you can directly access the item in the toolbar’s Items collection using the index and then set its IsVisible property to false. Here’s how you can do it:
// Assuming you want to hide the item at a specific index in the PrimaryToolbar.
int indexToHide = 2; // Replace with the actual index of the item you want to hide.
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 by index
}
Hide item by name
By using the GetByName method with its specified toolbar names, you can access the items of those toolbars. After accessing the item, you can modify its visibility by setting the [IsVisible]https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.ToolbarItem.html#Syncfusion_Maui_PdfViewer_ToolbarItem_IsVisible property. Here, we retrieve the toolbar “PrimaryToolbar” and “Search” item using the GetByName method and hide the “Search” item by setting its visibility to false.
// On the desktop, we access the search button located in the primary toolbar using the GetByName method.
var item = pdfViewer.Toolbars?.GetByName("PrimaryToolbar")?.Items?.GetByName("Search");
if (item != null)
{
item.IsVisible = false; // Hide the search item
}
Hide item in all toolbars
In SfPdfViewer, each toolbar operates independently. Hiding an item in one toolbar does not affect others. For example, changing the visibility of the signature icon in the “AnnotationsToolbar” does not impact other toolbars.You can identify an item present in multiple toolbars by referring to the availability toolbar column in the toolbar item availability topic under the table of Mobile toolbar item names and Desktop toolbar item names.
To hide an icon from all toolbars, iterate through the toolbar collection and adjust the visibility of the item in each toolbar. Here’s how to hide the “Signature” icon from all toolbars:
// Iterate through the toolbar collection of the PDF Viewer
for (int i = 0; i < pdfViewer?.Toolbars.Count; i++)
{
// Get the toolbar item with the name "Signature" from the current toolbar
var item = pdfViewer.Toolbars[i]?.Items?.GetByName("Signature");
// Check if the item exists in the toolbar
if (item != null)
{
// Set the visibility of the "Signature" item to false, effectively hiding it
item.IsVisible = false; // Hide the Signature
}
}