Skip to content

972249 - How to include Open and Save options in the built-in toolbar? #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Nandhakumar-SF4686
Copy link
Collaborator

This sample shows how to include the save and open options in the built-in toolbar and how to create and handle the custom DocumentSaveInitiated event.

using System.Runtime.Versioning;
using UIKit;

namespace InsertToolbarItems
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you avoid the duplicate codes in mac and iOS by ignoring one file or grouping it?
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have done it platform wise.

Copy link
Collaborator

@Deepak1799 Deepak1799 Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not possible to optimize or use the same iOS.cs in mac?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have optimized it

1. A .NET MAUI project set up.
2. The [Syncfusion.Maui.PdfViewer](https://www.nuget.org/packages/Syncfusion.Maui.PdfViewer) package is installed.

## To Include open and save option in built-in toolbar
Copy link
Collaborator

@Deepak1799 Deepak1799 Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Before defining a clicked event, its event handler should not be exposed.

I have previously asked you to implement logic for Open and Save document. You may create as separate method under the topic. Later, call the method in the event handler later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have followed the outline and changed the content sir


## To Include open and save option in built-in toolbar

To insert an item at a specific index in the toolbar in [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html), begin by creating the desired UI element. Next, convert that element into a [ToolbarItem](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.ToolbarItem.html#Syncfusion_Maui_PdfViewer_ToolbarItem__ctor_Microsoft_Maui_Controls_View_System_String) using the ToolbarItem method. Finally, add the newly created ToolbarItem to the toolbar using the [Insert](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.ToolbarItemCollection.html#Syncfusion_Maui_PdfViewer_ToolbarItemCollection_Insert_System_Int32_Syncfusion_Maui_PdfViewer_ToolbarItem_) or [Add](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.ToolbarItemCollection.html#Syncfusion_Maui_PdfViewer_ToolbarItemCollection_Add_Syncfusion_Maui_PdfViewer_ToolbarItem_) method. Here we are using [Insert](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.ToolbarItemCollection.html#Syncfusion_Maui_PdfViewer_ToolbarItemCollection_Insert_System_Int32_Syncfusion_Maui_PdfViewer_ToolbarItem_) method to include the open and save button in the toolbar item.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is add-on (out of topic), you can better ignore this in readme and implementation
image

Copy link
Collaborator Author

@Nandhakumar-SF4686 Nandhakumar-SF4686 Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Deepak1799 sir,
In the task description, they mentioned to include the DocumentSaveInitiated event sir.
image
So only I have added the DocumentSaveInitiated event topic sir

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the content

this.DocumentSaveInitiated += MainPage_DocumentSaveInitiated;
```

### Step 5: Invoke DocumentSaveInitiated event in the save button event handler.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the content with the outline given sir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants