Here is an workable java file for testing cb.addOutLines().

By running it, you can see what's going on.

Thanks a lot,

Don
-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 21, 2002 11:46 AM
To: Chen, Donald; [EMAIL PROTECTED]
Subject: RE: [iText-questions] cb.addOutline() problem, please help.


It's better to provide a small working example that I can debug here to see
what's going on. I'm releasing a new version in the next hour so hurry up if
you want a fix included.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Chen, Donald [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, March 21, 2002 16:40
> To:   'Paulo Soares'; [EMAIL PROTECTED]
> Subject:      RE: [iText-questions] cb.addOutline() problem, please help.
> 
> 
> 
> I suspect that your conditional code is buggy and is not adding the
> outlines. What happens if you use the code:
> 
>          for ( int i = 0; i<objectVector.size(); i++) {
> 
>                 objectType theObject =
> (objectType)objectVector.elememntAt(i);
>                 PdfDestination myDestination = new PdfDestination(//blar
> blar here);  //psedo code
>                 cb.addOutline(new PdfOutline(foo, myDestination,
> theObject.name)); 
>                 cb.addOutline(new PdfOutline(bar, myDestination,
> theObject.name)); 
>                 cb.addOutline(new PdfOutline(tar, myDestination,
> theObject.name)); 
>                 cb.addOutline(new PdfOutline(mono, myDestination,
> theObject.name)); 
>           }
> 
> 
> I changed the code by using the way you suggest, and it turns out, none
> was
> showed under foo, bar, tar, mono.
> Quite surprise.
> 
> I am pretty sure it is not the problem of condition test.
> 
> I rearrange the code like this:
>          
> for ( int i = 0; i<objectVector.size(); i++) {
> 
>                 objectType theObject =
> (objectType)objectVector.elememntAt(i);
>                 PdfDestination myDestination = new PdfDestination(//blar
> blar here);  //psedo code
> 
>                int which = i % 4;
>               if ( which == 1 )
>                 cb.addOutline(new PdfOutline(foo, myDestination,
> theObject.name)); 
>               else if ( which == 2)
>                 cb.addOutline(new PdfOutline(bar, myDestination,
> theObject.name)); 
>               else if ( which == 3)
>                 cb.addOutline(new PdfOutline(tar, myDestination,
> theObject.name)); 
>               else if ( which == 0 )
>                 cb.addOutline(new PdfOutline(mono, myDestination,
> theObject.name)); 
>           }
> 
> It turns out that only the very first object's name showed up under
> "mono".
> 
> Any idea?
> 
> 
> Best Regards,
> Paulo Soares
> 
> > -----Original Message-----
> > From:       Chen, Donald [SMTP:[EMAIL PROTECTED]]
> > Sent:       Thursday, March 21, 2002 16:12
> > To: [EMAIL PROTECTED]
> > Subject:    [iText-questions] cb.addOutline() problem, please help.
> > 
> > Hi, there.
> > 
> > I have a problem with PdfContentByte.addOutline(), as following:
> > 
> > I created 4 outLines( eg. foo, bar, tar, mono ) with the same parent
> > (Root)
> > without any problem.
> > Then I loop through my objects and put their names as sub-outLines under
> > above metioned
> > 4 outLines, depending on the object type.  Here is the code snipe:
> > 
> >            for ( int i = 0; i<objectVector.size(); i++) {
> > 
> >                 objectType theObject =
> > (objectType)objectVector.elememntAt(i);
> >                 PdfDestination myDestination = new PdfDestination(//blar
> > blar here);  //psedo code
> >                 if ( theObject.type == 1 ) {
> >                     cb.addOutline(new PdfOutline(foo, myDestination,
> > theObject.name)); 
> >                 } else if ( theDo.type == 2 ) {
> >                     cb.addOutline(new PdfOutline(bar, myDestination,
> > theObject.name));
> >                 } else if ( theDo.type == 3 ) {
> >                     cb.addOutline(new PdfOutline(tar, myDestination,
> > theObject.name));
> >                 } else if ( theDo.type == 0 ) {
> >                     cb.addOutline(new PdfOutline(mono, myDestination,
> > theObject.name));
> >                 }
> >           }
> > 
> > The resulted PDF files turns out that only the first a few objects' name
> > showing under (foo, bar, tar, or mono) outLines.
> > 
> > If I decide to put every object's name as a sub-outLine under "foo" (
> > disregard the object type ), like this:
> > 
> >          for ( int i = 0; i<objectVector.size(); i++) {
> > 
> >                 objectType theObject =
> > (objectType)objectVector.elememntAt(i);
> >                 PdfDestination myDestination = new PdfDestination(//blar
> > blar here);  //psedo code
> >                 cb.addOutline(new PdfOutline(foo, myDestination,
> > theObject.name)); 
> >           }
> > 
> > , then they all show up under "foo". 
> > 
> > It strikes to me that the cb.addOutline() has some limitation on adding
> > new
> > sub-outLines.
> > 
> > Or did I miss something here?  Please help.
> > 
> > Thanks a lot,
> > 
> > Don
> > 
> > _______________________________________________
> > iText-questions mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/itext-questions

Attachment: TestOutLines.java
Description: Binary data

Reply via email to