title: Create PDF from HTML snippet using PdfSharp having external CSS classes included in the HTML
body: <p>I would like to know if there is any way by which I can </p>
  
  <blockquote>
    <p>Create PDF from HTML snippet using PdfSharp <code>having external CSS</code>
    <code>classes included in the HTML</code>.</p>
  </blockquote>
  
  <p>I have found a way to generate a pdf file using HTML content but my css classes are not getting applied to the PDF.</p>
  
  <p>Here is how I am doing it for simple html string:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using PdfSharp.Drawing;
  using PdfSharp.Pdf;
  using System.Drawing;
  using TheArtOfDev.HtmlRenderer.PdfSharp;
  using PdfSharp;
  
  public partial class _Default : System.Web.UI.Page 
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          PdfDocument pdf = PdfGenerator.GeneratePdf("&lt;h1&gt;tests&lt;/h1&gt;&lt;p&gt;test para&lt;/p&gt;", PageSize.A4,20,null,null,null);
          pdf.Save(@"C\testPDF.pdf");
  
      }
  }
  </code></pre>
  
  <p>ANd this is how it is generated:
  <img src="https://i.stack.imgur.com/lpoKN.png" alt="enter image description here"></p>
  
  <p>But what I want is to include HTML string like this:</p>
  
  <pre><code>&lt;h1&gt;tests&lt;/h1&gt;&lt;p class='para1'&gt;test para&lt;/p&gt;
  </code></pre>
  
  <p>Is there any way to achieve this? Using different library is not an issue only thing is that the used library should be an open source.</p>