PdfStamper.getOverContent() and PdfStamper.getUnderContent().
You'll have to place the table at an absolute postion. see the example
stamped.java at itextpdf.sf.net.

----- Original Message ----- 
From: "Mark C" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, March 22, 2005 8:38 PM
Subject: [iText-questions] adding pdfptable to existing form


> Hello,
> I have an existing pdf form that I need to insert a new table of data.
>  I'm using PdfStamper to fill in the form fields, but I have not been
> able to figure out how to write new content to the page.   The table
> looks fine if I write it out to a new document.  I tried messing
> around with the PdfContentByte, could not make it work.  Thanks in
> advance for any comments or suggestions.....
>
> Here is source:
> ByteArrayOutputStream baosPDF = new ByteArrayOutputStream();
> PdfReader reader = new PdfReader("templatefile.pdf");
> PdfStamper stamp = new PdfStamper(reader, baosPDF);
>
> /// this is the New Content... How to I put it in the page??
> PdfPTable table = (PdfPTable) new LoadTable().evaluate(resultlist);
>
> // fill in the form fields with their respective answers from html post
> // this works just fine
> AcroFields form = stamp.getAcroFields();
> HashMap fields = form.getFields();
> Iterator ikeys = fields.keySet().iterator();
> for (Iterator it = fields.keySet().iterator(); it.hasNext();)
> {
>   String fld = (String) it.next();
>   if (request.getParameter(fld) == null)
>     continue;
>   form.setField(fld, request.getParameter(fld));
> }
> stamp.setFormFlattening(true);
> stamp.close();
>
> // do output to servlet stream
> HttpResponse.setContentLength(baosPDF.size());
> ServletOutputStream sos = HttpResponse.getOutputStream();
> HttpResponse.setContentType("application/pdf");
> baosPDF.writeTo(sos);
> sos.flush();
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
> Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
> for the chance to win $25,000 and application distribution. Enter today at
> http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------
This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005
Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows
Embedded(r) & Windows Mobile(tm) platforms, applications & content.  Register
by 3/29 & save $300 http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to