here is the code that i used
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DivToPdf.aspx.cs" Inherits="divtopdf.DivToPdf" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div class="lead" id="MyDiv" runat="server">
<p>
Each package is licensed to you by its owner. NuGet is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies.
Package Manager Console Host Version 4.0.0.2323
Type 'get-help NuGet' to see all available NuGet commands.
</p>
</div>
<div class="lead" style="direction:rtl;">
<p> لاوروف: آخرین ذره اعتمادمان به غرب را هم داریم از دست میدهیم</p>
</div>
<asp:Button ID="btnConvert" Text="Convert" runat="server" OnClick="btnConvert_Click" />
</form>
</body>
</html>
and this is the button event based onclick event
protected void btnConvert_Click(object sender, EventArgs e)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=div.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
MyDiv.RenderControl(htmlTextWriter);
StringReader stringReader = new StringReader(stringWriter.ToString());
Document Doc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser = new HTMLWorker(Doc);
PdfWriter.GetInstance(Doc, Response.OutputStream);
Doc.Open();
htmlparser.Parse(stringReader);
Doc.Close();
Response.Write(Doc);
Response.End();
}