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
25 changes: 25 additions & 0 deletions Forms/Add-a-date-field-to-a-PDF/.NET/Add-a-date-field-to-a-PDF.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36616.10 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Add-a-date-field-to-a-PDF", "Add-a-date-field-to-a-PDF\Add-a-date-field-to-a-PDF.csproj", "{71619404-6DD3-491A-9E25-60ED84C70B45}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{71619404-6DD3-491A-9E25-60ED84C70B45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71619404-6DD3-491A-9E25-60ED84C70B45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71619404-6DD3-491A-9E25-60ED84C70B45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71619404-6DD3-491A-9E25-60ED84C70B45}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F78ABE0B-3D7A-4559-8E7D-439CDB9EA435}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Add_a_date_field_to_a_PDF</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Syncfusion.Drawing;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Interactive;

// Create a new PDF document
using (PdfDocument pdfDocument = new PdfDocument())
{
// Add a new page to the PDF document
PdfPage pdfPage = pdfDocument.Pages.Add();
// Create a text box field for entering the name
PdfTextBoxField nameField = new PdfTextBoxField(pdfPage, "DateField");
nameField.Bounds = new RectangleF(10, 40, 70, 20);
nameField.ToolTip = "Date";
nameField.Text = "12/01/1995";
//Set the scriptAction to submitButton
nameField.Actions.KeyPressed = new PdfJavaScriptAction("AFDate_KeystrokeEx(\"mm/dd/yyyy\")");
nameField.Actions.Format = new PdfJavaScriptAction("AFDate_FormatEx(\"mm/dd/yyyy\")");
nameField.Actions.Validate = new PdfJavaScriptAction("AFDate_Validate(\"mm/dd/yyyy\")");
// Add the field to the form
pdfDocument.Form.Fields.Add(nameField);
// Save the PDF document
pdfDocument.Save(Path.GetFullPath(@"Output/Output.pdf"));
}
Loading