From 65e69009842cbd732353e8534ae15e4382399474 Mon Sep 17 00:00:00 2001 From: Irfana Jaffer Sadhik Date: Wed, 29 Jan 2025 12:43:59 +0530 Subject: [PATCH 1/2] added the sample --- ...g-Edit-Option-for-the-PdfComboboxField.sln | 25 ++++++++++++ ...dit-Option-for-the-PdfComboboxField.csproj | 15 ++++++++ .../Output/.gitkeep | 0 .../Program.cs | 38 +++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField.sln create mode 100644 Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField.csproj create mode 100644 Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Output/.gitkeep create mode 100644 Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Program.cs diff --git a/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField.sln b/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField.sln new file mode 100644 index 00000000..a52712ab --- /dev/null +++ b/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.35617.110 d17.13 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Enabling-Edit-Option-for-the-PdfComboboxField", "Enabling-Edit-Option-for-the-PdfComboboxField\Enabling-Edit-Option-for-the-PdfComboboxField.csproj", "{B042DC77-96A1-4EA8-9776-6F10B092BE24}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B042DC77-96A1-4EA8-9776-6F10B092BE24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B042DC77-96A1-4EA8-9776-6F10B092BE24}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B042DC77-96A1-4EA8-9776-6F10B092BE24}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B042DC77-96A1-4EA8-9776-6F10B092BE24}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BDBFE219-C7AF-4C85-A096-0F5DCDB0360E} + EndGlobalSection +EndGlobal diff --git a/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField.csproj b/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField.csproj new file mode 100644 index 00000000..2594cfcd --- /dev/null +++ b/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Enabling_Edit_Option_for_the_PdfComboboxField + enable + enable + + + + + + + diff --git a/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Output/.gitkeep b/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Program.cs b/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Program.cs new file mode 100644 index 00000000..8936b5ce --- /dev/null +++ b/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Program.cs @@ -0,0 +1,38 @@ +//Create a new PDf document + +using Syncfusion.Pdf; +using Syncfusion.Pdf.Graphics; +using Syncfusion.Pdf.Interactive; +using Syncfusion.Drawing; + +PdfDocument document = new PdfDocument(); + +//Creates a new page and adds it as the last page of the document + +PdfPage page = document.Pages.Add(); + +PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f); + +//Create a combo box + +PdfComboBoxField positionComboBox = new PdfComboBoxField(page, "positionComboBox"); + +positionComboBox.Editable = true; + +positionComboBox.Bounds = new RectangleF(100, 115, 200, 20); + +positionComboBox.Font = font; + +positionComboBox.Editable = true; + +//Add it to document + +document.Form.Fields.Add(positionComboBox); + +using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) +{ + //Save the PDF document to file stream. + document.Save(outputFileStream); +} +document.Close(true); + From 3f990da4b9e3879d71132cf4f2a97ec948f82754 Mon Sep 17 00:00:00 2001 From: Irfana Jaffer Sadhik Date: Tue, 18 Feb 2025 18:34:06 +0530 Subject: [PATCH 2/2] modified the sample --- .../Program.cs | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Program.cs b/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Program.cs index 8936b5ce..ab6b5624 100644 --- a/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Program.cs +++ b/Forms/Enabling-Edit-Option-for-the-PdfComboboxField/Enabling-Edit-Option-for-the-PdfComboboxField/Program.cs @@ -1,38 +1,36 @@ -//Create a new PDf document - -using Syncfusion.Pdf; +//Create a new PDF document using Syncfusion.Pdf.Graphics; using Syncfusion.Pdf.Interactive; +using Syncfusion.Pdf; using Syncfusion.Drawing; PdfDocument document = new PdfDocument(); -//Creates a new page and adds it as the last page of the document - +//Add page PdfPage page = document.Pages.Add(); +//Create a PDF standard font PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f); //Create a combo box PdfComboBoxField positionComboBox = new PdfComboBoxField(page, "positionComboBox"); -positionComboBox.Editable = true; - +//Set the combo box bounds positionComboBox.Bounds = new RectangleF(100, 115, 200, 20); +//Set the font positionComboBox.Font = font; +//Enable editing option positionComboBox.Editable = true; //Add it to document - document.Form.Fields.Add(positionComboBox); -using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) +using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) { //Save the PDF document to file stream. document.Save(outputFileStream); } -document.Close(true); - +document.Close(true); \ No newline at end of file