{filelink=10432}
/***** Code de MesExemples.com *******/
/**
* @(#)FormulairePDF.java
*
*
* @author
*sakoba(java.mesexemples.com) @version 1.00 2013/4/30
*/
import java.io.FileOutputStream;
import com.itextpdf.text.pdf.AcroFields;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
public class FormulairePDF {
public static void main(String[] args) {
try {
PdfReader reader = new PdfReader("c:/SimpleRegistrationForm.pdf");
PdfStamper stamp2 = new PdfStamper(reader,
new FileOutputStream("c:/FormulairePDF.pdf"));
AcroFields form2 = stamp2.getAcroFields();
form2.setField("nom", "votre_nom");
form2.setField("adresse", "votre_address");
form2.setField("code_postal", "votre_code");
form2.setField("email", "votre_email");
stamp2.setFormFlattening(true);
stamp2.close();
}
catch (Exception de) {
de.printStackTrace();
}
}
}