Skip to content

Commit 99468d3

Browse files
Merge pull request #149 from SyncfusionExamples/937636
937636 Modified the code changes for digital signature.
2 parents b1af7fa + 99101c5 commit 99468d3

5 files changed

Lines changed: 39 additions & 37 deletions

File tree

Digital Signature/New folder/.NET/Verify-digital-sign-in-existing-PDF.sln renamed to Digital Signature/Check-If-PDF-Is-Signed/.NET/Check-If-PDF-Is-Signed.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.12.35707.178 d17.12
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Verify-digital-sign-in-existing-PDF", "Verify-digital-sign-in-existing-PDF\Verify-digital-sign-in-existing-PDF.csproj", "{3DD425D8-40B2-4D5E-8ADD-66522B701503}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Check-If-PDF-Is-Signed", "Check-If-PDF-Is-Signed\Check-If-PDF-Is-Signed.csproj", "{3DD425D8-40B2-4D5E-8ADD-66522B701503}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution

Digital Signature/New folder/.NET/Verify-digital-sign-in-existing-PDF/Verify-digital-sign-in-existing-PDF.csproj renamed to Digital Signature/Check-If-PDF-Is-Signed/.NET/Check-If-PDF-Is-Signed/Check-If-PDF-Is-Signed.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net8.0</TargetFramework>
6-
<RootNamespace>Verify_digital_sign_in_existing_PDF</RootNamespace>
6+
<RootNamespace>Check-If-PDF-Is-Signed</RootNamespace>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
99
</PropertyGroup>

Digital Signature/New folder/.NET/Verify-digital-sign-in-existing-PDF/Data/Input.pdf renamed to Digital Signature/Check-If-PDF-Is-Signed/.NET/Check-If-PDF-Is-Signed/Data/Input.pdf

File renamed without changes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.IO;
3+
using System.Reflection.Metadata;
4+
using Syncfusion.Pdf.Parsing;
5+
6+
7+
// Open the signed PDF file for reading
8+
using (FileStream inputFileStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
9+
{
10+
// Load the PDF document
11+
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputFileStream);
12+
13+
// Check if the document contains a form with fields
14+
if (loadedDocument.Form == null || loadedDocument.Form.Fields.Count == 0)
15+
{
16+
Console.WriteLine("No signature fields found in the document.");
17+
}
18+
else
19+
{
20+
// Iterate through all fields in the form
21+
foreach (PdfLoadedField field in loadedDocument.Form.Fields)
22+
{
23+
// Check if the field is a signature field
24+
PdfLoadedSignatureField signatureField = field as PdfLoadedSignatureField;
25+
if (signatureField != null)
26+
{
27+
// Determine whether the signature field is signed or not
28+
string status = signatureField.IsSigned ? "Signed" : "UnSigned";
29+
30+
// Output the result for each signature field
31+
Console.WriteLine("Signature Field " + signatureField.Name + " is: " + status);
32+
}
33+
}
34+
}
35+
//Close the document
36+
loadedDocument.Close(true);
37+
}

Digital Signature/New folder/.NET/Verify-digital-sign-in-existing-PDF/Program.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)