-
Notifications
You must be signed in to change notification settings - Fork 49
1006681: How to Sign All Pages Using a Group Signature #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sameerkhan001
wants to merge
2
commits into
master
Choose a base branch
from
1006681
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
Digital Signature/Group-signature-for-all-pages/.NET/Group-signature-for-all-pages.slnx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <Solution> | ||
| <Project Path="Group-signature-for-all-pages/Group-signature-for-all-pages.csproj" /> | ||
| </Solution> |
Binary file added
BIN
+2.83 KB
...Signature/Group-signature-for-all-pages/.NET/Group-signature-for-all-pages/Data/Input.pdf
Binary file not shown.
Binary file added
BIN
+2.27 KB
...l Signature/Group-signature-for-all-pages/.NET/Group-signature-for-all-pages/Data/PDF.pfx
Binary file not shown.
Binary file added
BIN
+13.7 KB
...p-signature-for-all-pages/.NET/Group-signature-for-all-pages/Data/Signature.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
...ure-for-all-pages/.NET/Group-signature-for-all-pages/Group-signature-for-all-pages.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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>Group_signature_for_all_pages</RootNamespace> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
Empty file.
39 changes: 39 additions & 0 deletions
39
...tal Signature/Group-signature-for-all-pages/.NET/Group-signature-for-all-pages/Program.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| using Syncfusion.Drawing; | ||
| using Syncfusion.Pdf; | ||
| using Syncfusion.Pdf.Graphics; | ||
| using Syncfusion.Pdf.Parsing; | ||
| using Syncfusion.Pdf.Security; | ||
|
|
||
| // Load the PDF document | ||
| using (PdfLoadedDocument document = new PdfLoadedDocument(Path.GetFullPath(@"Data/Input.pdf"))) | ||
| { | ||
| // Ensure the form (AcroForm) exists before adding signature fields | ||
| if (document.Form == null) | ||
| document.CreateForm(); | ||
| // Turn off automatic field naming if you want full control over field names | ||
| document.Form.FieldAutoNaming = false; | ||
| // Create certificate from PFX file | ||
| PdfCertificate pdfCert = new PdfCertificate(Path.GetFullPath(@"Data/PDF.pfx"), "syncfusion"); | ||
| // Load the signature image once | ||
| using FileStream imageStream = new FileStream(Path.GetFullPath(@"Data/Signature.png"), FileMode.Open, FileAccess.Read); | ||
| PdfBitmap signatureImage = new PdfBitmap(imageStream); | ||
| // Iterate pages and add a signature field to each page | ||
| for (int i = 0; i < document.Pages.Count; i++) | ||
| { | ||
| // Get current page | ||
| PdfPageBase page = document.Pages[i]; | ||
| // Create a signature field on the page using the certificate | ||
| PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature"); | ||
| // Position & size of the signature field | ||
| signature.Bounds = new RectangleF(new PointF(350, 200), new SizeF(100, 60)); | ||
| // Draw the signature image into the signature appearance once | ||
| signature.Appearance.Normal.Graphics.DrawImage( | ||
| signatureImage, | ||
| 0, 0, | ||
| signature.Bounds.Width, | ||
| signature.Bounds.Height | ||
| ); | ||
| } | ||
| // Save the PDF document | ||
| document.Save(Path.GetFullPath(@"Output/Output.pdf")); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.