Pdfstamper.setOutlines().
Paulo
----- Original Message -----
From: "dayvidpow" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 12, 2007 9:34 PM
Subject: [iText-questions] HELP Adding bookmarks to Existing PDF
usingPdfStamper ?
>
> I have an existing PDF document which does not contain any bookmarks. I am
> currently using PdfStamper to manipulate the PDF and insert text, image
> etc.
> The text insertion portion is working correclty. But Now I wish to also
> add
> bookmarks (outlines) to the PDF using the same PdfStamper object, however
> this is proving to be rather difficult. My method look like this:
>
> private boolean addBookmarks(PdfStamper _stamper){
>
> PdfOutline root = _stamper.getWriter().getRootOutline();
> PdfAction dest = PdfAction.gotoLocalPage(1,new
> PdfDestination(PdfDestination.FITB),_stamper.getWriter());
> PdfOutline coverPage = new PdfOutline(root,dest,"Cover Page");
> PdfOutline articleContents = new PdfOutline(root,new
> PdfAction(),"Article Contents");
> PdfOutline issueContents = new PdfOutline(root,new
> PdfAction(),"Issue Table of Contents");
>
> return true;
> }
>
> When executed i get the following exception:
>
> java.lang.NullPointerException
> at com.lowagie.text.pdf.PdfOutline.initOutline(PdfOutline.java:328)
> at com.lowagie.text.pdf.PdfOutline.<init>(PdfOutline.java:154)
> at com.lowagie.text.pdf.PdfOutline.<init>(PdfOutline.java:138)
> at backend.pdf.PdfGenerator.addBookmarks(PdfGenerator.java:348)
>
>
> Why is this happening ?
.ugent.be/itext-in-action/
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/