What is the best way to add a user signature to a PDF on the Internet?

I need to add a user signature (e.g. your signature on a credit card, for example) to a PDF document on the Internet. How can I do it? What is the best practice for such tasks?

+4
source share
2 answers

You can use iTextSharp for this. Something like this will work for you:

PdfReader pdfReader = null; PdfStamper pdfStamper = null; // Open the PDF file to be signed pdfReader = new PdfReader(this.signFile.FullName); // Output stream to write the stamped PDF to using (FileStream outStream = new FileStream(targetFilename, FileMode.Create)) { try { // Stamper to stamp the PDF with a signature pdfStamper = new PdfStamper(pdfReader, outStream); // Load signature image iTextSharp.text.Image sigImg = iTextSharp.text.Image.GetInstance(SIGNATURE_IMAGE_PATH); // Scale image to fit sigImg.ScaleToFit(MAX_WIDTH, MAX_HEIGHT); // Set signature position on page sigImg.SetAbsolutePosition(POS_X, POS_X); // Add signatures to desired page PdfContentByte over = pdfStamper.GetOverContent(PAGE_NUM_TO_SIGN); over.AddImage(sigImg); } finally { // Clean up if (pdfStamper != null) pdfStamper.Close(); if (pdfReader != null) pdfReader.Close(); } } 
+5
source

You need to perform some actions using JavaScript. You can use jQuery for this. Here is an example:

http://motyar.blogspot.com/2010/01/draw-with-jquery.html

For the pdf part, you can use some kind of PDF conversion tool. ITextSharp

+3
source

All Articles