Hello,
Thanks but I find it
I Use the same than before but not PDFCopyFields but pdfSmartCopy and 
my final pdf is 6.3MO before 280MO

Thanks

-----E-mail d'origine-----
De : Bruno Lowagie <[EMAIL PROTECTED]>
A : Post all your questions about iText here 
<[email protected]>
Envoyé le : Mardi 21 Aoû 2007 20:42
Sujet : Re: [iText-questions] Re : Re : Re : Re : direct-mail and 
manipulation of pdf










[EMAIL PROTECTED] wrote:
> I don't find how to proceed to fill n times 1 form

You're getting on my nerves.
What is there about the example I referred to earlier that
you don't understand?
http://itext.ugent.be/articles/eid-pdf/index.php#template

PdfReader reader;
ByteArrayOutputStream baos;
PdfStamper stamper;
AcroFields form;
Document document = new Document();
try {
   PdfSmartCopy copy = new PdfSmartCopy(document, new
FileOutputStream("EIDForms.pdf"));
   document.open();
   for (int i = 0; i < values.length; i++) {
     // set fields
     reader = new PdfReader("EIDFormTemplate.pdf");
     baos = new ByteArrayOutputStream();
     stamper = new PdfStamper(reader, baos);
     form = stamper.getAcroFields();
     form.setExtraMargin(0, 1);
     for (int j = 0; j < keys.length; j++) {
       form.setField(keys[j], values[i][j]);
     }
     stamper.setFormFlattening(true);
     stamper.close();
     // add page
     reader = new PdfReader(baos.toByteArray());
     copy.addPage(copy.getImportedPage(reader, 1));
   }
} catch (DocumentException de) {
   System.err.println(de.getMessage());
} catch (IOException ioe) {
   System.err.println(ioe.getMessage());
}
document.close();

What more can I say? You just don't want to listen...
Bruno

-------------------------------------------------------------------------

This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/







-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to