tags:

views:

107

answers:

1

Hi,

I have multipaged pdf file (let's call it file1) And I am generating another pdf (file2) that consists of 1 table that may be also multipaged.

How can I merge the existing pdf into the one I am generating so that the pages of these two files would be one after another (file1page1, file2page1, file1page2, etc...)

I know how to merge two pdf-s and it wouldn't be a problem if I could control creating new pages in file2. But in file2 I am just writing a table and I don't know when new page is started.

Is there another way than bringing in file3 that would be the final result.

A: 

In the document that contains the table, you will have to use a PdfPageEvent:

http://api.itextpdf.com/com/itextpdf/text/pdf/PdfWriter.html#setPageEvent%28com.itextpdf.text.pdf.PdfPageEvent%29

whenever a new page is generated, insert the corresponing page from the other document

seanizer