我有一个PDF文件的文件,需要在文件的特定位置加上数字印章。我把邮票放在档案中,但我想把邮票放在档案的特定位置。
这是我的代码
protected void btnCreatePDF_Click(object sender, EventArgs e)
{
String cert = "C:/Users/arehman.SHERPC-1009/Desktop/New folder (3)/iTextSharpSign_TemporaryKey.pfx";
PdfFileSignature pdfSign = new PdfFileSignature();
pdfSign.BindPdf("C:/Users/arehman.SHERPC-1009/Downloads/FormalUndertakingForm (5).pdf");
//create a rectangle for signature location
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(50, 50, 100, 50);
//set signature appearance
pdfSign.SignatureAppearance = "c:/users/arehman.sherpc-1009/documents/visual studio 2010/Projects/TestApp/TestApp/Images/sig55.png";
//create any of the three signature types
PKCS1 signature = new PKCS1(cert, "edge123"); // PKCS#1 or
signature.ShowProperties = false;
//PKCS7 signature = new PKCS7("test.pfx", "password"); // PKCS#7 or
//PKCS7Detached signature = new PKCS7Detached("test.pfx", "password"); // PKCS#7 detached
pdfSign.Sign(2, true, rect, signature);
//save output PDF file
pdfSign.Save("C:/Users/arehman.SHERPC-1009/Downloads/Pdf/output.pdf");
}