title: Namespace for using iTextSharp CSSResolver classes
body: <p>I am using iTextSharp CSSResolver classes for using external css in vb.net</p>
  
  <p>Please let me know the namespaces for using <code>XMLWorkerFontProvider</code>, <code>CssFilesImpl</code>, <code>StyleAttrCSSResolver</code> classes.</p>
  
  <p>Below is my code:</p>
  
  <pre><code>    Dim fontProvider As XMLWorkerFontProvider = New XMLWorkerFontProvider()
  
      Dim cssFiles As CssFilesImpl = New CssFilesImpl(fontProvider)
  
      cssFiles.Add(XMLWorkerHelper.GetInstance().GetDefaultCSS())
  
      Dim cssRevolver As StyleAttrCSSResolver = New StyleAttrCSSResolver()
  
      Dim htmlContext As HtmlPipelineContext = New HtmlPipelineContext()
  
      htmlContext.SetTagFactory(Tags.GetHtmlTagProcessorFactory())
  
      htmlContext.SetImageProvider(New MyImageProvider(imagePath))
  
      Dim pipeline As IPipeline = New CssResolverPipeline(cssRevolver, New HtmlPipeline(htmlContext, New PdfWriterPipeline(Document, writer)))
  
      Dim worker As XMLWorker = New XMLWorker(pipeline, True)
  
      Dim p As XMLParser = New XMLParser(worker)
  
      p.Parse(xmlString)
  </code></pre>
  
  <p>Thanks
  Ramesh</p>
  
  <p>Dim sw As New StringWriter()</p>
  
  <p>Dim hw As New HtmlTextWriter(sw)</p>
  
  <p>strMonthlyDataHtml = LoadReport("PDF")</p>
  
  <p>ltrPDFReport.Text = strMonthlyDataHtml</p>
  
  <p>ltrPDFReport.RenderControl(hw)</p>
  
  <p>Dim sr As New StringReader(sw.ToString())</p>
  
  <p>Dim pdfDoc As New Document(iTextSharp.text.PageSize.A4, 10.0F, 10.0F, 100.0F, 0.0F)</p>
  
  <p>Dim memStream = New MemoryStream()</p>
  
  <p>Dim writer = PdfWriter.GetInstance(pdfDoc, memStream)</p>
  
  <p>writer.CloseStream = False</p>
  
  <p>pdfDoc.Open()</p>
  
  <p>Dim htmlContext As New HtmlPipelineContext(Nothing)</p>
  
  <p>htmlContext.SetTagFactory(Tags.GetHtmlTagProcessorFactory())</p>
  
  <p>Dim cssResolver = XMLWorkerHelper.GetInstance().GetDefaultCssResolver(False)</p>
  
  <p>cssResolver.AddCssFile(Server.MapPath("../Assets/css/Efficiency.css"), True)</p>
  
  <p>cssResolver.AddCssFile(Server.MapPath("/Assets/css/Efficiency.css"), True)</p>
  
  <p>Dim pipeline As IPipeline = New CssResolverPipeline(cssResolver, New<br>
       HtmlPipeline(htmlContext, New PdfWriterPipeline(pdfDoc, writer)))</p>
  
  <p>Dim worker As XMLWorker = New XMLWorker(pipeline, True)</p>
  
  <p>Dim p As New XMLParser(worker)</p>
  
  <p>p.Parse(sr)</p>
  
  <p>pdfDoc.Close()</p>