Spire PDF version 10.1.10
PdfSignatureAppearance.Generate(PdfCanvas g)
But not sure how the Generate is placing the canvas I create as it's not going into my signature field. Instead It's printing at the top of my PDF and not in the signature field placeholder.
- Code: Select all
//Create PdfOrdinarySignatureMaker
Spire.Pdf.Interactive.DigitalSignatures.PdfOrdinarySignatureMaker signatureMaker = new Spire.Pdf.Interactive.DigitalSignatures.PdfOrdinarySignatureMaker(doc, kcertificate);
//Set signature appearance
Spire.Pdf.Interactive.DigitalSignatures.PdfSignatureAppearance signatureAppearance = new Spire.Pdf.Interactive.DigitalSignatures.PdfSignatureAppearance(signatureMaker.Signature);
//Custom Appearance
var pdfBrush = PdfBrushes.Black;
var font = new Spire.Pdf.Graphics.PdfFont(PdfFontFamily.Helvetica, 10);
Rectangle rec = new Rectangle(new Point(10, 20), new Size(150, 150));
var layer = doc.Layers.AddLayer("Layer1", Spire.Pdf.Graphics.Layer.PdfVisibility.On);
PdfCanvas graphic = layer.CreateGraphics(doc.Pages[0].Canvas);
graphic.DrawString("Johnathan Smith", font, PdfBrushes.Black, rec);
signatureAppearance.Generate(graphic);
//Add the signature
signatureMaker.MakeSignature("Signature1", doc.Pages[int.Parse(coordinates["PageIndex"].ToString())], coordinates["X"] - 7, coordinates["Y"] - 10, coordinates["Width"] - 25, coordinates["Height"] + 5, signatureAppearance);