Skip to content

Commit 7413451

Browse files
authored
Merge pull request #76 from SyncfusionExamples/916565ToolbarCustomization
916598 - How to detect whether changes are made in the PDF document?
2 parents 46536ec + a09a166 commit 7413451

40 files changed

+1375
-0
lines changed

DetectPdfChanges/App.xaml

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:DetectPdfChanges"
5+
x:Class="DetectPdfChanges.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>

DetectPdfChanges/App.xaml.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace DetectPdfChanges
2+
{
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("Add Valid License");
8+
InitializeComponent();
9+
}
10+
11+
protected override Window CreateWindow(IActivationState? activationState)
12+
{
13+
return new Window(new AppShell());
14+
}
15+
}
16+
}

DetectPdfChanges/AppShell.xaml

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+
<Shell
3+
x:Class="DetectPdfChanges.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:DetectPdfChanges"
7+
Title="DetectPdfChanges">
8+
9+
<ShellContent
10+
Title="Home"
11+
ContentTemplate="{DataTemplate local:MainPage}"
12+
Route="MainPage" />
13+
14+
</Shell>

DetectPdfChanges/AppShell.xaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace DetectPdfChanges
2+
{
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}
10+
}
63.8 KB
Binary file not shown.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
6+
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
7+
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</TargetFrameworks> -->
8+
9+
<!-- Note for MacCatalyst:
10+
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
11+
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
12+
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
13+
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
14+
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
15+
16+
<OutputType>Exe</OutputType>
17+
<RootNamespace>DetectPdfChanges</RootNamespace>
18+
<UseMaui>true</UseMaui>
19+
<SingleProject>true</SingleProject>
20+
<ImplicitUsings>enable</ImplicitUsings>
21+
<Nullable>enable</Nullable>
22+
23+
<!-- Display name -->
24+
<ApplicationTitle>DetectPdfChanges</ApplicationTitle>
25+
26+
<!-- App Identifier -->
27+
<ApplicationId>com.companyname.detectpdfchanges</ApplicationId>
28+
29+
<!-- Versions -->
30+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
31+
<ApplicationVersion>1</ApplicationVersion>
32+
33+
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
34+
<WindowsPackageType>None</WindowsPackageType>
35+
36+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
37+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
38+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
39+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
40+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
41+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
42+
</PropertyGroup>
43+
44+
<ItemGroup>
45+
<!-- App Icon -->
46+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
47+
48+
<!-- Splash Screen -->
49+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
50+
51+
<!-- Images -->
52+
<MauiImage Include="Resources\Images\*" />
53+
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
54+
55+
<!-- Custom Fonts -->
56+
<MauiFont Include="Resources\Fonts\*" />
57+
58+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
59+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
60+
</ItemGroup>
61+
62+
<ItemGroup>
63+
<None Remove="Assets\form_document.pdf" />
64+
</ItemGroup>
65+
66+
<ItemGroup>
67+
<EmbeddedResource Include="Assets\form_document.pdf" />
68+
</ItemGroup>
69+
70+
<ItemGroup>
71+
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
72+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
73+
<PackageReference Include="Syncfusion.Maui.PdfViewer" Version="*" />
74+
</ItemGroup>
75+
76+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36203.30 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DetectPdfChanges", "DetectPdfChanges.csproj", "{EE2D7816-9746-44D3-B79D-5A332BA94360}"
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+
{EE2D7816-9746-44D3-B79D-5A332BA94360}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{EE2D7816-9746-44D3-B79D-5A332BA94360}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{EE2D7816-9746-44D3-B79D-5A332BA94360}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{EE2D7816-9746-44D3-B79D-5A332BA94360}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {C193A17D-474D-428F-A7E1-CDF6640246CF}
24+
EndGlobalSection
25+
EndGlobal

DetectPdfChanges/MainPage.xaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:syncfusion="clr-namespace:Syncfusion.Maui.PdfViewer;assembly=Syncfusion.Maui.PdfViewer"
5+
xmlns:local="clr-namespace:DetectPdfChanges"
6+
x:DataType="local:PdfViewerViewModel"
7+
x:Class="DetectPdfChanges.MainPage">
8+
9+
<ContentPage.BindingContext>
10+
<local:PdfViewerViewModel />
11+
</ContentPage.BindingContext>
12+
<ContentPage.Content>
13+
<syncfusion:SfPdfViewer x:Name="PdfViewer"
14+
DocumentSource="{Binding PdfDocumentStream}"
15+
FormFieldValueChanged="PdfViewer_FormFieldValueChanged"
16+
AnnotationAdded="PdfViewer_AnnotationAdded"
17+
AnnotationEdited="PdfViewer_AnnotationEdited"
18+
AnnotationRemoved="PdfViewer_AnnotationRemoved"/>
19+
</ContentPage.Content>
20+
</ContentPage>

DetectPdfChanges/MainPage.xaml.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using Syncfusion.Maui.PdfViewer;
2+
3+
namespace DetectPdfChanges
4+
{
5+
public partial class MainPage : ContentPage
6+
{
7+
public MainPage()
8+
{
9+
InitializeComponent();
10+
}
11+
12+
private async void PdfViewer_FormFieldValueChanged(object sender, FormFieldValueChangedEventArgs e)
13+
{
14+
var page = Application.Current?.Windows?.FirstOrDefault()?.Page;
15+
if (page is null)
16+
return;
17+
18+
await page.DisplayAlertAsync("PDF Edited", $"{e.FormField} value is changed.", "OK");
19+
}
20+
21+
private async void PdfViewer_AnnotationAdded(object sender, AnnotationEventArgs e)
22+
{
23+
var page = Application.Current?.Windows?.FirstOrDefault()?.Page;
24+
if (page is null)
25+
return;
26+
await page.DisplayAlertAsync("PDF Edited", "Annotation is added.", "OK");
27+
}
28+
29+
private async void PdfViewer_AnnotationEdited(object sender, AnnotationEventArgs e)
30+
{
31+
var page = Application.Current?.Windows?.FirstOrDefault()?.Page;
32+
if (page is null)
33+
return;
34+
await page.DisplayAlertAsync("PDF Edited", $"Annotation is edited.", "OK");
35+
}
36+
37+
private async void PdfViewer_AnnotationRemoved(object sender, AnnotationEventArgs e)
38+
{
39+
var page = Application.Current?.Windows?.FirstOrDefault()?.Page;
40+
if (page is null)
41+
return;
42+
await page.DisplayAlertAsync("PDF Edited", $"Annotation is removed.", "OK");
43+
}
44+
}
45+
}

DetectPdfChanges/MauiProgram.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.Extensions.Logging;
2+
using Syncfusion.Maui.Core.Hosting;
3+
4+
namespace DetectPdfChanges
5+
{
6+
public static class MauiProgram
7+
{
8+
public static MauiApp CreateMauiApp()
9+
{
10+
var builder = MauiApp.CreateBuilder();
11+
builder
12+
.UseMauiApp<App>()
13+
.ConfigureSyncfusionCore()
14+
.ConfigureFonts(fonts =>
15+
{
16+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
17+
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
18+
});
19+
20+
#if DEBUG
21+
builder.Logging.AddDebug();
22+
#endif
23+
24+
return builder.Build();
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)