title: HTML to PDF using iText External CSS
body: <p>I am using Flying Saucer to render some PDF documents from strings to HTML.</p>
  
  <pre><code>DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
  InputStream is = new ByteArrayInputStream(html.getBytes("UTF-8"));
  Document doc = builder.parse(is);
  
  response.setContentType("application/pdf; charset=UTF-8");
  response.setHeader("Content-disposition", "inline; filename=\"" + outFileName + "\"");
  
  OutputStream os = response.getOutputStream();
  
  ITextRenderer iTextRenderer = new ITextRenderer();
  iTextRenderer.setDocument(doc,null);
  iTextRenderer.layout();
  iTextRenderer.createPDF(os);
  os.flush();
  os.close();
  </code></pre>
  
  <p>This works fine When I have plain text. 
  I have referenced an external CSS in my HTML content. But, When PDF gets generated CSS doesn't get applied.</p>
  
  <p>I have read that The <code>setDocument()</code> method takes two parameters: document and url. The url parameter indicates the base url used to prepend to relative paths that appear in the xhtml, such as an external CSS</p>
  
  <p>So, I have tried to supply </p>
  
  <blockquote>
    <p>context path/css</p>
  </blockquote>
  
  <p>direcotry in the baseURL and used it in the <code>setDocument()</code>. Still no result </p>
  
  <p>So, My Question What is the correct URL to pass as baseURL ?</p>
  
  <pre><code>String baseURL = ""; // What goes here as root URL for resources
  iTextRenderer.setDocument(doc,baseURL);
  </code></pre>