opensubscriber
   Find in this group all groups
 
Unknown more information…

i : itext-questions@lists.sourceforge.net 20 June 2008 • 5:17AM -0400

Re: [iText-questions] Creating Bookmarks in merged PDF without inserting new pages
by William Rickards

REPLY TO AUTHOR
 
REPLY TO GROUP




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@list...
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

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.