Articles in this section
Category / Section

How to save signature in a different format in .NET MAUI Signature Pad?

3 mins read

In the .NET MAUI Signature Pad, signatures can be saved with various image formats using the SaveAsImage method. This method allows saving signature images in both PNG and JPEG formats. The default format is PNG. To save as JPEG, include the .jpeg extension in the image name.

Note
To access the SaveAsImage method, use the Syncfusion.Maui.Core.Internals namespace.

XAML

<StackLayout Spacing="20" VerticalOptions="Center">
    <Frame HeightRequest="300" WidthRequest="400">
        <signaturePad:SfSignaturePad x:Name="signaturePad" 
                                     Background="White" />
    </Frame>
    <Button Text="Save" Clicked="SaveButton_Clicked"/>        
</StackLayout>

C#

To save the signature image in a PNG format:

using Syncfusion.Maui.Core.Internals;

namespace DifferentFormatSignatureImage
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void SaveButton_Clicked(object sender, EventArgs e)
        {
            // To save image as .png format
            signaturePad.SaveAsImage("sign");
        }
    }
}

To save the signature image in a JPEG format:

using Syncfusion.Maui.Core.Internals;

namespace DifferentFormatSignatureImage
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void SaveButton_Clicked(object sender, EventArgs e)
        {
            // To save image as .jpeg format
            signaturePad.SaveAsImage("sign.jpeg");
        }
    }
}

Note

  • Saved Location: For Windows, Android, and Mac, the image is saved in the Pictures folder. For iOS, it is saved in the Photos Album folder.

  • In Windows and Mac, saving with an existing filename replaces the old file.

  • In Android, when you save the same view with an existing filename, the new image will be saved with a filename with a number appended to it, for example, sign(1).jpeg, and the existing filename sign.jpeg will be removed. When you save a different view with an already existing filename, the new image will be saved with a filename with a number appended to it, for example, sign(1).jpeg, and the existing filename sign.jpeg will remain in the folder.

  • In iOS, the default filename is used (e.g., IMG_001.jpeg).

Output

Windows:

image.png

Android:

image.png

Download the complete sample from GitHub

Conclusion

I hope you enjoyed learning how to save the signature in different image formats in the .NET MAUI Signature Pad.

For more details, visit our .NET MAUI Signature Pad’s feature tour and explore the .NET MAUI Signature Pad documentation.

For current customers, check out our .NET MAUI components on this License and downloads page. If you are new to Syncfusion®, try our 30-day free trial to explore our .NET MAUI Signature Pad and other .NET MAUI components.

For any queries or clarifications, please comment below, or contact us through our support forums, Direct-Trac, and feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied