Skip to content

Commit ba5ff5b

Browse files
Feedback changes
1 parent f9fbb9b commit ba5ff5b

File tree

1 file changed

+32
-19
lines changed

1 file changed

+32
-19
lines changed

Signature/Add_ESign/MainWindow.xaml.cs

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,38 @@ private void CreateSignatureImage()
141141
int pageIndex = PDFViewer.CurrentPageIndex - 1;
142142
if(pageIndex < 0)
143143
return;
144+
145+
//Creating image for current date and time details
146+
CreateCurrentDataImage();
147+
148+
//Combine the name image and date-time image into a single image
149+
CombineSignatureAntDataImage();
150+
151+
}
152+
153+
private void CombineSignatureAntDataImage()
154+
{
155+
// Load the two images
156+
using (System.Drawing.Image nameImage = System.Drawing.Image.FromFile(filePath + "John.png"))
157+
using (System.Drawing.Image signImage = System.Drawing.Image.FromFile(filePath + "DigitalSignatureBlock.png"))
158+
{
159+
// Create a new bitmap with combined width and max height
160+
int signatureWidth = nameImage.Width + signImage.Width;
161+
int signatureHeight = Math.Max(nameImage.Height, signImage.Height);
162+
using (Bitmap combinedImage = new Bitmap(signatureWidth, signatureHeight))
163+
using (Graphics g = System.Drawing.Graphics.FromImage(combinedImage))
164+
{
165+
// Draw both images side by side
166+
g.DrawImage(nameImage, 0, 0);
167+
g.DrawImage(signImage, nameImage.Width, 0);
168+
// Save the result
169+
combinedImage.Save(filePath + "ESign.png", System.Drawing.Imaging.ImageFormat.Png);
170+
}
171+
}
172+
}
173+
174+
private void CreateCurrentDataImage()
175+
{
144176
int width = 200;
145177
int height = 100;
146178
string signerName = "John";
@@ -162,25 +194,6 @@ private void CreateSignatureImage()
162194
}
163195
}
164196
}
165-
string inputPath = filePath + "John.png";
166-
167-
// Load the two images
168-
using (System.Drawing.Image nameImage = System.Drawing.Image.FromFile( filePath + "John.png"))
169-
using (System.Drawing.Image signImage = System.Drawing.Image.FromFile(filePath + "DigitalSignatureBlock.png"))
170-
{
171-
// Create a new bitmap with combined width and max height
172-
int signatureWidth = nameImage.Width + signImage.Width;
173-
int signatureHeight = Math.Max(nameImage.Height, signImage.Height);
174-
using (Bitmap combinedImage = new Bitmap(signatureWidth, signatureHeight))
175-
using (Graphics g = System.Drawing.Graphics.FromImage(combinedImage))
176-
{
177-
// Draw both images side by side
178-
g.DrawImage(nameImage, 0, 0);
179-
g.DrawImage(signImage, nameImage.Width, 0);
180-
// Save the result
181-
combinedImage.Save( filePath + "ESign.png", System.Drawing.Imaging.ImageFormat.Png);
182-
}
183-
}
184197
}
185198
}
186199
}

0 commit comments

Comments
 (0)