hi all,
 
i'm a newbie java programmer and i'm also new in using iText. i have this problem :
 
I have 2 pdf's namely (1) SMR.pdf and (2) HasWaste.pdf
 
SMR.pdf has the following fields :
facility_name and street
 
HasWaste.pdf has the following fields :
hw_no
 
what i want to achieve is to fill-up SMR.pdf and HasWaste.pdf and flatten them and then merge the two files together( without using any temporary files, since i'll be using the code in a servlet..).
 
so far i was able to do the the first part, the filling up of SMR.pdf and flattening it :
 
  ByteArrayOutputStream baos = new ByteArrayOutputStream();     
  PdfWriter writer = PdfWriter.getInstance(document, baos);        
  
  String facility_name = (String) request.getParameter("facility_name");
  String street = (String) request.getParameter("street"); 
  
  PdfReader reader = new PdfReader("../pdfs/SMR.pdf");                        
  PdfStamper stamp = new PdfStamper(reader, baos);
  AcroFields form = reader.getAcroFields();
  form.setField("facility_name", facility_name);
  form.setField("street", street);            
  stamp.setFormFlattening(true);
  stamp.close();
 
basically, i just copied the code in the tutorial and made some minor changes..i used a ByteArrayOutputStream object as my destination since i'm goal is to display the resulting pdf in a web browser.
 
i'm having difficulties doing the filling up of HasWaste.pdf and flattening it and merging the result with the flattened version of SMR.pdf..i hope you can help me on this. thanks in advance..

Reply via email to