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
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-signature-field-to-existing-PDF", "Add-signature-field-to-existing-PDF\Add-signature-field-to-existing-PDF.csproj", "{C2328A0D-96EC-4E23-A422-097276BB435F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C2328A0D-96EC-4E23-A422-097276BB435F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2328A0D-96EC-4E23-A422-097276BB435F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2328A0D-96EC-4E23-A422-097276BB435F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2328A0D-96EC-4E23-A422-097276BB435F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8BB2F11E-8503-457F-B8B6-D597ED84F394}
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_signature_field_to_existing_PDF</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

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

// Load the existing PDF document
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(Path.GetFullPath(@"../../../Data/Input.pdf")))
{
// Ensure the document has a form; create one if it doesn't exist
if (loadedDocument.Form == null)
loadedDocument.CreateForm();
// Load the first page of the PDF
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
// Create a new PDF signature field on the loaded page
PdfSignatureField signatureField = new PdfSignatureField(loadedPage, "Signature");
// Set properties for the signature field (position and tooltip)
signatureField.Bounds = new RectangleF(100, 300, 90, 20);
signatureField.ToolTip = "Signature";
// Add the signature field to the form in the existing document
loadedDocument.Form.Fields.Add(signatureField);
// Save the PDF document
loadedDocument.Save(Path.GetFullPath(@"../../../Output/Output.pdf"));
}
Loading