Hi Bruno

Thanks for you're answer.
I tried to solve it using ColumnText but this somehow doesn't work - when
opening the resulting pdf i get two errors "Illegal operation 'm' inside a
text object" and "Illegal operation 'ET' outside text object". Also the pdf
page looks quite stange. A lot of elements are missing. 

The code i use:


PdfContentByte cb = writer.getDirectContent();

// some other cb drawing here

cb.beginText();    
BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252,
BaseFont.NOT_EMBEDDED);
String absender = tenant_company + ", " + tenant_street + " " +
tenant_streetnumber + ", " + tenant_zip + " " + tenant_city;
com.lowagie.text.Font font_absender = new com.lowagie.text.Font(bf, 11,
com.lowagie.text.Font.UNDERLINE);
Phrase absender_phrase = new Phrase(11, "Test2", font_absender);
ColumnText ct = new ColumnText(cb);
ct.setSimpleColumn(absender_phrase, 60, 150, 100, 250 , 0,
Element.ALIGN_LEFT);
ct.go();
cb.endText();

// some other cb drawing here


When removing this part of the code, the pdf page is perfectly generated, so
there must be something wrong in the lines above, but i have no idea what i
could be. Maybe you see where i've done a mistake?

Thanks a lot for your help
Frank

 

> -----Original Message-----
> From: bruno [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 22, 2006 1:47 PM
> To: Frank Fischer
> Cc: itext-questions@lists.sourceforge.net
> Subject: Re: [iText-questions] (no subject)
> 
> Frank Fischer wrote:
> 
> > I use DirectContent and would like to write underlined text to a 
> > specific position. For normal text i use:
> >  
> > PdfWriter writer = PdfWriter.getInstance(document, new 
> > FileOutputStream("test.pdf"));
> > document.open();
> > PdfContentByte cb = writer.getDirectContent();
> > cb.beginText();                         
> > BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, 
> BaseFont.CP1252, 
> > BaseFont.NOT_EMBEDDED);
> > cb.setFontAndSize(bf, 10);
> > cb.showTextAligned(PdfContentByte.ALIGN_LEFT, "text", 10, 10, 0);
> >  
> > Now i could not find a way to make a BaseFont underlined. 
> In the Font 
> > class, there is a related method to underline the text, but 
> i can not 
> > set Font with cb.setFontAndSize().
> 
> No, class Font is a convenience class wrapped around BaseFont.
> It can only be used in objects such as Paragraph, Phrase, Chunk,...
> 
> > <> Could please someone give a hint, how i can solve that issue?
> 
> You can use ColumnText. You can add all kinds of objects to
> a ColumnText object, including underlined Chunks of text.
> Place the ColumnText at the absolute position and you're done.
> 
> Or you can draw the line yourself using moveTo, lineTo and stroke
> commands.
> 
> br,
> Bruno
> 




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to