On 4/28/2014 7:43 AM, Saurabh Mayekar wrote:
As shown in the image I was able to write Table 1 successfully that goes in multiple pages. But how do i come at the starting page of the document again to plot the image at it's absolute position at first page?
Once a page is written to the output stream, you can't go back.

If you want something to be present at a page that has already been written, you need to provide a place holder before the page is written to the output stream. In PDF terminology, we'd say you need an external object (XObject); in iText, this corresponds with a PdfTemplate.

A common use case is when you need "Page X of Y". When you write the first page, you can write "Page 1 of", but you don't know the total number of pages yet (because you haven't reached the end of the document yet). To solve this problem, you'll add a small PdfTemplate object, and once you're at the end of the document, you'll add the correct value of Y to this object.

You could do the same thing with your image: if you only know what the image will look like once the table is completed, you could reserve the area using a PdfTemplate, and add the image to that PdfTemplate.

If you know what the image looks like in advance, it goes without saying that you should add it while you're still dealing with the first page.
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to