Quantcast
Channel: HTML Renderer
Viewing all articles
Browse latest Browse all 693

New Post: RTL Support

$
0
0
Hi,
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"" ""http://www.w3.org/TR/html4/loose.dtd"">
                        <html xmlns=""http://www.w3.org/1999/xhtml"" dir=""rtl"">
                        <head>
</head><body dir=""rtl"" style=""direction:rtl"">");

            foreach (var item in data)
            {
                sb.Append(item.Content);
                sb.Append("<br/></br><br/></br>");
            }


            sb.Append("</body></html>");


            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.

Viewing all articles
Browse latest Browse all 693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>