Great! I got it working now. Thank you very much for your assistance Mr.
Soares.

The following lines did the job. 

FontFactory.register("arialuni.ttf");
StyleSheet st = new StyleSheet();
st.loadTagStyle("body", "face", "arial unicode ms"); 
st.loadTagStyle("body", "encoding", "Identity-H"); 
st.loadTagStyle("body", "leading", "12,0");

However, this was just to test that I can produce these symbols and my
actual solution is a bit different and is specific to the Flying Saucer
project (which uses iText). I know this is not a Flying Saucer forum but I
think it might be useful to someone so here it goes:

I took two steps:

1). I added the following lines in the XHTML' s <head> tag: 

<style type="text/css">
  body{font-family: "Arial Unicode MS";}
</style>

2). I added the following lines (Flying Saucer specific) just before setting
the document to the renderer.

ITextFontResolver resolver = renderer.getFontResolver();
resolver.addFont(
        "resources/arialuni.ttf", //this font displays math symbols 
        BaseFont.IDENTITY_H,
        BaseFont.EMBEDDED);

Now, since I explicitly add a font in the FontResolver I would expect it to
work even without having to declare the font-family element in the XHTML.
But that don' t happen. You have to do both above steps. Well, of course I
hardly expect an answer to that here since it is a Flying Saucer matter.
Just in case anyone knows anything ...


Paulo Soares-3 wrote:
> 
> See http://article.gmane.org/gmane.comp.java.lib.itext.general/19921/.
> 
> Paulo 
> 
>> -----Original Message-----
>> From: Kanaras, Nikolaos [mailto:[email protected]] 
>> Sent: Monday, July 13, 2009 11:06 AM
>> To: [email protected]
>> Cc: Paulo Soares
>> Subject: FW: &le; and &#8804 and probably other similar tags 
>> are invisible
>> 
>> 
>> > -----Original Message-----
>> > From: Kanaras, Nikolaos [mailto:[email protected]] 
>> > Sent: Monday, July 13, 2009 10:24 AM
>> > To: Paulo Soares
>> > Subject: RE: &le; and &#8804 and probably other similar tags 
>> > are invisible
>> > 
>> > Thank you very much for the prompt reply,
>> > 
>> > I added the following line in my css (the one that is 
>> declared in the
>> > xhtml file): body {font-family: "Arial"}
>> > And still nothing different happens. I'm still getting a 
>> space instead
>> > of the math symbol I expect.
>> > You meant something different when you said I should use an external
>> > font? Not by declaring it in the css? Can you please explain?
>> > 
>> > -----Original Message-----
>> > From: Paulo Soares [mailto:[email protected]] 
>> > Sent: Sunday, July 12, 2009 1:39 PM
>> > To: Kanaras, Nikolaos
>> > Subject: Re: &le; and &#8804 and probably other similar tags are
>> > invisible
>> > 
>> > It's a font problem. The built-in fonts, like Helvetica, don't have
>> > those 
>> > mathematical symbols. Use an external font, like arial.ttf, that
>> > contains 
>> > those characters.
>> > 
>> > Paulo
>> > 
>> > ----- Original Message ----- 
>> > From: "Kanaras, Nikolaos" <[email protected]>
>> > To: "Paulo Soares" <[email protected]>
>> > Sent: Friday, July 10, 2009 3:28 PM
>> > Subject: &le; and &#8804 and probably other similar tags 
>> are invisible
>> > 
>> > 
>> > Hi Dear Mr. Soares,
>> > 
>> > I am trying to make PDFs out of HTMLs. I already read in 
>> the book that
>> > iText 
>> > is not the best tool for that and there are other tools like 
>> > ICEBrowser.
>> > 
>> > I am using the Flying Saucer open source project which uses 
>> > iText under
>> > the 
>> > hoods. I have very nice results with one exception. The 
>> resulting PDFs
>> > do 
>> > not show some mathematical symbols like &le; (less than or 
>> equal to).
>> > 
>> > To solve this, the first thing I did was to move out the 
>> Flying Saucer
>> > jars 
>> > (and calls) to isolate iText and see where the problem is. I wrote a
>> > very 
>> > simple html (attached) that contained a couple of paragraphs 
>> > and headers
>> > and 
>> > of course the symbol I want to see. Then I used HTMLWorker to 
>> > parse it 
>> > (attached) guessing that iText limitations on parsing HTML 
>> > would not be 
>> > visible in such a simple html. The result I got was the 
>> simplePdf.pdf 
>> > (attached). As you can see everything is fine except that the 
>> > le and ge 
>> > symbols are invisible.
>> > 
>> > So, I tried to debug believing that these tags was just not 
>> > supported. I
>> > 
>> > would add them and then I would be able to see them. But 
>> that was not
>> > the 
>> > case. What I show was that when the Document object was 
>> complete (all
>> > the 
>> > tags returned by HTMLWorker were added to the Document) the 
>> symbols I
>> > wanted 
>> > to see were there as they should be !!! And they were they 
>> > from the very
>> > 
>> > beginning.
>> > 
>> > So, now I guess that it is not a matter of support. It is rather a
>> > matter of 
>> > display. In fact I am lost here because the symbols are in the right
>> > place 
>> > but somehow are invisible when output in a pdf.
>> > 
>> > Could you please help me with that?
>> > 
>> > Many thanks in advance for your precious time.
>> > 
>> > With kind regards / Mit freundlichem Gruss
>> > Nikolaos Kanaras
>> > Siemens A.E.- Athens
>> > 
>> > Development, Innovations & Projects
>> > Asklipiou  Str. 30
>> > 
>> > GR-145 68 Krioneri Attikis / Athens / Greece
>> > 
>> > Tel.: +30 210 6265630
>> > 
>> > Fax.: +30 210 6265637
>> > 
>> > E-mail:
>> > [email protected]<mailto:[email protected]>
> 
> 
> 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.
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time, 
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full
> prize  
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
> 

-- 
View this message in context: 
http://www.nabble.com/FW%3A--le--and---8804-and-probably-other-similar-tags-are-invisible-tp24459269p24495415.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to