Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Add-digital-signature-invisible/Add-digital-signature-invisible.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Add_digital_signature_invisible</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Template.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Data\certificate.pfx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Office;

namespace Add_digital_signature_invisible
{
class Program
{
static void Main(string[] args)
{
//Opens an existing Word document.
WordDocument document = new WordDocument(Path.GetFullPath(@"Data\Template.docx"));
//Loads the signing certificate from disk.
OfficeDigitalSignatureCertificate certificate = new OfficeDigitalSignatureCertificate(Path.GetFullPath(@"Data\certificate.pfx"), "password123");
//Configures signature settings.
SignatureSettings settings = new SignatureSettings();
settings.Comments = "Approved";
settings.SignTime = DateTime.Now;
//Adds an invisible digital signature to the document using the certificate and settings.
document.AddDigitalSignature(certificate, settings);
//Saves the Word document to file.
document.Save(Path.GetFullPath(@"Output\Result.docx"), FormatType.Docx);
//Closes the document
document.Close();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Insert-signature-line/Insert-signature-line.csproj" />
</Solution>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Insert_signature_line</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Template.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>


</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Office;

namespace Insert_signature_line
{
class Program
{
static void Main(string[] args)
{
//Opens an existing Word document.
WordDocument document = new WordDocument(Path.GetFullPath(@"Data\Template.docx"));
//Gets the first section of the document.
IWSection section = document.Sections[0];
//Adds new paragraph to the section.
IWParagraph paragraph = section.AddParagraph();
//Adds new text to the paragraph
paragraph.AppendText("Please sign below: ");
//Adds a new paragraph that will host the signature line.
IWParagraph signatureParagraph = section.AddParagraph();
//Configures the signature line settings.
SignatureLineSettings settings = new SignatureLineSettings();
settings.Signer = "John Doe";
settings.SignerTitle = "Manager";
settings.Email = "john.doe@example.com";
settings.Instructions = "Please review and sign.";
settings.AllowComments = true;
settings.ShowDate = true;
//Inserts the signature line into the new paragraph with the specified dimensions.
IWPicture picture = signatureParagraph.AppendSignatureLine(settings, 200, 100);
//Saves the Word document to file.
document.Save(Path.GetFullPath(@"Output\Result.docx"), FormatType.Docx);
//Closes the document
document.Close();
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Inspect-digital-signature/Inspect-digital-signature.csproj" />
</Solution>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Inspect_digital_signature</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\SignedDocument.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Office;

namespace Inspect_digital_signature
{
class Program
{
static void Main(string[] args)
{
//Opens the signed Word document.
WordDocument document = new WordDocument(Path.GetFullPath(@"Data\SignedDocument.docx"));
// Gets the digital signature collection in the document.
OfficeDigitalSignatureCollection signatures = document.DigitalSignatures;

// Checks whether every digital signature in the collection is valid.
bool allValid = signatures.IsValid;
Console.WriteLine("All signatures are valid: " + allValid);

// Displays details of each signature.
foreach (OfficeDigitalSignature signature in signatures)
{
Console.WriteLine("Signature comments: " + signature.Comments);
Console.WriteLine("Time of signing: " + signature.SigningTime);
Console.WriteLine("Subject name: " +
signature.Certificate.Subject);
Console.WriteLine("Issuer name: " +
signature.Certificate.Issuer);
Console.WriteLine();
}

// Closes the document.
document.Close();
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Remove-digital-signature/Remove-digital-signature.csproj" />
</Solution>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Office;

namespace Remove_digital_signature
{
class Program
{
static void Main(string[] args)
{
//Opens the signed Word document.
WordDocument document = new WordDocument(Path.GetFullPath(@"Data\SignedDocument.docx"));
//Removes all digital signatures from the document.
document.RemoveAllDigitalSignatures();
//Saves the Word document to file.
document.Save(Path.GetFullPath(@"Output\Result.docx"), FormatType.Docx);
//Closes the document
document.Close();
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Remove_digital_signature</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\SignedDocument.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Sign-multiple-signature-lines/Sign-multiple-signature-lines.csproj" />
</Solution>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Office;

namespace Sign_multiple_signature_lines
{
class Program
{
static void Main(string[] args)
{
// Opens an existing Word document and adds signature lines.
Dictionary<Guid, string> signatureInfo;
using (WordDocument document = new WordDocument(Path.GetFullPath(@"Data\Template.docx")))
{
// Gets the last section of the document.
IWSection section = document.LastSection;

// Stores the signature line IDs and corresponding signature image paths.
signatureInfo = new Dictionary<Guid, string>();

// Defines the signers.
string[] signers = { "Tony", "Steve", "Bruce" };

// Defines the signature images corresponding to each signer.
string[] images =
{
Path.GetFullPath(@"Data\TonySignature.png"),
Path.GetFullPath(@"Data\SteveSignature.png"),
Path.GetFullPath(@"Data\BruceSignature.png")
};

// Adds a signature line for each signer.
for (int i = 0; i < signers.Length; i++)
{
IWParagraph paragraph = section.AddParagraph();

IWPicture picture = paragraph.AppendSignatureLine(
new SignatureLineSettings()
{
Signer = signers[i],
SignerTitle = "Approver",
Email = signers[i] + "@example.com",
Instructions = "Please review and sign.",
ShowDate = true
},
192,
96);

// Gets the unique identifier of the inserted signature line.
Guid signatureLineId = ((WPicture)picture).SignatureLine.Id;

// Maps the signature line to its corresponding signature image.
signatureInfo.Add(signatureLineId, images[i]);
}

// Saves the document after adding the signature lines.
document.Save(Path.GetFullPath(@"Output\Result.docx"), FormatType.Docx);
}

// Loads the signing certificate.
OfficeDigitalSignatureCertificate certificate =
new OfficeDigitalSignatureCertificate(
Path.GetFullPath(@"Data\certificate.pfx"),
"password123");

// Opens the saved document to sign each signature line.
using (WordDocument document = new WordDocument(Path.GetFullPath(@"Output\Result.docx")))
{
// Signs each signature line using its corresponding signature image.
foreach (KeyValuePair<Guid, string> item in signatureInfo)
{
SignatureSettings settings = new SignatureSettings()
{
SignatureLineId = item.Key,
SignatureLineImage = File.ReadAllBytes(item.Value),
Comments = "Approved",
SignTime = DateTime.Now
};

document.AddDigitalSignature(certificate, settings);
}

// Saves the signed document.
document.Save(Path.GetFullPath(@"Output\Result.docx"), FormatType.Docx);
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Sign_multiple_signature_lines</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Template.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Data\certificate.pfx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Data\TonySignature.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Data\SteveSignature.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Data\BruceSignature.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Sign-signature-line/Sign-signature-line.csproj" />
</Solution>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading
Loading