Gerry King wrote:
> I have a PDF file - quote.pdf which I created with Acrobat 7 (saved as 
> Abobe 6 Static) from a MS-Word document. It has a logo and some 
> boilerplate text alongside which I stamp some values. That works fine.

In other words: you're working with PdfStamper.
The original PDF has fields and you are able to fill them
with a sequence of setField() operations.
You're not working with PdfWriter as I was assuming.
In this case, you can forget what I said before.

> Below this I want to add some PDFTables and a footer.

I assume you know the coordinates, because you retrieved
the field positions.

> From your reply I 
> understand that I should set the margins to constrain the table to be 
> between the 'header' (non-repeating) and the footer.

Not if you're working with PdfStamper.
It doesn't make sense to set margins if you're using PdfStamper.

> What I have tried is using a single Document and OutputStream. The 
> fields were filled in but no tables.

You just said you are stamping fields on an existing PDF,
but now you say you are using Document. Why???

Document and PdfStamper are like meat and chocolate.
One is for the main course, the other for desert
(unless you live in South-America where they actually
serve chicken with chocolate sauce).

You are mixing classes you shouldn't mix.
That's why your code doesn't work.

Try:

PdfReader reader = new PdfReader(mergedfile);
OutputStream os2 = new FileOutputStream("Quotation.pdf");
PdfStamper stamper = new PdfStamper(reader, os2);
PdfPTable table = buildItemsTable(); // creates a table - honest!
table.writeSelectedRows(0, -1, x, y, stamper.getOverContent(1));
stamper.close();

The method writeSelectedRows is explained in section 6.1.6.
br,
Bruno

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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