I posted this to comp.text.pdf and it was suggested that I post this here.

I am trying to add a table to the bottom of a pdf file with out too much 
difficulty. Can anyone help?

If I use table.writeSelectedRows I have to constantly check where to put the 
next table and add a new page etc. Isn't there any easier way like 
document.add(table)?




You should move this conversation to the iText mailing.

table.writeSelectedRows(0, -1, 40, 450, over) is the way to go but you
have to control the page breaks. Another way is to use ColumnText, set
the boundaries of the column and keep calling it until no more table is
there.

Paulo

Eric wrote:
> I am trying to add a table to the bottom of a already created pdf docuement
> that has forms. This is what I have tried...
>
> //read in existing PDF
>   PdfReader reader = new PdfReader("../docs/pdf/providers_dose_admin.pdf");
>   PdfStamper stamp = new PdfStamper(reader , out);
>   AcroFields form = stamp.getAcroFields();
>
> //Find text fields to fill out
>   Date now = new Date();
>   form.setField("ClinicName", pForm.getProviderName());
>   formatter.applyPattern(dateFormat);
>   form.setField("Date", formatter.format(now) );
> .....
>   stamp.setFormFlattening(true);
>
>   PdfContentByte under = stamp.getUnderContent(1);
> //   change the content beneath page 1
>
>
>   PdfContentByte over = stamp.getOverContent(1);
> //   change the content on top of page 1
>
> PdfPTable table = new PdfPTable(11);
>         table.getDefaultCell().setBorder(Rectangle.LEFT | Rectangle.RIGHT |
> Rectangle.BOTTOM | Rectangle.TOP);
>
>         table.addCell("Lot #");
>         table.addCell("Vaccine Code");
>         table.addCell("Manuf.");
>         table.addCell("< 1 yrs.");
>
>         Document d = over.getPdfDocument();
>         d.add(table);
>
>  stamp.close();
>
> But anything I add to d doesn't seem to work? If I do something like
> //table.writeSelectedRows(0, -1, 40, 450, over); the tables get over written
> depending on how many rows there are?
> 
> Can anyone help?




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to