Patrick Kaegi wrote:
the code looks like this:

Paragraph paragraph = new Paragraph();
paragraph.add(new Phrase("foo ", normalFont);
paragraph.add(new Phrase("bold", boldFont);
paragraph.add(new Phrase(" bar", normalFont);
document.add(paragraph);

and the text looks like this if "bar" begins on a new line:

foo bold
 bar

(there is always a space before bar, even on a new line)

The problem cannot be reproduced. See attachment:
I have created patrick.pdf with the code sample
PatrickKaegi.java. Please try the example yourself.

If you have further problems, adapt the file
PatrickKaegi.java so that it reproduces the problem,
and send the java code + the resulting PDF demonstrating
the problem to the mailing list.

We can't solve problems if we can't reproduce them.
br,
Bruno

Attachment: patrick.pdf
Description: Adobe PDF document

package test;

import java.io.FileOutputStream;
import java.io.IOException;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.PdfWriter;

public class PatrickKaegi {
        public static void main(String[] args) {
                Document document = new Document();
                try {
                        PdfWriter.getInstance(document, new 
FileOutputStream("patrick.pdf"));
                        document.open();
                        Font normalFont = new Font();
                        Font boldFont = new Font(Font.HELVETICA, 12, Font.BOLD);
                        for (int i = 20; i < 30; i++) {
                                Paragraph paragraph = new Paragraph();
                                for (int j = 0; j < i; j++) {
                                        paragraph.add(new Phrase("foo ", 
normalFont));
                                }
                                paragraph.add(new Phrase("bold", boldFont));
                                paragraph.add(new Phrase(" bar", normalFont));
                                document.add(paragraph);
                        }
                } catch (IOException e) {
                        e.printStackTrace();
                } catch (DocumentException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                document.close();
        }
}
-------------------------------------------------------------------------
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
[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