Page reordering requires bookmark reordering. See the example at itextpdf.sf.net.
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of [EMAIL PROTECTED] > Sent: Friday, November 26, 2004 8:34 AM > To: [EMAIL PROTECTED] > Subject: [iText-questions] HELP! bookmark's artificial intelligence > > Hello again, > > i am creating a pdf document by adding other pdf documents as > templates, > saving the starting page number of each document and it's > titel in an array. > with that information i want to create a toc and the > bookmarks. i create the > toc at the end of the document and reorder the pages to make > the toc appear > after the cover page, followed by the content. That array now > looks like > that: > > 1, cover page > 2, toc > 5, doc1 > 8, doc2 > ... > > That is the correct order and correct page number. the toc > entries look like > this (don't has links to cover and toc): > > doc1.......5 > doc2.......8 as in the example > > but when i click on doc1, it jumbs to page 8, from doc2 to > page 11. So, for > some reason it adds the number of toc pages to the link. To solve that > problem, by creating the link, i subtract the number of toc > pages. that > works. > but i have the same problem with the bookmarks. there should > be a link to > the cover and toc now as well. now: it jumps to the cover, > page 1 correctly > but adds the number of toc pages to all other bookmarks, so instead of > jumping to toc, page 2 it jumps to page 5. but now i can not > subtract the > number of toc pages as 2 - 3 would be -1 and that is not allowed. > > Why is that and what can i do? > > public static void bookmarks (PdfContentByte cb,String [][] > list, int size, > PdfWriter writer, int tocPageNumber){ > PdfOutline root = cb.getRootOutline(); > //add bookmark for cover page > list [0][0]="1"; > list [0][1]="Deckblatt"; > //add bookmark for TOC > list [1][0]="2"; > list [1][1]="Inhaltsverzeichnis"; > //the rest of the array hosts > //the pages and titels of the documents > for (int i=0;i<size;i++){ > int page=Integer.parseInt(list[i][0]; > PdfAction link = PdfAction.gotoLocalPage > (page, new > PdfDestination(PdfDestination.XYZ, > 50, 10000, 0), writer); > cb.addOutline(new PdfOutline(root, > link, list[i][1])); > } > } > > Thanks! > > Martina > > > > > > -- > Geschenkt: 3 Monate GMX ProMail + 3 Top-Spielfilme auf DVD > ++ Jetzt kostenlos testen http://www.gmx.net/de/go/mail ++ > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from > real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > iText-questions mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/itext-questions > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
