Java PDF: Exemple de signature d’un formulaire

Author:

Java PDF: Exemple de signature d'un formulaire
{filelink=10434}

/***** Code de MesExemples.com *******/
/**
 * @(#)SignatureFormulairePDF.java
 *
 *
 * @author 
 *sakoba(java.mesexemples.com) @version 1.00 2013/4/30
 */


import java.io.FileOutputStream;
import java.io.IOException;

import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfAcroForm;
import com.itextpdf.text.pdf.PdfWriter;

public class SignatureFormulairePDF {
  public static void main(String[] args) {
    Document document = new Document(PageSize.A4);
    try {
      PdfWriter pdf_writer = PdfWriter.getInstance(document, 
      	new FileOutputStream("c:/SignatureFormulairePDF.pdf"));
      document.open();
      PdfAcroForm acroForm = pdf_writer.getAcroForm();
      document.add(new Paragraph("Bienvenu sur PDF Dynamique"));
      acroForm.addSignature("sig", 73, 705, 149, 759);

    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
    document.close();
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *