//Loads a PDF document
PdfLoadedDocument loadedDocument
= new PdfLoadedDocument("../../Data/Form1.pdf");
//Gets the
first page of the document
PdfLoadedPage page =
loadedDocument.Pages[0] as PdfLoadedPage;
//Gets the first
signature field of the PDF document
PdfLoadedSignatureField field =
loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
//Load image
PdfBitmap image = new PdfBitmap("../../Data/logo.png");
//Save the
graphics state
PdfGraphicsState state =
field.Signature.Appearance.Normal.Graphics.Save();
//Insert an
image in the signature appearance
field.Signature.Appearance.Normal.Graphics.DrawImage(image,
new RectangleF(0, 0, field.Bounds.Width, field.Bounds.Height));
//Restore the
graphics state
field.Signature.Appearance.Normal.Graphics.Restore();
//Save and
close the document
loadedDocument.Save("Sample.pdf");
loadedDocument.Close(true);
|