Dim sw As New StringWriter() Dim hw As New HtmlTextWriter(sw) pnlPerson.RenderControl(hw) Dim sr As New StringReader(sw.ToString()) Dim appPath As String = HttpContext.Current.Request.ApplicationPath Dim path As String = Server.MapPath(Pdf file Path) Dim output = New FileStream(path, FileMode.Create) Dim ms As New MemoryStream() Dim document As New Document() document = New Document(PageSize.A4, 10.0F, 10.0F, 100.0F, 0.0F) Dim writer As PdfWriter = PdfWriter.GetInstance(document, output) Dim cssResolver As ICSSResolver = XMLWorkerHelper.GetInstance().GetDefaultCssResolver(False) cssResolver.AddCssFile(System.Web.HttpContext.Current.Server.MapPath("css file path"), True) 'cssResolver.AddCssFile(Server.MapPath(cssText), True) Dim htmlContext As New HtmlPipelineContext(Nothing) htmlContext.SetTagFactory(Tags.GetHtmlTagProcessorFactory()) Dim pdf As New PdfWriterPipeline(document, writer)//Here i get error Dim html As New HtmlPipeline(htmlContext, pdf) Dim pipeline As New CssResolverPipeline(cssResolver, html) Dim worker As New XMLWorker(pipeline, True) Dim xmlParse As New XMLParser(worker) xmlParse.Parse(sr) xmlParse.Flush() document.Close()
PdfWriterPipeline