code: protected void createDocument() throws ParserConfigurationException
      {
          DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = builderFactory.newDocumentBuilder();
          DocumentType doctype = builder.getDOMImplementation().createDocumentType("html", "-//W3C//DTD XHTML 1.1//EN", "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd");
          doc = builder.getDOMImplementation().createDocument("http://www.w3.org/1999/xhtml", "html", doctype);
          
          head = doc.createElement("head");
          Element meta = doc.createElement("meta");
          meta.setAttribute("http-equiv", "content-type");
          meta.setAttribute("content", "text/html;charset=utf-8");
          head.appendChild(meta);
          title = doc.createElement("title");
          title.setTextContent("PDF Document");
          head.appendChild(title);
          globalStyle = doc.createElement("style");
          globalStyle.setAttribute("type", "text/css");
          //globalStyle.setTextContent(createGlobalStyle());
          head.appendChild(globalStyle);
          
          body = doc.createElement("body");
          
          Element root = doc.getDocumentElement();
          root.appendChild(head);
          root.appendChild(body);
      }
docs: Creates a new empty HTML document tree.
  @throws ParserConfigurationException