Hello,
In
iTextSharp.tool.xml.css.apply.ChunkCssApplier class, String encoding is 
hardcoded to BaseFont.CP1252.
It's easy
to detect right to left languages data:
 
        static readonly Regex MatchArabicHebrew
= new Regex(@"[\u0600-\u06FF,\u0590-\u05FF]+",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
        public static bool IsRtl(string data)
        {
            if (string.IsNullOrEmpty(data))
return false;
            return
MatchArabicHebrew.IsMatch(data);
        }
 
And then
we can improve Apply method of ChunkCssApplier class for instance: 
 
        public Chunk Apply(Chunk c, Tag t)
        {
            String fontName = null;
            String encoding = BaseFont.CP1252;
            if (IsRtl(c.Content)) encoding =
BaseFont.IDENTITY_H;
 
Also
run_direction should be set for PdfPCell and other similar elements to RTL.
Ex.
iTextSharp.tool.xml.html.table.TableData class
 
public
override IList<IElement> End(IWorkerContext
ctx, Tag tag, IList<IElement> currentContent) {
            HtmlCell cell = new HtmlCell();
            IList<IElement> l = new
List<IElement>(1);
            foreach (IElement e in
currentContent) {
 
                if(e is Chunk)
                    if (IsRtl(((Chunk)e).Content))
                    {
                        cell.RunDirection =
PdfWriter.RUN_DIRECTION_RTL;
                    }
------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to