Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] Change line spacing within one document

Holger Rieß

2006-09-22

Replies:

Hi,

Is it possible to change line spacing within one document?
I've tried the following code:

 Paragraph mainParagraph = new Paragraph();
 mainParagraph.setLeading(11.5f);

 Paragraph subParagraph = new Paragraph();
 subParagraph.setLeading(14f);

 // ...
 // add some text to subParagraph
 for (...) {
   subParagraph.add(new Chunk(tokenizer.sval, fonts[0]));
   // ...  
   subParagraph.add(new Chunk(Chunk.NEWLINE));
   // ...
 }

 mainParagraph.add(subParagraph);
 document.add(mainParagraph);

The space between the lines of subParagraph is always 11.5 from mainParagraph.
This is only an example - I have to change the leading often within the document.
My intention was keeping all lines with the same distance together in one paragraph.
But this doesn't work. It looks like that the top paragraph determinies the leading.
What I'm doing wrong?

Holger



____________
Virus checked by G DATA AntiVirusKit


Attachment: holger.riess.vcf
-------------------------------------------------------------------------
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
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
©2008 junlu.com - Jax Systems, LLC, U.S.A.