This project is read-only.

RTL Support

Nov 30, 2013 at 9:58 PM
Edited Nov 30, 2013 at 9:58 PM
I tried to add RTL support for my html. I added the RTL tag to every object but didn't worked:
                       var sb = new StringBuilder();
            sb.Append(@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN"" """">
                        <html xmlns="""" dir=""rtl"">
</head><body dir=""rtl"" style=""direction:rtl"">");

            foreach (var item in data)


            var css = HtmlRenderer.CssData.Parse("html { direction:rtl; text-align:right } body { direction:rtl; text-align:right } table { direction:rtl!important; }", true);


            var img = HtmlRenderer.HtmlRender.RenderToImage(sb.ToString(), 600,  cssData: css);

            img.Save(Path.Combine(path, "file.jpg"));
I'm using the latest version (1.4.10).

Thank you for you help.
Dec 1, 2013 at 9:20 AM
there is a bug with handling <br/> elements in RTL
Until I fix it you can set RTL only on div that has the content in it like so:
body { text-align:right }
<div dir="rtl">
שלום עולם יש ברבורים בעגם
Note: currently the RTL support is very basic so make sure it works for you.