@@ -141,6 +141,38 @@ private void CreateSignatureImage()
141
141
int pageIndex = PDFViewer . CurrentPageIndex - 1 ;
142
142
if ( pageIndex < 0 )
143
143
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
+ {
144
176
int width = 200 ;
145
177
int height = 100 ;
146
178
string signerName = "John" ;
@@ -162,25 +194,6 @@ private void CreateSignatureImage()
162
194
}
163
195
}
164
196
}
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
- }
184
197
}
185
198
}
186
199
}
0 commit comments