With automatic leading only the top in images is taken into account. If
the image goes below the baseline it may undershot the column.

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Timothy Woolley
> Sent: Thursday, April 21, 2005 9:22 PM
> To: iText Mail Group
> Subject: [iText-questions] Images and Column Text
> 
> Hello,
>     I am trying to put images into columns using ColumnText. 
> The images keep running over the end of the column and allot 
> of times off of the end of the page. I have , I am not sure 
> what I am doing wrong, but obviously I am doing something 
> wrong. Any suggestions would be appreciated: Following is how 
> I add the images and text to the column. I have tried a bunch 
> of combinations and keep coming up blank. Any help is appreciated. 
>  
>   ColumnText ct = new ColumnText(cb);
>         ct.setLeading(0,1);
>         ct.setUseAscender(true);
>      
>      int pos = 0;
>         float[] right = {5, 280};
>         float[] left = {305, 580};
>         int times=0;
>         Paragraph instructions = new Paragraph("",subtitlefont);
>         Chunk ins = new Chunk("Directions:",boldfont);
>   Chunk check = new Chunk("\63",checkfont);
>   Chunk best = new Chunk("BEST",subtitlefont2);
>         instructions.add(ins);
>   
>   instructions.add("For the following questions, place a check (");
>   instructions.add(check);
>   instructions.add(") next to the word or phrase which ");
>   instructions.add(best);
>   instructions.add(" answers the question or completes the 
> statement. ");
>         instructions.add(this.getStandardInstructions()  + "\n\n\n");
>         instructions.setIndentationRight(40);
>         instructions.setIndentationLeft(5);
>         ct.setIndent(5);
>         instructions.setAlignment(Paragraph.ALIGN_JUSTIFIED);
>         ct.addElement(instructions);
>         for(int i=0;i<questions.length;i++){
>    NJATCQuestionVariation f=questions[i].getRandomVariation();
>    Image im =f.getQuestionImage().getImage();
>    im.scaleToFit(250,700);
>    Paragraph p = new Paragraph();
>    //p.add(new Chunk("123/443/4309404/34909\n"));
>    p.add(new Chunk((i+1) + ". ",boldfont));
>    p.setLeading(0,0);
>    p.add(new 
> Chunk(f.getQuestionImage().getImage(),0,-(int)f.getQuestionIma
ge().getImage().scaledHeight(),false));
>    pos=(int)f.getQuestionImage().getImage().scaledHeight()+12;
>       p.setSpacingAfter(pos);
>    p.setKeepTogether(true);
>    ct.addElement(p);
>      } 
>    int status = 0;
>       int column = 0;
>       while((status & ColumnText.NO_MORE_TEXT) == 0) {
>        if(writer.getPageNumber()==1){
>               ct.setSimpleColumn(right[column],100, 
> left[column], 680,0,  Element.ALIGN_TOP);
>         }else{
>               ct.setSimpleColumn(right[column],100, 
> left[column], 780, 0, Element.ALIGN_TOP);
>         }
>         status=ct.go();
>         if ((status & ColumnText.NO_MORE_COLUMN) != 0) {
>              column++;
>              if (column > 1) {
>                   document.newPage();
>                   column = 0;
>                  }
>              }
>               
>              
>         }
>  
> Thanks
>     Tim
> 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to