~almacom/openobject-addons/ac_addons

« back to all changes in this revision

Viewing changes to ac_account_voucher/report/FillForm.java

  • Committer: almacom
  • Date: 2009-06-07 18:57:08 UTC
  • Revision ID: almacom@cat1-20090607185708-cslu11yvpjo6mfaz
payment flow

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import java.io.FileOutputStream;
 
2
import com.lowagie.text.pdf.PdfReader;
 
3
import com.lowagie.text.pdf.PdfStamper;
 
4
import com.lowagie.text.pdf.AcroFields;
 
5
 
 
6
public class FillForm {
 
7
    public static void main(String[] args) {
 
8
        try {
 
9
            PdfReader rd=new PdfReader(args[0]);
 
10
            PdfStamper st=new PdfStamper(rd,new FileOutputStream(args[1]));
 
11
            AcroFields form=st.getAcroFields();
 
12
            for (int i=2; i<args.length; i+=2) {
 
13
                String key=args[i];
 
14
                String val=args[i+1];
 
15
                form.setField(key,val);
 
16
            }
 
17
            st.setFormFlattening(true);
 
18
            st.close();
 
19
        } catch (Exception e) {
 
20
            e.printStackTrace();
 
21
        }
 
22
    }
 
23
}