>using SignLib.Certificates; >using SignLib.Pdf; >PdfSignature ps = new PdfSignature("serial number"); >//load the PDF document >ps.LoadPdfDocument("d:\\123.pdf"); >ps.SignaturePage = 1; >//get the pdf page size >System.Drawing.Point page = ps.DocumentProperties.DocumentPageSize(1); >//set the rectangle width and height >int width = 80; >int height = 40; >ps.SignatureAdvancedPosition = new System.Drawing.Rectangle(page.X - width, page.Y >- height, width, height); >ps.SignaturePosition = SignaturePosition.TopRight; >ps.SigningReason = "I approve this document"; >ps.SignaturePosition = SignaturePosition.TopLeft; >ps.SigningLocation = "Europe branch"; >//Load the certificate from Microsoft Certificate Store without user intervention >ps.DigitalSignatureCertificate = DigitalCertificate.LoadCertificate(false, >DigitalCertificateSearchCriteria.EmailE, "email@email.com"); >//The PIN dialog is now bypassed >DigitalCertificate.SmartCardPin = "123456"; >//Set a Custom Digital Signature Text >ps.SignatureText ="Signed by:" + ps.DigitalSignatureCertificate.GetNameInfo(X509NameType.SimpleName, >false) + "\n Date:" + DateTime.Now.ToString("yyyy.MM.dd HH:mm") + "\n" + "Reason:" + ps.SigningReason; >ps.FontFile = "c:\\windows\\fonts\\arial.ttf"; >ps.FontSize = 10; >//Set the Digital Signature Image >ps.SignatureImage = System.IO.File.ReadAllBytes("c:\\graphic.jpg"); >//text on the right and image on the left >ps.SignatureImageType = SignatureImageType.ImageAndText; >//image as bakground and text on above >ps.SignatureImageType = SignatureImageType.ImageAsBackground; >//only image >ps.SignatureImageType = SignatureImageType.ImageWithNoText; >//write the signed file >File.WriteAllBytes("d:\\source[signed].pdf", ps.ApplyDigitalSignature()); >>Thanks