diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/App.config b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned.csproj b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned.csproj new file mode 100644 index 0000000..4d9a1e7 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned.csproj @@ -0,0 +1,101 @@ + + + + + Debug + AnyCPU + {1E372C90-E825-4BEA-8E5E-C06248940355} + WinExe + CheckPDFSignatureformFieldSigned + CheckPDFSignatureformFieldSigned + v4.8 + 512 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + WPFuserControl.xaml + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + Designer + MSBuild:Compile + + + + \ No newline at end of file diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned.sln b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned.sln new file mode 100644 index 0000000..03f5941 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35707.178 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckPDFSignatureformFieldSigned", "CheckPDFSignatureformFieldSigned.csproj", "{1E372C90-E825-4BEA-8E5E-C06248940355}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1E372C90-E825-4BEA-8E5E-C06248940355}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E372C90-E825-4BEA-8E5E-C06248940355}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E372C90-E825-4BEA-8E5E-C06248940355}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E372C90-E825-4BEA-8E5E-C06248940355}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned_NET.csproj b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned_NET.csproj new file mode 100644 index 0000000..83cb700 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned_NET.csproj @@ -0,0 +1,16 @@ + + + + WinExe + net8.0-windows + enable + true + true + enable + + + + + + + \ No newline at end of file diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned_NET.sln b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned_NET.sln new file mode 100644 index 0000000..b3b3910 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/CheckPDFSignatureformFieldSigned_NET.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34622.214 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckPDFSignatureformFieldSigned_NET", "CheckPDFSignatureformFieldSigned_NET.csproj", "{0E7C8E61-5F9D-4317-850E-F841C21D0171}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0E7C8E61-5F9D-4317-850E-F841C21D0171}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E7C8E61-5F9D-4317-850E-F841C21D0171}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E7C8E61-5F9D-4317-850E-F841C21D0171}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E7C8E61-5F9D-4317-850E-F841C21D0171}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6EBA9397-6151-47C2-BF88-D860FE2C4795} + EndGlobalSection +EndGlobal diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Data/1-output.pdf b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Data/1-output.pdf new file mode 100644 index 0000000..4ceb4c1 Binary files /dev/null and b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Data/1-output.pdf differ diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Data/1.pdf b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Data/1.pdf new file mode 100644 index 0000000..ad1ce70 Binary files /dev/null and b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Data/1.pdf differ diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Form1.Designer.cs b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Form1.Designer.cs new file mode 100644 index 0000000..fd83598 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Form1.Designer.cs @@ -0,0 +1,105 @@ +namespace CheckPDFSignatureformFieldSigned +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.btnSubmit = new System.Windows.Forms.Button(); + this.btnSignature = new System.Windows.Forms.Button(); + this.tableLayoutPanel1.SuspendLayout(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80.22222F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 19.77778F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 450); + this.tableLayoutPanel1.TabIndex = 0; + // + // panel1 + // + this.panel1.Controls.Add(this.btnSubmit); + this.panel1.Controls.Add(this.btnSignature); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(3, 364); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(794, 83); + this.panel1.TabIndex = 1; + // + // btnSubmit + // + this.btnSubmit.Location = new System.Drawing.Point(146, 3); + this.btnSubmit.Name = "btnSubmit"; + this.btnSubmit.Size = new System.Drawing.Size(149, 81); + this.btnSubmit.TabIndex = 1; + this.btnSubmit.Text = "Submit"; + this.btnSubmit.UseVisualStyleBackColor = true; + this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click); + // + // btnSignature + // + this.btnSignature.Location = new System.Drawing.Point(3, 3); + this.btnSignature.Name = "btnSignature"; + this.btnSignature.Size = new System.Drawing.Size(125, 81); + this.btnSignature.TabIndex = 0; + this.btnSignature.Text = "Signature"; + this.btnSignature.UseVisualStyleBackColor = true; + this.btnSignature.Click += new System.EventHandler(this.btnSignature_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.tableLayoutPanel1); + this.Name = "Form1"; + this.Text = "Form1"; + this.tableLayoutPanel1.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Button btnSignature; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Button btnSubmit; + } +} + diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Form1.cs b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Form1.cs new file mode 100644 index 0000000..3409bbd --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Form1.cs @@ -0,0 +1,124 @@ +using Syncfusion.Pdf.Interactive; +using Syncfusion.Pdf.Parsing; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Windows.Forms.Integration; + +namespace CheckPDFSignatureformFieldSigned +{ + public partial class Form1 : Form + { + ElementHost elementHost = null; + WPFuserControl wpfControl = null; + string inputFilePath,outputFilePath; + public Form1() + { + InitializeComponent(); + this.Load += Form1_Load; + } + + private void Form1_Load(object sender, EventArgs e) + { + elementHost = new ElementHost(); + elementHost.Margin = new Padding(0, 0, 0, 0); + elementHost.Region = new Region(); + elementHost.BackColor = System.Drawing.Color.White; + elementHost.AutoSize = true; + elementHost.Size = this.Size; + elementHost.Dock = DockStyle.Fill; + + //this.Controls.Add(elementHost); + tableLayoutPanel1.Controls.Add(elementHost); + + wpfControl = new WPFuserControl(); + elementHost.Child = wpfControl; + + this.WindowState = FormWindowState.Maximized; + } + + private void btnSignature_Click(object sender, EventArgs e) + { +#if NETCOREAPP + inputFilePath = @"../../../Data/1.pdf"; + outputFilePath = @"../../../Data/1-output.pdf"; +#else + inputFilePath = @"../../Data/1.pdf"; + outputFilePath = @"../../Data/1-output.pdf"; +#endif + wpfControl.LoadDocument(inputFilePath, outputFilePath); + } + + private void btnSubmit_Click(object sender, EventArgs e) + { + bool isSigned = false; + PdfLoadedDocument loadedDocument = wpfControl.pdfViewer.LoadedDocument; + if (loadedDocument.Form != null && loadedDocument.Form.Fields.Count > 0) + { + foreach (var field in loadedDocument.Form.Fields) + { + if (field is PdfLoadedSignatureField) + { + PdfLoadedSignatureField signatureField = field as PdfLoadedSignatureField; + if (signatureField.Page != null && signatureField.Page.Annotations.Count > 0) + { + foreach (var annotation in signatureField.Page.Annotations) + { + if (annotation is PdfLoadedInkAnnotation) + { + PdfLoadedInkAnnotation signature = annotation as PdfLoadedInkAnnotation; + if (signature.Name != signatureField.Name) + { + isSigned = false; + } + else + { + isSigned = true; + break; + } + } + else if (annotation is PdfInkAnnotation) + { + PdfInkAnnotation signature = annotation as PdfInkAnnotation; + if (signature.Name != signatureField.Name) + { + isSigned = false; + } + else + { + isSigned = true; + break; + } + } + } + if (!isSigned) + { + break; + } + } + else + { + isSigned = false; + break; + } + } + } + + if (!isSigned) + { + MessageBox.Show("There is some signature required"); + } + else + { + MessageBox.Show("All signatures are completed!"); + } + } + } + } +} diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Form1.resx b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Program.cs b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Program.cs new file mode 100644 index 0000000..91ce6e6 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CheckPDFSignatureformFieldSigned +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/AssemblyInfo.cs b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0aaa876 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyDescription("")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1e372c90-e825-4bea-8e5e-c06248940355")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Resources.Designer.cs b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Resources.Designer.cs new file mode 100644 index 0000000..b182323 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CheckPDFSignatureformFieldSigned.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CheckPDFSignatureformFieldSigned.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Resources.resx b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Settings.Designer.cs b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Settings.Designer.cs new file mode 100644 index 0000000..6befcaa --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CheckPDFSignatureformFieldSigned.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Settings.settings b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/WPFuserControl.xaml b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/WPFuserControl.xaml new file mode 100644 index 0000000..efc8ee6 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/WPFuserControl.xaml @@ -0,0 +1,19 @@ + + + + + + + + + diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/WPFuserControl.xaml.cs b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/WPFuserControl.xaml.cs new file mode 100644 index 0000000..013440e --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/WPFuserControl.xaml.cs @@ -0,0 +1,73 @@ +using Syncfusion.Pdf.Interactive; +using Syncfusion.Pdf.Parsing; +using Syncfusion.Pdf; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using UserControl = System.Windows.Controls.UserControl; + +namespace CheckPDFSignatureformFieldSigned +{ + /// + /// Interaction logic for WPFuserControl.xaml + /// + public partial class WPFuserControl : UserControl + { + public WPFuserControl() + { + InitializeComponent(); + } + + private void UserControl_Loaded(object sender, RoutedEventArgs e) + { + pdfViewer.IsEnabled = false; + } + + public void LoadDocument(string inputFile, string outputFile) + { + PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputFile); + + var pages = loadedDocument.Pages; + PdfLoadedPage page = pages[0] as PdfLoadedPage; + + PdfSignatureField signature = new PdfSignatureField(page, "Signature"); + signature.Bounds = new RectangleF(155, 590, 150, 24); + signature.ToolTip = "Sign Here"; + loadedDocument.Form.Fields.Add(signature); + + PdfTextBoxField vehicleEntry = new PdfTextBoxField(page, "VehicleEntry"); + vehicleEntry.Bounds = new RectangleF(128, 400, 75, 24); + vehicleEntry.BorderColor = new Syncfusion.Pdf.Graphics.PdfColor(0, 1, 1, 0); + //Add the form field to the document. + loadedDocument.Form.Fields.Add(vehicleEntry); + + PdfSignatureField initials = new PdfSignatureField(page, "Initials"); + initials.Bounds = new RectangleF(40, 775, 75, 24); + initials.ToolTip = "Initials Here"; + loadedDocument.Form.Fields.Add(initials); + + using (FileStream output = new FileStream(outputFile, FileMode.OpenOrCreate, FileAccess.ReadWrite)) + { + loadedDocument.Save(output); + } + + pdfViewer.Load(outputFile); + pdfViewer.ZoomMode = Syncfusion.Windows.PdfViewer.ZoomMode.FitPage; + pdfViewer.Visibility = Visibility.Visible; + pdfViewer.IsEnabled = true; + } + } +} diff --git a/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/packages.config b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/packages.config new file mode 100644 index 0000000..2cf5008 --- /dev/null +++ b/How-to/Validate-Signature-Form-Fields/CheckPDFSignatureformFieldSigned/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file