Yesterday, I posted this answer to the wrong address: Bruno Lowagie wrote: > Kathi wrote: >> Second try: >> >> I have many different Pdfs, lets say chapters from a book. I want to >> put them together into one Pdf. Furthermore I want to create a table >> of contents. > > OK, so for instance if you have 3 chapters: > Chapter 1: 10 pages > Chapter 2: 8 pages > Chapter 3: 11 pages > You want to concatenate them and end up with a PDF > of 10 + 8 + 11 = 29 pages. > You don't need a PDF with less pages where part of page 1 > of Chapter 2 continues on page 10 of Chapter 1. > That would be impossible (and that's how I interpreted > the original question). > It's easy to achieve this. Google for "Concatenate PDF iText". > >> The final Pdf exists of a table of contents and all chapters of the >> book. The table of contents should have links to the particular chapter. > > So on top of the 29 pages described above, you have > one or more extra pages with a TOC. > >> Now the code (I haven“t considered the links yet): >> >> In the first step I create the table of contents. I saved the names of >> the chapters in one array (called "namesOfPages"). Creating the table >> of contents works without problems. > > You could also retrieve the names of the chapters from > the metadata of each PDF (provided the title can be found there). > >> In the second step I want to append each Pdf (each chapter of the >> book) to the final Pdf. When I open the final Pdf (called "all.pdf") >> it contains only the chapter, not the table of contents. > > OK, so you have found out how to concatenate several PDFs. > It would be nice if you also created bookmarks that referred > to the start of each chapter. > >> When I uncomment the second step the final Pdf contains the table of >> content. Because of this I think, that the table of contents will be >> overwritten. You understand? > > No, I don't understand. > > Of course, I'd create the table of contents as a different > document, then concatenate it with the rest (either as the > first or as the last document; it depends on where you want > the TOC to be). I don't understand the lines of code that > were posted earlier. Where did you find that code? If it's > on one of my site, let me know so that I can delete it. > >> Now I want to know, what I can to, to get this two parts (table of >> contents and chapters) in one Pdf. Thanks for help! > > So you can concatenate your existing chapters, but you > can't concatenate a TOC you created in memory? That's odd... > > I don't understand the code you've sent. > It looks like something that will never work. > br, > Bruno >
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ 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/