// renderer.createPDF(browserStream);
//out = new FileOutputStream(new File(CONVERSA_PATH));
String path = request.getParameter("path");
CYaHPConverter converter = new CYaHPConverter();
//File fout = new File("C:\\Users\\jacoboliveira\\Documents\\NetBeansProjects\\chat-mentor\\target\\chat-mentor-1.0-SNAPSHOT\\pdfs_gerados\\conversa_chat.pdf");
// out = new FileOutputStream(fout);
Map properties = new HashMap();
List headerFooterList = new ArrayList();
headerFooterList.add(new IHtmlToPdfTransformer.CHeaderFooter(
"<table width=\"100%\"><tbody><tr><td align=\"left\">"+
"Histórico da Conversa - Chat.</td><td align=\"right\">"+DateHelper.getDataHoje(DateHelper.FORMAT_DDMMYYYY_HHMM) +"- Página <pagenumber>/<"+
"pagecount></td></tr></tbody></table>",
IHtmlToPdfTransformer.CHeaderFooter.HEADER));
headerFooterList.add(new IHtmlToPdfTransformer.CHeaderFooter(
"<div align=\"center\">Copyright© 2014 Mentor Soluções Informática</div>",
IHtmlToPdfTransformer.CHeaderFooter.FOOTER));
properties.put(IHtmlToPdfTransformer.PDF_RENDERER_CLASS,
IHtmlToPdfTransformer.FLYINGSAUCER_PDF_RENDERER);
//properties.put(IHtmlToPdfTransformer.FOP_TTF_FONT_PATH, fontPath);
String sessionId = request.getSession(false).getId();
String urlContexto = request.isSecure()?"https":"http"+"://" + request.getServerName() + ":" +
request.getServerPort() +
request.getContextPath() + "/"+path+";jsessionid="+sessionId;
//Document doc = Jsoup.connect(urlContexto).get();
//Elements el = doc.getElementsByTag("html");
//String docHtml =doc.toString();
response.setContentType("application/pdf");
response.setHeader("Content-disposition", "inline; filename=conversa_chat.pdf");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Pragma", "No-cache");
converter.convertToPdf(new URL(urlContexto),
IHtmlToPdfTransformer.A4P,
headerFooterList,
response.getOutputStream(),
properties);
// out.flush();