Hi I used iTextSharp to do something similar I think.
I needed to add a table of contents page and wanted bookmarks as well.
I needed for the output a document (docReport) and pdfwriter (wrtReport).
For the input pdf I need the pdfreader (rdrReport).  I'll assume you
can create those.

First I created the table of contents.
Then I added the pages from the other document with
For intPage = wrtReport.CurrentPageNumber + 1 To rdrReport.NumberOfPages
   docReport.NewPage()
   objContentByte.AddTemplate(wrtReport.GetImportedPage(rdrReport,
intPage), 1, 0, 0, 1, 0, 0)
 Next

Then I could add bookmarks with the following.
This is to the first page - the table of contents.
         objAction = iTextSharp.text.pdf.PdfAction.GotoLocalPage(1,
New iTextSharp.text.pdf.PdfDestination(iTextSharp.text.pdf.PdfDestination.FIT),
wrtReport)
          objOutline = New
iTextSharp.text.pdf.PdfOutline(objOutlineRoot, objAction, "Table Of
Contents")
This is to something further in the document.
            objAction =
iTextSharp.text.pdf.PdfAction.GotoLocalPage(intPage, New
iTextSharp.text.pdf.PdfDestination(iTextSharp.text.pdf.PdfDestination.FIT),
wrtReport)
   objOutline = New iTextSharp.text.pdf.PdfOutline(objOutlineRoot,
objAction, strTemp & " [Page " & CStr(intPage) & "]")


To create a subitem of that I used
             objAction =
iTextSharp.text.pdf.PdfAction.GotoLocalPage(intPage, New
iTextSharp.text.pdf.PdfDestination(iTextSharp.text.pdf.PdfDestination.FIT),
wrtReport)
                 objSubOutline = New
iTextSharp.text.pdf.PdfOutline(objOutline, objAction, "SubItem [Page "
& CStr(intPage) & "]")

-- 
Will Rickards

-------------------------------------------------------------------------
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

Reply via email to