Dear Bruno,
                i am sending my code in which i am trying to place a
pdfptable on existing pdf.this existing pdf has multiline text.i have to
place the table in between the text.with this code there is no compile time
error nor any runtime error.it creates one pdf "WriteSelecredRow".but it
shows that its contents are of 0 bytes and when i am trying to open it it
shows error that file has been corrupted.please help me.Thanks in advance.
:-)


On 1/28/07, Bruno Lowagie <[EMAIL PROTECTED]> wrote:

KUMAR PRASHANT wrote:
>
> i want to place pdfptable on an existing pdf page.which i am using as a
> template.there are texts written on the page.in <http://page.in> between
> of them i want to insert the table.can anyone help me plz.............

You need PdfStamper, getOverContent and writeSelectedRows.
Of course you need to know where to add the table.
Either you have the coordinates, or the template PDF
has a field that can give you the coordinates.
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/




--
KP
import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
import com.lowagie.text.pdf.*;


/**
 * Writing a PdfPTable at an absolute position.
 */
public class WriteSelectedRows {

        public static void main(String[] args) {
                Document document = new Document();

                try {
                        PdfReader reader = new PdfReader("aish1.pdf");
                        PdfStamper stamp = new PdfStamper(reader, new 
FileOutputStream("WriteSelectedRows.pdf"));
                        PdfContentByte over=stamp.getOverContent(1) ;
                        PdfPTable table = new PdfPTable(4);
            for (int k = 0; k < 24; ++k) {
                table.addCell("KP");
            }
            table.setTotalWidth(300f);
            table.writeSelectedRows(0, 1, 100,300,over );
                } catch (Exception de) {
                        de.printStackTrace();
                }
        }
}
-------------------------------------------------------------------------
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to