You must add the outlines just before close after adding all the pages.
Paulo
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of fredericks
> Sent: Monday, June 16, 2008 11:10 AM
> To: itext-questions@lists.sourceforge.net
> Subject: Re: [iText-questions] Bookmarks in merged PDF document
>
>
> All right :)... I should have included the code from the
> beginning...sorry
> I just cut the javascript part just to shorten the post
> because I thought it
> was not relevant to my problem....tell me if you want me to
> put it too.
>
>
> ArrayList OutputOutlines = new ArrayList();
>
> string InputFilePath = @"1030U00002_bm.pdf";
> PdfReader reader = new PdfReader(InputFilePath);
> reader.ConsolidateNamedDestinations();
>
> string FilePath = "output.pdf";
> Document document = new
> Document(reader.GetPageSizeWithRotation(1));
>
> PdfCopy copy = new PdfCopy(document, new
> FileStream(FilePath, FileMode.Create));
> copy.SetFullCompression();
> document.Open();
>
> ArrayList bookmarks =
> SimpleBookmark.GetBookmark(reader);
>
> int pageOffset = 0;
> // copy bookmarks from the original pdf
> if (bookmarks != null)
> {
> if (pageOffset != 0)
> SimpleBookmark.ShiftPageNumbers(bookmarks,
> pageOffset, null);
> OutputOutlines.AddRange(bookmarks);
> }
>
> // Copy bookmarks to the output pdf
> if (OutputOutlines.Count >0)
> copy.Outlines = OutputOutlines;
>
> // copia tutte le pagine dal vecchio al nuovo
> documento
> for (int i=1; i <= reader.NumberOfPages ;i++)
> {
> PdfImportedPage page =
> copy.GetImportedPage(reader, i);
> copy.AddPage(page);
> }
>
> #region JavaScript
>
> // ...
>
> # endregion
>
> document.Close();
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar