Skip to content

Commit 46536ec

Browse files
Merge pull request #71 from SyncfusionExamples/Signature
How to Add Electronic Signatures to PDF Documents Using .NET MAUI PDF Viewer
2 parents 992dbc8 + 5c94bde commit 46536ec

40 files changed

+1203
-0
lines changed

Videos/Signature/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Electronic Signatures in .NET MAUI PDF Viewer
2+
3+
This repository provides an example of how to add electronic signatures in a PDF document using the Syncfusion .NET MAUI PDF Viewer. It demonstrates how users can interactively insert handwritten, image-based, and freehand signatures into a PDF file.
4+
5+
## Process behind PDF signature integration
6+
7+
The sample showcases how different types of signatures can be programmatically added to a loaded PDF document. Users can enable signature mode for freehand input, insert predefined handwritten signatures using ink points, and embed image-based signatures at specific locations. These features allow for flexible and interactive signing experiences within the application.
8+
9+
Signature types supported in this sample:
10+
- **Handwritten Signature**: A predefined ink stroke rendered on the PDF.
11+
- **Image Signature**: A signature image embedded at a specified location.
12+
- **Freehand Signature**: User-drawn signature using touch or mouse input.
13+
14+
## Steps to use the sample
15+
16+
1. Run the application to load a sample PDF document embedded in the project.
17+
2. Use the toolbar buttons to perform signature actions:
18+
- **Add Signature**: Enables freehand signature mode for user input.
19+
- **Add Handwritten Signature**: Inserts a predefined ink signature on a specified page.
20+
- **Add Image Signature**: Embeds a signature image at a defined location on the PDF.
21+
22+
This sample demonstrates how to integrate electronic signature capabilities into your .NET MAUI application using Syncfusion's PDF Viewer control.

Videos/Signature/Signature.sln

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Signature", "Signature\Signature.csproj", "{C0ADA15D-EEAE-461A-B1DE-F383458E184D}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{C0ADA15D-EEAE-461A-B1DE-F383458E184D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{C0ADA15D-EEAE-461A-B1DE-F383458E184D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{C0ADA15D-EEAE-461A-B1DE-F383458E184D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
17+
{C0ADA15D-EEAE-461A-B1DE-F383458E184D}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{C0ADA15D-EEAE-461A-B1DE-F383458E184D}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{C0ADA15D-EEAE-461A-B1DE-F383458E184D}.Release|Any CPU.Deploy.0 = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(SolutionProperties) = preSolution
22+
HideSolutionNode = FALSE
23+
EndGlobalSection
24+
EndGlobal
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version = "1.0" encoding = "UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:Signature"
5+
x:Class="Signature.App">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
10+
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
11+
</ResourceDictionary.MergedDictionaries>
12+
</ResourceDictionary>
13+
</Application.Resources>
14+
</Application>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Signature
2+
{
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
9+
MainPage = new AppShell();
10+
}
11+
}
12+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Shell
3+
x:Class="Signature.AppShell"
4+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6+
xmlns:local="clr-namespace:Signature"
7+
Shell.FlyoutBehavior="Disabled"
8+
Title="Signature">
9+
10+
<ShellContent
11+
Title="Home"
12+
ContentTemplate="{DataTemplate local:MainPage}"
13+
Route="MainPage" />
14+
15+
</Shell>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Signature
2+
{
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}
10+
}
15 KB
Binary file not shown.
1.53 KB
Loading
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
2+
xmlns:syncfusion="clr-namespace:Syncfusion.Maui.PdfViewer;assembly=Syncfusion.Maui.PdfViewer"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
x:Class="Signature.MainPage">
5+
6+
<ContentPage.Content>
7+
<Grid>
8+
<!-- Define layout with two rows: one for header/buttons, one for PDF viewer -->
9+
<Grid.RowDefinitions>
10+
<RowDefinition Height="40" />
11+
<RowDefinition Height="*" />
12+
</Grid.RowDefinitions>
13+
14+
<!-- Top row: Header and action buttons -->
15+
<Grid Grid.Row="0" ColumnDefinitions="Auto,*">
16+
<!-- Title label for the PDF viewer -->
17+
<Label Text="PDF Viewer"
18+
FontSize="16"
19+
VerticalOptions="Center"
20+
Grid.Column="0"
21+
Margin="10,0,0,0" />
22+
23+
<!-- Scrollable horizontal layout for signature action buttons -->
24+
<ScrollView Orientation="Horizontal"
25+
HorizontalScrollBarVisibility="Never"
26+
HorizontalOptions="End"
27+
Grid.Column="1">
28+
<HorizontalStackLayout Spacing="10" Padding="0,0,15,0">
29+
<!-- Button to enable signature drawing mode -->
30+
<Button Text="Add Signature"
31+
Clicked="OnAddSignatureClicked" />
32+
33+
<!-- Button to add a predefined handwritten signature -->
34+
<Button Text="Add Handwritten Signature"
35+
Clicked="OnAddHandwrittenSignatureClicked" />
36+
37+
<!-- Button to add an image-based signature -->
38+
<Button Text="Add Image Signature"
39+
Clicked="OnAddImageSignatureClicked" />
40+
</HorizontalStackLayout>
41+
</ScrollView>
42+
</Grid>
43+
44+
<!-- Main content: PDF viewer control without toolbars -->
45+
<syncfusion:SfPdfViewer x:Name="PdfViewer"
46+
ShowToolbars="False"
47+
Grid.Row="1" />
48+
</Grid>
49+
</ContentPage.Content>
50+
</ContentPage>

0 commit comments

Comments
 (0)