Jason Berk wrote:
> My code needs to cut two versions of a pdf.  One bound for printing and
> one bound for the website.
> 
> We only want to use bookmarks in the PDF bound for the website.
> 
> I did some testing, and adding a PdfDestination by itself adds no size
> to the file unless that destination is added to a PdfOutline.
> 
> Knowing that, I want to let all my code add common components and
> destinations like so....and in the end, if a condition exists, add the
> destinations to the correct outline.
> 
> Something like this:
> 
> PdfContentByte cb = writer.getDirectContent();
> 
> ArrayList<PdfDestination> bookmarks = new ArrayList<PdfDestination>();
> 
> addStuff(bookmarks);
> addMoreStuff(bookmarks);
> addEvenMoreStuff(bookmarks);
> 
> If( useBookmarks ){
>       for (PdfDestination d : bookmarks) {
>               //add the destination to the appropriate parent
>               //this is where I need help!
>       }
> }

I'm not sure if I understand, but I think you should work the other way 
round: create the PDF with outlines (what you call bookmarks).

Then before you close the document decide if the bookmarks have to be 
kept. If not:

if (noBookmarksNeeded) {
        writer.getRootOutline().setKids(new ArrayList());
}

This removes all the kids from the root element of the outline tree,
so no bookmarks will be added to the PDF.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to