diff --git a/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter.sln b/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter.sln new file mode 100644 index 00000000..740f8b7e --- /dev/null +++ b/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36221.1 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fillable-form-fields-from-HTML-to-PDF-Converter", "Fillable-form-fields-from-HTML-to-PDF-Converter\Fillable-form-fields-from-HTML-to-PDF-Converter.csproj", "{70A501A7-093A-4E77-AE84-1EDFE2A5243F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {70A501A7-093A-4E77-AE84-1EDFE2A5243F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {70A501A7-093A-4E77-AE84-1EDFE2A5243F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {70A501A7-093A-4E77-AE84-1EDFE2A5243F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {70A501A7-093A-4E77-AE84-1EDFE2A5243F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FC5888A1-82B1-4C5C-AA60-36BBCD924490} + EndGlobalSection +EndGlobal diff --git a/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter/Data/Input.html b/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter/Data/Input.html new file mode 100644 index 00000000..92491ba4 --- /dev/null +++ b/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter/Data/Input.html @@ -0,0 +1,51 @@ + + + + Fillable PDF Form + + + +
+

Job Application Form

+
+ + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter/Fillable-form-fields-from-HTML-to-PDF-Converter.csproj b/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter/Fillable-form-fields-from-HTML-to-PDF-Converter.csproj new file mode 100644 index 00000000..391fd257 --- /dev/null +++ b/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter/Fillable-form-fields-from-HTML-to-PDF-Converter.csproj @@ -0,0 +1,16 @@ + + + + Exe + net8.0 + Fillable_form_fields_from_HTML_to_PDF_Converter + enable + enable + + + + + + + + diff --git a/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter/Output/gitkeep.txt b/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter/Output/gitkeep.txt new file mode 100644 index 00000000..e69de29b diff --git a/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter/Program.cs b/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter/Program.cs new file mode 100644 index 00000000..d32aac4f --- /dev/null +++ b/HTML to PDF/Blink/Fillable-form-fields-from-HTML-to-PDF-Converter/.NET/Fillable-form-fields-from-HTML-to-PDF-Converter/Program.cs @@ -0,0 +1,64 @@ +using Syncfusion.Drawing; +using Syncfusion.HtmlConverter; +using Syncfusion.Pdf; +using Syncfusion.Pdf.Interactive; +using Syncfusion.Pdf.Parsing; + +// Initialize the HTML to PDF converter +HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); +// Enable form conversion +BlinkConverterSettings settings = new BlinkConverterSettings +{ + EnableForm = true +}; +htmlConverter.ConverterSettings = settings; +// Convert the HTML file to a PDF document +using (PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data/Input.html"))) +{ + // Set default appearance for form fields + document.Form.SetDefaultAppearance(false); + + // Save the PDF document to a memory stream + using (MemoryStream stream = new MemoryStream()) + { + // Load the saved PDF document + document.Save(stream); + // Load the PDF document containing form fields + PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream); + // Fill the form fields + PdfLoadedForm form = loadedDocument.Form; + // Fill the "name" field + if (form.Fields["name"] is PdfLoadedTextBoxField nameField) + { + nameField.Text = "XYZ"; + } + // Fill the "email" field + if (form.Fields["email"] is PdfLoadedTextBoxField emailField) + { + emailField.Text = "xyz@example.com"; + } + // Select "Male" in the "gender" dropdown + if (form.Fields["gender"] is PdfLoadedComboBoxField genderField) + { + genderField.SelectedValue = "Male"; + } + // Fill the "signature" field + if (form.Fields["signature"] is PdfLoadedTextBoxField signatureTextBox) + { + // Get the original field's position and page + RectangleF bounds = signatureTextBox.Bounds; + PdfPageBase page = signatureTextBox.Page; + // Remove the original textbox field + form.Fields.Remove(signatureTextBox); + // Create a new signature field at the same location + PdfSignatureField signatureField = new PdfSignatureField(page, "ClientSignature") + { + Bounds = bounds + }; + // Add the new signature field to the form + form.Fields.Add(signatureField); + } + // Save the PDF document + loadedDocument.Save(Path.GetFullPath(@"Output/Output2.pdf")); + } +} \ No newline at end of file