Skip to content

Commit 09d358e

Browse files
committed
Merge branch 'master' of https://github.com/SyncfusionExamples/PDF-Examples into 1006332-sample
2 parents f41ca57 + 0b67877 commit 09d358e

File tree

174 files changed

+75858
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+75858
-163
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="Group-signature-for-all-pages/Group-signature-for-all-pages.csproj" />
3+
</Solution>
Binary file not shown.
Binary file not shown.
13.7 KB
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Group_signature_for_all_pages</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>

Digital Signature/Group-signature-for-all-pages/.NET/Group-signature-for-all-pages/Output/gitkeep.txt

Whitespace-only changes.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using Syncfusion.Drawing;
2+
using Syncfusion.Pdf;
3+
using Syncfusion.Pdf.Graphics;
4+
using Syncfusion.Pdf.Parsing;
5+
using Syncfusion.Pdf.Security;
6+
7+
// Load the PDF document
8+
using (PdfLoadedDocument document = new PdfLoadedDocument(Path.GetFullPath(@"Data/Input.pdf")))
9+
{
10+
// Ensure the form (AcroForm) exists before adding signature fields
11+
if (document.Form == null)
12+
document.CreateForm();
13+
// Turn off automatic field naming if you want full control over field names
14+
document.Form.FieldAutoNaming = false;
15+
// Create certificate from PFX file
16+
PdfCertificate pdfCert = new PdfCertificate(Path.GetFullPath(@"Data/PDF.pfx"), "syncfusion");
17+
// Load the signature image once
18+
using FileStream imageStream = new FileStream(Path.GetFullPath(@"Data/Signature.png"), FileMode.Open, FileAccess.Read);
19+
PdfBitmap signatureImage = new PdfBitmap(imageStream);
20+
// Iterate pages and add a signature field to each page
21+
for (int i = 0; i < document.Pages.Count; i++)
22+
{
23+
// Get current page
24+
PdfPageBase page = document.Pages[i];
25+
// Create a signature field on the page using the certificate
26+
PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
27+
// Position & size of the signature field
28+
signature.Bounds = new RectangleF(new PointF(350, 200), new SizeF(100, 60));
29+
// Draw the signature image into the signature appearance once
30+
signature.Appearance.Normal.Graphics.DrawImage(
31+
signatureImage,
32+
0, 0,
33+
signature.Bounds.Width,
34+
signature.Bounds.Height
35+
);
36+
}
37+
// Save the PDF document
38+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
39+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="CreateMAUIPDFSample/CreateMAUIPDFSample.csproj" />
3+
</Solution>

Getting Started/MAUI/CreatePdfDemoSample/CreatePdfDemoSample/App.xaml renamed to Getting Started/MAUI/CreateMAUIPDFSample/CreateMAUIPDFSample/App.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version = "1.0" encoding = "UTF-8" ?>
22
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4-
xmlns:local="clr-namespace:CreatePdfDemoSample"
5-
x:Class="CreatePdfDemoSample.App">
4+
xmlns:local="clr-namespace:CreateMAUIPDFSample"
5+
x:Class="CreateMAUIPDFSample.App">
66
<Application.Resources>
77
<ResourceDictionary>
88
<ResourceDictionary.MergedDictionaries>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.Extensions.DependencyInjection;
2+
3+
namespace CreateMAUIPDFSample
4+
{
5+
public partial class App : Application
6+
{
7+
public App()
8+
{
9+
InitializeComponent();
10+
}
11+
12+
protected override Window CreateWindow(IActivationState? activationState)
13+
{
14+
return new Window(new AppShell());
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)