diff --git a/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations.sln b/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations.sln
new file mode 100644
index 00000000..f047c4b7
--- /dev/null
+++ b/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.14.36408.4 d17.14
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adding-quad-points-to-existing-redaction-annotations", "Adding-quad-points-to-existing-redaction-annotations\Adding-quad-points-to-existing-redaction-annotations.csproj", "{7EAC121E-76EB-4D12-AF60-D457BE069660}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7EAC121E-76EB-4D12-AF60-D457BE069660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7EAC121E-76EB-4D12-AF60-D457BE069660}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7EAC121E-76EB-4D12-AF60-D457BE069660}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7EAC121E-76EB-4D12-AF60-D457BE069660}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {AC2186CF-C132-4B74-9E9B-995A2480B219}
+ EndGlobalSection
+EndGlobal
diff --git a/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Adding-quad-points-to-existing-redaction-annotations.csproj b/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Adding-quad-points-to-existing-redaction-annotations.csproj
new file mode 100644
index 00000000..88eef3cf
--- /dev/null
+++ b/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Adding-quad-points-to-existing-redaction-annotations.csproj
@@ -0,0 +1,15 @@
+
+
+
+ Exe
+ net8.0
+ Adding_quad_points_to_existing_redaction_annotations
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Data/Input.pdf b/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Data/Input.pdf
new file mode 100644
index 00000000..926334bb
Binary files /dev/null and b/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Data/Input.pdf differ
diff --git a/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Output/.gitkeep b/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Output/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Program.cs b/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Program.cs
new file mode 100644
index 00000000..af65881b
--- /dev/null
+++ b/Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Program.cs
@@ -0,0 +1,44 @@
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
+// Load the existing PDF document using FileStream
+using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
+{
+ // Load the PDF document from the input stream
+ using (PdfLoadedDocument ldoc = new PdfLoadedDocument(inputStream))
+ {
+ //Load the existing PdfLoadedRedactionAnnotation
+ PdfLoadedRedactionAnnotation annot = ldoc.Pages[0].Annotations[0] as PdfLoadedRedactionAnnotation;
+
+ //set the bounds
+ List bounds = new List();
+ bounds.Add(new RectangleF(100, 100, 50, 20));
+ bounds.Add(new RectangleF(200, 150, 60, 25));
+ annot.BoundsCollection = bounds;
+
+ //set the inner color
+ annot.InnerColor = Color.Black;
+ //set the border color
+ annot.BorderColor = Color.Green;
+ //set the text color
+ annot.TextColor = Color.Yellow;
+ //set the font
+ annot.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 10);
+ //set overlay text
+ annot.OverlayText = "Redact";
+ //set text alignment
+ annot.TextAlignment = PdfTextAlignment.Center;
+ annot.RepeatText = true;
+
+ // Save the modified document using a new FileStream
+ using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.Write))
+ {
+ // Save changes to a new PDF file
+ ldoc.Save(outputStream);
+ }
+ // Close the document and release resources
+ ldoc.Close(true);
+ }
+}
diff --git a/Annotation/Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points.sln b/Annotation/Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points.sln
new file mode 100644
index 00000000..a014588b
--- /dev/null
+++ b/Annotation/Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.14.36408.4 d17.14
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Multi-line-text-redaction-using-quad-points", "Multi-line-text-redaction-using-quad-points\Multi-line-text-redaction-using-quad-points.csproj", "{4ACF1F8B-A43B-4148-9452-0587200478F8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4ACF1F8B-A43B-4148-9452-0587200478F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4ACF1F8B-A43B-4148-9452-0587200478F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4ACF1F8B-A43B-4148-9452-0587200478F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4ACF1F8B-A43B-4148-9452-0587200478F8}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {735E1E3B-6CCF-41EC-9ABA-187BF9AA9851}
+ EndGlobalSection
+EndGlobal
diff --git a/Annotation/Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points/Multi-line-text-redaction-using-quad-points.csproj b/Annotation/Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points/Multi-line-text-redaction-using-quad-points.csproj
new file mode 100644
index 00000000..bdf828ef
--- /dev/null
+++ b/Annotation/Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points/Multi-line-text-redaction-using-quad-points.csproj
@@ -0,0 +1,15 @@
+
+
+
+ Exe
+ net8.0
+ Multi_line_text_redaction_using_quad_points
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/Annotation/Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points/Output/.gitkeep b/Annotation/Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points/Output/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/Annotation/Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points/Program.cs b/Annotation/Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points/Program.cs
new file mode 100644
index 00000000..7596ccfb
--- /dev/null
+++ b/Annotation/Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points/Program.cs
@@ -0,0 +1,45 @@
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
+//Create a new PDF document.
+PdfDocument document = new PdfDocument();
+//Create a new page.
+PdfPage page = document.Pages.Add();
+//Creates a new Redaction annotation.
+PdfRedactionAnnotation annot = new PdfRedactionAnnotation();
+
+//set the bounds collection of redaction annotation.
+List bounds = new List();
+bounds.Add(new RectangleF(100, 100, 50, 20));
+bounds.Add(new RectangleF(200, 150, 60, 25));
+annot.BoundsCollection = bounds;
+
+//set the innercolor
+annot.InnerColor = Color.Black;
+//set the bordercolor
+annot.BorderColor = Color.Green;
+//set the textcolor
+annot.TextColor = Color.Yellow;
+//set the font
+annot.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 10);
+//set overlaytext
+annot.OverlayText = "Redact";
+//set text alignment
+annot.TextAlignment = PdfTextAlignment.Right;
+//Assign the RepeatText
+annot.RepeatText = true;
+
+//Add the annotation to the page.
+page.Annotations.Add(annot);
+
+
+// Save the modified document using a new FileStream
+using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.Write))
+{
+ // Save changes to a new PDF file
+ document.Save(outputStream);
+}
+// Close the document and release resources
+document.Close(true);
\ No newline at end of file
diff --git a/Digital Signature/Externally-sign-the-PDF-document-using-IPdfExternalSigner/.NET/Externally-sign-the-PDF-document/Program.cs b/Digital Signature/Externally-sign-the-PDF-document-using-IPdfExternalSigner/.NET/Externally-sign-the-PDF-document/Program.cs
index 51891316..5a6da695 100644
--- a/Digital Signature/Externally-sign-the-PDF-document-using-IPdfExternalSigner/.NET/Externally-sign-the-PDF-document/Program.cs
+++ b/Digital Signature/Externally-sign-the-PDF-document-using-IPdfExternalSigner/.NET/Externally-sign-the-PDF-document/Program.cs
@@ -4,60 +4,80 @@
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography;
-namespace Externally_sign_the_PDF_document {
- internal class Program {
- static void Main(string[] args) {
- //Get the stream from the document
- FileStream documentStream = new FileStream(Path.GetFullPath(@"Data/Barcode.pdf"), FileMode.Open, FileAccess.Read);
- //Load the existing PDF document
+namespace Externally_sign_the_PDF_document
+{
+ internal class Program
+ {
+ static void Main(string[] args)
+ {
+ // Get the stream from the document
+ FileStream documentStream = new FileStream(Path.GetFullPath(@"../../../Data/Barcode.pdf"), FileMode.Open, FileAccess.Read);
+
+ // Load the existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(documentStream);
- //Creates a digital signature.
+ // Create a digital signature
PdfSignature signature = new PdfSignature(loadedDocument, loadedDocument.Pages[0], null, "Signature");
- //Sets the signature information.
+
+ // Set the signature information
signature.Bounds = new RectangleF(new PointF(0, 0), new SizeF(100, 30));
signature.Settings.CryptographicStandard = CryptographicStandard.CADES;
signature.Settings.DigestAlgorithm = DigestAlgorithm.SHA1;
- //Create an external signer.
+ // Create an external signer
IPdfExternalSigner externalSignature = new ExternalSigner("SHA1");
- //Add public certificates.
+ // Add public certificates
List certificates = new List();
- certificates.Add(new X509Certificate2(new X509Certificate2(Path.GetFullPath(@"Data/PDF.pfx"), "password123")));
+ certificates.Add(new X509Certificate2(Path.GetFullPath(@"../../../Data/PDF.pfx"), "password123"));
signature.AddExternalSigner(externalSignature, certificates, null);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) {
- //Save the PDF document to file stream.
+ // Create file stream
+ using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
+ {
+ // Save the PDF document to file stream
loadedDocument.Save(outputFileStream);
}
- //Close the document.
+
+ // Close the document
loadedDocument.Close(true);
}
- //Create the external signer class and sign the document hash.
- class ExternalSigner : IPdfExternalSigner {
+
+ // Create the external signer class and sign the document hash
+ class ExternalSigner : IPdfExternalSigner
+ {
private string _hashAlgorithm;
- public string HashAlgorithm {
+
+ public string HashAlgorithm
+ {
get { return _hashAlgorithm; }
}
- public ExternalSigner(string hashAlgorithm) {
+ public ExternalSigner(string hashAlgorithm)
+ {
_hashAlgorithm = hashAlgorithm;
}
- public byte[] Sign(byte[] message, out byte[] timeStampResponse) {
+
+ public byte[] Sign(byte[] message, out byte[] timeStampResponse)
+ {
timeStampResponse = null;
- X509Certificate2 digitalID = new X509Certificate2(new X509Certificate2(Path.GetFullPath(@"Data/PDF.pfx"), "password123"));
- if (digitalID.PrivateKey is System.Security.Cryptography.RSACryptoServiceProvider) {
- System.Security.Cryptography.RSACryptoServiceProvider rsa = (System.Security.Cryptography.RSACryptoServiceProvider)digitalID.PrivateKey;
- return rsa.SignData(message, HashAlgorithm);
+ X509Certificate2 digitalID = new X509Certificate2(Path.GetFullPath(@"../../../Data/PDF.pfx"), "password123");
+
+ if (digitalID.PrivateKey is RSACryptoServiceProvider rsaProvider)
+ {
+ return rsaProvider.SignData(message, HashAlgorithm);
}
- else if (digitalID.PrivateKey is RSACng) {
- RSACng rsa = (RSACng)digitalID.PrivateKey;
- return rsa.SignData(message, System.Security.Cryptography.HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1);
+ else if (digitalID.PrivateKey is RSACng rsaCng)
+ {
+ return rsaCng.SignData(message, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1);
}
+ else if (digitalID.PrivateKey is RSAOpenSsl rsaOpenSsl)
+ {
+ return rsaOpenSsl.SignData(message, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1);
+ }
+
return null;
}
}
}
-}
\ No newline at end of file
+}
diff --git a/Forms/Disable-Auto-Formatting-in-FormFields/.NET/Disable-Auto-Formatting-in-FormFields/Output/.gitkeep b/Forms/Disable-Auto-Formatting-in-FormFields/.NET/Disable-Auto-Formatting-in-FormFields/Output/.gitkeep
new file mode 100644
index 00000000..e69de29b