String renderedXHTML = buffer.toString();
// System.out.println(renderedXHTML);
File baseDirectory = new File(baseDirectoryName);
try {
URL url = baseDirectory.toURI().toURL();
PDFGenerator gen = new PDFGenerator(url);
gen.create(baseDirectoryName + '/' + filename, renderedXHTML,
PDFGenerator.HEADER_TEMPLATE, PDFGenerator.FOOTER,
"Big Test", cssStyle);
} catch (Exception e) {
e.printStackTrace();
}