diff --git a/Forms/Export_checkbox_values/.NET/Export_checkbox_values.sln b/Forms/Export_checkbox_values/.NET/Export_checkbox_values.sln new file mode 100644 index 00000000..c7faa411 --- /dev/null +++ b/Forms/Export_checkbox_values/.NET/Export_checkbox_values.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}") = "Export_checkbox_values", "Export_checkbox_values\Export_checkbox_values.csproj", "{7719AB70-75F7-4C57-BC73-0DCEAA9C889A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7719AB70-75F7-4C57-BC73-0DCEAA9C889A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7719AB70-75F7-4C57-BC73-0DCEAA9C889A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7719AB70-75F7-4C57-BC73-0DCEAA9C889A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7719AB70-75F7-4C57-BC73-0DCEAA9C889A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Forms/Export_checkbox_values/.NET/Export_checkbox_values/Export_checkbox_values.csproj b/Forms/Export_checkbox_values/.NET/Export_checkbox_values/Export_checkbox_values.csproj new file mode 100644 index 00000000..c9b500b4 --- /dev/null +++ b/Forms/Export_checkbox_values/.NET/Export_checkbox_values/Export_checkbox_values.csproj @@ -0,0 +1,14 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + diff --git a/Forms/Export_checkbox_values/.NET/Export_checkbox_values/Output/gitkeep.txt b/Forms/Export_checkbox_values/.NET/Export_checkbox_values/Output/gitkeep.txt new file mode 100644 index 00000000..e69de29b diff --git a/Forms/Export_checkbox_values/.NET/Export_checkbox_values/Program.cs b/Forms/Export_checkbox_values/.NET/Export_checkbox_values/Program.cs new file mode 100644 index 00000000..c46f8fb1 --- /dev/null +++ b/Forms/Export_checkbox_values/.NET/Export_checkbox_values/Program.cs @@ -0,0 +1,50 @@ +using Syncfusion.Pdf.Interactive; +using Syncfusion.Pdf; +using Syncfusion.Drawing; + +//Create a new PDF document +PdfDocument document = new PdfDocument(); +//Add a new page to the PDF document. +PdfPage page = document.Pages.Add(); + +//Create the form. +PdfForm form = document.Form; + +//Enable the field auto naming. +form.FieldAutoNaming = false; + +//Set default appearance as false. +document.Form.SetDefaultAppearance(false); + +// Create First checkbox field +PdfCheckBoxField checkBoxField1 = new PdfCheckBoxField(page, "CheckBox"); +checkBoxField1.Bounds = new RectangleF(10, 150, 50, 20); +checkBoxField1.BorderColor = Color.Red; +checkBoxField1.BorderWidth = 3; +checkBoxField1.BackColor = Color.Yellow; + +//Set the Export value +checkBoxField1.ExportValue = "Value"; +checkBoxField1.Checked = true; + +// Add to form +form.Fields.Add(checkBoxField1); + +// Create Second checkbox field +PdfCheckBoxField checkBoxField2 = new PdfCheckBoxField(page, "CheckBox"); +checkBoxField2.Bounds = new RectangleF(10, 250, 50, 20); +checkBoxField2.BorderColor = Color.Green; +checkBoxField2.BorderWidth = 2; +checkBoxField2.BackColor = Color.YellowGreen; + +// Add to form +form.Fields.Add(checkBoxField2); + +//Create file stream. +using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) +{ + //Save the PDF document to file stream. + document.Save(outputFileStream); +} +//Close the document. +document.Close(true); \ No newline at end of file diff --git a/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion.sln b/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion.sln new file mode 100644 index 00000000..fb91fce7 --- /dev/null +++ b/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion.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}") = "Font_Subsetting_in_PDFA_conversion", "Font_Subsetting_in_PDFA_conversion\Font_Subsetting_in_PDFA_conversion.csproj", "{A6B4226C-2B95-4A14-9AF4-465525D9DD48}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A6B4226C-2B95-4A14-9AF4-465525D9DD48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6B4226C-2B95-4A14-9AF4-465525D9DD48}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6B4226C-2B95-4A14-9AF4-465525D9DD48}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6B4226C-2B95-4A14-9AF4-465525D9DD48}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Data/Input.pdf b/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Data/Input.pdf new file mode 100644 index 00000000..fe892c8f Binary files /dev/null and b/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Data/Input.pdf differ diff --git a/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Font_Subsetting_in_PDFA_conversion.csproj b/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Font_Subsetting_in_PDFA_conversion.csproj new file mode 100644 index 00000000..c988efe5 --- /dev/null +++ b/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Font_Subsetting_in_PDFA_conversion.csproj @@ -0,0 +1,14 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + diff --git a/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Output/gitkeep.txt b/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Output/gitkeep.txt new file mode 100644 index 00000000..e69de29b diff --git a/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Program.cs b/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Program.cs new file mode 100644 index 00000000..94137a32 --- /dev/null +++ b/PDF Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Program.cs @@ -0,0 +1,78 @@ +using Syncfusion.Pdf.Parsing; +using Syncfusion.Pdf; +using System.Reflection.Metadata; +using Syncfusion.Drawing; +using Syncfusion.Pdf.Graphics; +using SkiaSharp; + +//Get stream from an existing PDF document. +FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read); +PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream); + +//Sample level font event handling +loadedDocument.SubstituteFont += LoadedDocument_SubstituteFont; + +//Create conformance options +PdfConformanceOptions options = new PdfConformanceOptions(); +//Set the conformance level +options.ConformanceLevel = PdfConformanceLevel.Pdf_A1B; + +//Embed fonts as subsets +options.SubsetFonts = true; + +// Convert to PDF/A conformance +loadedDocument.ConvertToPDFA(options); + +//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. +loadedDocument.Close(true); +docStream.Close(); + +static void LoadedDocument_SubstituteFont(object sender, PdfFontEventArgs args) +{ + //get the font name + string fontName = args.FontName.Split(',')[0]; + + //get the font style + PdfFontStyle fontStyle = args.FontStyle; + SKFontStyle sKFontStyle = SKFontStyle.Normal; + + if (fontStyle != PdfFontStyle.Regular) + { + if (fontStyle == PdfFontStyle.Bold) + { + sKFontStyle = SKFontStyle.Bold; + } + else if (fontStyle == PdfFontStyle.Italic) + { + sKFontStyle = SKFontStyle.Italic; + } + else if (fontStyle == (PdfFontStyle.Italic | PdfFontStyle.Bold)) + { + sKFontStyle = SKFontStyle.BoldItalic; + } + } + + SKTypeface typeface = SKTypeface.FromFamilyName(fontName, sKFontStyle); + SKStreamAsset typeFaceStream = typeface.OpenStream(); + MemoryStream memoryStream = null; + if (typeFaceStream != null && typeFaceStream.Length > 0) + { + //Create the fontData from the type face stream. + byte[] fontData = new byte[typeFaceStream.Length]; + typeFaceStream.Read(fontData, typeFaceStream.Length); + typeFaceStream.Dispose(); + + //Create the new memory stream from the font data. + memoryStream = new MemoryStream(fontData); + } + + //set the font stream to the event args. + args.FontStream = memoryStream; +} diff --git a/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization.sln b/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization.sln new file mode 100644 index 00000000..51c4e61c --- /dev/null +++ b/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization.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}") = "Redaction-fill-color-customization", "Redaction-fill-color-customization\Redaction-fill-color-customization.csproj", "{965B76D5-EB6B-401A-9715-2DAFCAF89573}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {965B76D5-EB6B-401A-9715-2DAFCAF89573}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {965B76D5-EB6B-401A-9715-2DAFCAF89573}.Debug|Any CPU.Build.0 = Debug|Any CPU + {965B76D5-EB6B-401A-9715-2DAFCAF89573}.Release|Any CPU.ActiveCfg = Release|Any CPU + {965B76D5-EB6B-401A-9715-2DAFCAF89573}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization/Output/gitkeep.txt b/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization/Output/gitkeep.txt new file mode 100644 index 00000000..e69de29b diff --git a/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization/Program.cs b/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization/Program.cs new file mode 100644 index 00000000..a8515d76 --- /dev/null +++ b/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization/Program.cs @@ -0,0 +1,45 @@ +using Syncfusion.Pdf.Graphics; +using Syncfusion.Pdf.Interactive; +using Syncfusion.Pdf; +using Syncfusion.Drawing; + +//Create a new PDF document. +PdfDocument document = new PdfDocument(); +//Add a page to the document. +PdfPage page = document.Pages.Add(); + +//Create a new Redaction annotation +PdfRedactionAnnotation annot = new PdfRedactionAnnotation(); +//Assign the Bounds Value +annot.Bounds = new Rectangle(100, 120, 100, 100); +//Assign the InnerColor +annot.InnerColor = Color.Black; +//Assign the BorderColor +annot.BorderColor = Color.Yellow; + +//Assign the AppearanceFillColor +annot.AppearanceFillColor = Color.BlueViolet; + +//Assign tbe TextColor +annot.TextColor = Color.Blue; +//Assign the font +annot.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 10); +//Assign the OverlayText +annot.OverlayText = "REDACTION"; +//Assign the TextAlignment +annot.TextAlignment = PdfTextAlignment.Right; +//Assign the RepeatText +annot.RepeatText = true; +annot.SetAppearance(true); + +//Add the annotation to the page +page.Annotations.Add(annot); + +//Create file stream. +using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) +{ + //Save the PDF document to file stream. + document.Save(outputFileStream); +} +//Close the document. +document.Close(true); \ No newline at end of file diff --git a/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization/Redaction-fill-color-customization.csproj b/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization/Redaction-fill-color-customization.csproj new file mode 100644 index 00000000..04782eb9 --- /dev/null +++ b/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization/Redaction-fill-color-customization.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Redaction_fill_color_customization + enable + enable + + + + + + + diff --git a/Security/Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM.sln b/Security/Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM.sln new file mode 100644 index 00000000..e5f62e6a --- /dev/null +++ b/Security/Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM.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}") = "Secure_data _with _AES_GCM", "Secure_data _with _AES_GCM\Secure_data _with _AES_GCM.csproj", "{2B3C8C92-BF50-49A6-AF36-45F094E7CA62}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2B3C8C92-BF50-49A6-AF36-45F094E7CA62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2B3C8C92-BF50-49A6-AF36-45F094E7CA62}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2B3C8C92-BF50-49A6-AF36-45F094E7CA62}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2B3C8C92-BF50-49A6-AF36-45F094E7CA62}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Security/Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM/Output/.gitkeep b/Security/Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Security/Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM/Program.cs b/Security/Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM/Program.cs new file mode 100644 index 00000000..83ed0bc8 --- /dev/null +++ b/Security/Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM/Program.cs @@ -0,0 +1,44 @@ +using Syncfusion.Pdf.Graphics; +using Syncfusion.Pdf.Security; +using Syncfusion.Pdf; +using Syncfusion.Drawing; + +//Create a new PDF document. +PdfDocument document = new PdfDocument(); + +//Set the document version as 2.0 +document.FileStructure.Version = PdfVersion.Version2_0; + +//Add a page to the document. +PdfPage page = document.Pages.Add(); + +//Create PDF graphics for the page. +PdfGraphics graphics = page.Graphics; + +//Set the font. +PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 15f, PdfFontStyle.Bold); + +//Set the brush. +PdfBrush brush = PdfBrushes.Black; + +//Document security. +PdfSecurity security = document.Security; + +//Specifies key size and encryption algorithm. +security.KeySize = PdfEncryptionKeySize.Key256Bit; +security.Algorithm = PdfEncryptionAlgorithm.AESGCM; +security.OwnerPassword = "ownerPassword"; +security.UserPassword = "userPassword"; + +//Draw the text. +graphics.DrawString("Encrypted document with AES-GCM 256bit", font, brush, new PointF(0, 40)); + +//Create file stream. +using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) +{ + //Save the PDF document to file stream. + document.Save(outputFileStream); +} + +//Close the documents. +document.Close(true); \ No newline at end of file diff --git a/Security/Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM/Secure_data _with _AES_GCM.csproj b/Security/Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM/Secure_data _with _AES_GCM.csproj new file mode 100644 index 00000000..439ea111 --- /dev/null +++ b/Security/Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM/Secure_data _with _AES_GCM.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Secure_data__with__AES_GCM + enable + enable + + + + + + +