Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void exportToPDF(string html){
- // also you can get html file locally if u want
- //string html = File.ReadAllText(@"C:\Users\adriatik.ademi\Desktop\me\test.html"); (change path)
- HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
- doc.LoadHtml(html);
- var htmlHead = doc.DocumentNode.SelectSingleNode("//head");
- HtmlNode newPara = HtmlNode.CreateNode("<style>* { direction:rtl; }</style>");
- htmlHead.ChildNodes.Add(newPara);
- html = doc.DocumentNode.InnerHtml;
- IronPdf.HtmlToPdf Renderer = new IronPdf.HtmlToPdf();
- Renderer.RenderHtmlAsPdf(html).SaveAs(@"C:\Users\adriatik.ademi\Desktop\me\iron.pdf"); //you should change this path!
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement