public void printBoleto() {
Boleto boleto = boletoBancarioService.createBoleto(
empresaService.findById(AppConstants.EMPRESA_APP_OWNER),
pedido.getCliente(), pedido.getNumero().toString(),
pedidoService.calculateValorPedido(pedido));
FacesContext context = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
try {
BoletoViewer viewer = new BoletoViewer(boleto);
byte[] pdfAsBytes = viewer.getPdfAsByteArray();
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment; filename=boleto.pdf");
OutputStream output = response.getOutputStream();
output.write(pdfAsBytes);
response.flushBuffer();
FacesContext.getCurrentInstance().responseComplete();
} catch (Exception e) {
e.printStackTrace();
}
}
response.setHeader("Content-Disposition", "attachment; filename=boleto.pdf");
--
Você recebeu esta mensagem porque está inscrito no Grupo "JRimum
Community" nos Grupos do Google.
Para postar neste grupo, envie um e-mail para
jrimum-c...@googlegroups.com
ANTES DE POSTAR... leia:
https://groups.google.com/d/topic/jrimum-community/ULU8QHHgaBs/discussion
Para cancelar a sua inscrição neste grupo, envie um e-mail para
jrimum-communi...@googlegroups.com
Para ver mais opções, visite este grupo em
http://groups.google.com/group/jrimum-community?hl=pt-BR?hl=pt-BR
