Only add Paragrah to Document. You'll have leading problems without
that.

Paulo 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of herman vierendeels
> Sent: Thursday, May 24, 2007 3:18 PM
> To: [email protected]
> Subject: [iText-questions] strange behaviour when Phrase 
> first element ofDocument
> 
> //strange behaviour when Phrase first element of Document 
> /*
> itext-2.0.2
> 
> in following program:
> 
> using constructor 1): output overprinted
> using constructor 2): output ok, but see also remark1
> 
> 1)document.add(new Phrase(0,"vp="+vp));
> 2)document.add(new Phrase("vp="+vp));
> */
> 
> import java.io.*;
> import java.sql.*;
> import java.util.logging.*;
> 
> import com.lowagie.text.*;
> import com.lowagie.text.pdf.*;
> 
> 
> public class brol1
> { 
>  public static void main(String[] args)
>  throws Exception      
>  {            
>   boolean use1=true;
>   if(args.length>0) use1=false;
>   
>   Document.compress=false;
>   Rectangle pageSize=PageSize.A4;
>   float ptop=pageSize.top();
>   float pbottom=pageSize.bottom();
>   float pright=pageSize.right();
>   float pleft=pageSize.left();
>   float pwidth=pright-pleft;
>   float pheigth=ptop-pbottom;
>   
>   Document document=new Document(pageSize);
>   String pdfnm="/tmp/brol1.pdf";
>   PdfWriter pw=PdfWriter.getInstance(document,new 
> FileOutputStream(pdfnm));
>   
>   document.open();
>   float vp=pw.getVerticalPosition(false);
> 
>   float dtop=document.top();
>   float dbottom=document.bottom();
>   float dright=document.right();
>   float dleft=document.left();
>   float dwidth=dright-dleft;
>   float dheigth=dtop-dbottom;
>  
>   //if document begins with only chunks,NEWLINE not honoured
>   // first newlines missing,first chunks overprinted 
>   // see 
> http://article.gmane.org/gmane.comp.java.lib.itext.general/995
> 9/match=chunk+newline
>   if(use1) document.add(new Phrase(0,"vp="+vp));
>   else document.add(new Phrase("vp="+vp));
>   document.add(Chunk.NEWLINE);
>   vp=pw.getVerticalPosition(false);
>   //remark1 vp has not diminished!!??  
>   document.add(new Chunk("vp="+vp+" ptop="+ptop+" 
> pbottom="+pbottom+" pheight="+pheigth));
>   document.add(Chunk.NEWLINE);
>   vp=pw.getVerticalPosition(false);
>   document.add(new Chunk("vp="+vp+" pleft="+pleft+" 
> pright="+pright+" pwidth="+pwidth));
>   document.add(Chunk.NEWLINE);  
>   vp=pw.getVerticalPosition(false);
>   document.add(new Chunk("vp="+vp+" dtop="+dtop+" 
> dbottom="+dbottom+" dheight="+dheigth));
>   document.add(Chunk.NEWLINE);  
>   vp=pw.getVerticalPosition(false);
>   document.add(new Chunk("vp="+vp+" dleft="+dleft+" 
> dright="+dright+" dwidth="+dwidth));
>   document.add(Chunk.NEWLINE);  
>   document.close();
>  }
> }


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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/

Reply via email to