If you create the font:

Font font = new Font(Font.HELVETICA, 12);

it will work. If you create it through FontFactory you'll have a Font
instance created from a BaseFont and it won't work in this context. If
you don't want to use an external font, create the Phrase as the example
font_selector.java in http://itextpdf.sf.net.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Richard Corfield
> Sent: Monday, November 15, 2004 10:22 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [iText-questions] UTF-8 Characters from XML to PDF
> 
> Thanks for your reply, Paulo. 
> 
> I have managed to get greek chars from the XML to the PDF 
> now, however it only works if I do not specify the font in a 
> Phrase(), i.e.:
> 
> values.addElement(new Phrase(fcval));
> 
> If I try to specify a font it does not work:
> 
>   Font times = FontFactory.getFont(FontFactory.HELVETICA, 
> fsize, Font.BOLD);
>   //Font times = FontFactory.getFont(FontFactory.TIMES_ROMAN, 
> fsize, Font.BOLD);
> 
>    values.addElement(new Phrase(fcval, times));
> 
> Can you tell me if support for Greek Characters is only 
> available when you use the simple Phrase(String string) constructor?
> 
> Regards
> 
> Richard
> 
> 
> On Fri, 12 Nov 2004 17:01:03 -0000, Paulo Soares wrote:
> > You don't need to convert anything, that the job of the parser and
> > that's why you must specify the encoding in the XML. Whe you get a
> > String it already has the right char. 
> > 
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] 
> > > [mailto:[EMAIL PROTECTED] On 
> > > Behalf Of Richard Corfield
> > > Sent: Friday, November 12, 2004 4:18 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: [iText-questions] UTF-8 Characters from XML to PDF
> > > 
> > > Hi
> > > 
> > > I have a problem getting UTF-8 encoded characters from XML to PDF.
> > > 
> > > I have searched the archives and managed to learn a lot from 
> > > that, so I understand that my font in general does not 
> > > support special characters. However since most of my special 
> > > characters are in fact greek symbols and iText supports greek 
> > > symbols I should be able to get at least the greek symbols 
> > > into my PDF using Phrase().
> > > 
> > > I have been able to get a greek 'beta' using either of 
> these methods:
> > >  Phrase retval = new Phrase("\u03B2" + (char) 948);
> > > 
> > > My problem therefore boils down to this: How can I identify 
> > > the encoded chars in the text I extract from my XML and 
> > > convert them into either of the above forms. 
> > > This is how I extract text from the XML and I can see the 
> > > characters encoded correctly in the java:
> > > 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to