List of usage examples for com.itextpdf.text.pdf PdfPCell setBorder
public void setBorder(final int border)
From source file:nwk.com.br.documents.ClienteMaisComprouPdf.java
private PdfPTable cabecalho() throws Exception { //Cria Uma nova tabela com tres colunas, onde cada uma ocupa 20%, 20% e 60% do tamanho delas PdfPTable cabecalho = new PdfPTable(new float[] { 0.3f, 0.4f, 0.3f }); cabecalho.setWidthPercentage(100.0f);//seta o tamanho da tabela em relaao ao documento cabecalho.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); cabecalho.getDefaultCell().setBorder(0); //Instancia a imagem da logo da empresa Image img = Image.getInstance("logoorc.png");//instancia a imagem img.setAlignment(Element.ALIGN_CENTER);//alinha a imagem no centro //Cria uma linha da tabela que pegara 3 linhas com a logo nela PdfPCell logo = new PdfPCell(img); logo.setBorder(0); logo.setRowspan(3);/*w w w . j a v a 2s.c o m*/ //adiciona a logo a tabela cabecalho.addCell(logo); //adiciona informaes da empresa a tabela cabecalho.addCell(new Phrase(new Chunk("Sos da Piscina", f))); cabecalho.addCell(new Phrase(new Chunk(formatDate.format(dia).toString(), f))); cabecalho.addCell(new Phrase(new Chunk("Avenida Rebouas, 1440 - Centro", f))); cabecalho.addCell(new Phrase(new Chunk("Sumar/SP - 13170-140", f))); cabecalho.addCell(new Phrase(new Chunk("contato@sosdapiscina.com.br", f))); cabecalho.addCell(new Phrase(new Chunk("www.sosdapiscina.com.br", f))); cabecalho.addCell(new Phrase(new Chunk("", f))); return cabecalho; }
From source file:nwk.com.br.documents.OrcamentoPdf.java
private PdfPTable cabecalho(Orcamento orcamento) throws Exception { //Cria Uma nova tabela com tres colunas, onde cada uma ocupa 20%, 20% e 60% do tamanho delas PdfPTable cabecalho = new PdfPTable(new float[] { 0.3f, 0.4f, 0.3f }); cabecalho.setWidthPercentage(100.0f);//seta o tamanho da tabela em relaao ao documento cabecalho.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); cabecalho.getDefaultCell().setBorder(0); //Instancia a imagem da logo da empresa Image img = Image.getInstance("logoorc.png");//instancia a imagem img.setAlignment(Element.ALIGN_CENTER);//alinha a imagem no centro //Cria uma linha da tabela que pegara 3 linhas com a logo nela PdfPCell logo = new PdfPCell(img); logo.setBorder(0); logo.setRowspan(3);/* ww w . j av a 2 s .c om*/ //adiciona a logo a tabela cabecalho.addCell(logo); //adiciona informaes da empresa a tabela cabecalho.addCell(new Phrase(new Chunk("Sos da Piscina", f))); cabecalho.addCell(new Phrase(new Chunk(formatDate.format(orcamento.getDhOrcamento()).toString(), f))); cabecalho.addCell(new Phrase(new Chunk("Avenida Rebouas, 1440 - Centro", f))); cabecalho.addCell(new Phrase(new Chunk("Sumar/SP - 13170-140", f))); cabecalho.addCell(new Phrase(new Chunk("contato@sosdapiscina.com.br", f))); cabecalho.addCell(new Phrase(new Chunk("www.sosdapiscina.com.br", f))); cabecalho.addCell(new Phrase(new Chunk("", f))); return cabecalho; }
From source file:nwk.com.br.documents.OrcamentoPdf.java
private PdfPTable dadosCliente(Orcamento orcamento) throws Exception { cliente = clientedao.select(orcamento.getIdCliente()); PdfPTable dadosCliente = new PdfPTable(new float[] { 0.35f, 0.35f, 0.3f }); dadosCliente.setWidthPercentage(90.0f);//seta o tamanho da tabela em relaao ao documento dadosCliente.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);//alinha os dados a esquerda dadosCliente.getDefaultCell().setBorder(0);//retira a borda //Cria uma cedula da tabela que pegara tres colunas PdfPCell nomeCli = new PdfPCell(new Paragraph("Nome: " + cliente.getNome(), f)); nomeCli.setColspan(3);//from ww w .j a va2s. c om nomeCli.setHorizontalAlignment(Element.ALIGN_LEFT); nomeCli.setBorder(0); dadosCliente.addCell(nomeCli); //formatao do celular e do telefone String celular = new String(); String telefone = new String(); celular = "(" + cliente.getCelular().substring(0, 2) + ") " + cliente.getCelular().substring(2); telefone = "(" + cliente.getTelefone().substring(0, 2) + ") " + cliente.getCelular().substring(2); //adciona os demais dados do cliente a tabela dadosCliente.addCell("E-mail: " + cliente.getEmail()); dadosCliente.addCell("Telefone: " + telefone); dadosCliente.addCell("Celular: " + celular); dadosCliente.addCell("Rua: " + cliente.getRua() + ", " + cliente.getNumero()); dadosCliente.addCell("Bairro: " + cliente.getBairro()); dadosCliente.addCell("Complemento: " + cliente.getComplemento()); dadosCliente.addCell(cliente.getCidade() + "/" + cliente.getEstado()); dadosCliente.addCell(cliente.getCep()); return dadosCliente; }
From source file:nwk.com.br.documents.OrcamentoPdf.java
private PdfPTable dadosPagamento(Orcamento orcamento) throws Exception { Font fontTotal = new Font(Font.FontFamily.TIMES_ROMAN, 16); PdfPTable dPagamento = new PdfPTable(new float[] { 0.5f, 0.2f, 0.3f }); dPagamento.setWidthPercentage(100.0f);//seta o tamanho da tabela em relaao ao documento dPagamento.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); dPagamento.getDefaultCell().setBorder(0); //celula com espao em branco e com o Total PdfPCell spc = new PdfPCell(new Paragraph(" ")); PdfPCell total = new PdfPCell(new Paragraph("TOTAL: R$" + orcamento.getTotal(), fontTotal)); //alinha a celula total a esquerda total.setHorizontalAlignment(Element.ALIGN_RIGHT); spc.setColspan(3);// w w w. j a v a 2 s .co m total.setBorder(0); spc.setBorder(0); if (orcamento.getFormaPagamento().equals("0")) { dPagamento.addCell(new Paragraph("Forma de Pagamento: A vista - Dinheiro", f)); } else if (orcamento.getFormaPagamento().equals("1")) { dPagamento.addCell(new Paragraph("Forma de Pagamento: A vista - Carto", f)); } else if (orcamento.getFormaPagamento().equals("2")) { dPagamento.addCell(new Paragraph("Forma de Pagamento: Parcelado", f)); } dPagamento.addCell(new Paragraph("Desconto: R$" + orcamento.getDesconto(), f)); dPagamento.addCell(total); return dPagamento; }
From source file:nwk.com.br.documents.OrcamentoPdf.java
private PdfPTable dadosRodape(Orcamento orcamento) throws Exception { //tabela que pega com 100% do tamanho do arquivo, alinhada no centro com tres colunas e sem bordas PdfPTable rodape = new PdfPTable(new float[] { 0.5f, 0.2f, 0.3f }); rodape.setWidthPercentage(100.0f);//seta o tamanho da tabela em relaao ao documento rodape.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); rodape.getDefaultCell().setBorder(0); PdfPCell obs = new PdfPCell(new Paragraph("\n\n Observaes:\n" + orcamento.getObservacoes(), f)); PdfPCell ass = new PdfPCell(new Paragraph("\n\n_________________________\nAssinatura", f)); Font fonteAviso = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLDITALIC); PdfPCell spc = new PdfPCell(new Paragraph(" ")); PdfPCell aviso = new PdfPCell(new Paragraph( "AGRADEEMOS A PREFERNCIA\nORAMENTO VALIDO SOMENTE PARA O DIA DE SUA CRIAO!", fonteAviso)); aviso.setHorizontalAlignment(Element.ALIGN_CENTER); obs.setHorizontalAlignment(Element.ALIGN_LEFT); ass.setHorizontalAlignment(Element.ALIGN_CENTER); obs.setBorder(0); ass.setBorder(0);//from w ww . j a v a 2s . com spc.setBorder(0); aviso.setBorder(0); spc.setColspan(3); aviso.setColspan(3); rodape.addCell(obs); rodape.addCell(new Paragraph(" ")); rodape.addCell(ass); rodape.addCell(spc); rodape.addCell(spc); rodape.addCell(spc); rodape.addCell(spc); rodape.addCell(aviso); //rodape.setExtendLastRow(true); //cria uma nova celula que recebe a tabela anterior PdfPCell otherCell = new PdfPCell(rodape); otherCell.setBorder(0); otherCell.setVerticalAlignment(Element.ALIGN_BOTTOM); otherCell.setHorizontalAlignment(Element.ALIGN_CENTER); //cria uma nova tabela que recebe a celula otherCell PdfPTable rodape2 = new PdfPTable(new float[] { 1.0f }); rodape2.setWidthPercentage(100.0f);//seta o tamanho da tabela em relaao ao documento rodape2.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); rodape2.getDefaultCell().setBorder(0); //estende a tabela at o fim da pagina, como o alinhamento horizontal dela bottom, ela fica toda no rodape rodape2.addCell(otherCell); rodape2.setExtendLastRow(true); return rodape2; }
From source file:org.agmip.ui.afsirs.util.AFSIRSUtils.java
private void addParagraphToTable(PdfPTable table, String str) { Paragraph p = new Paragraph(str, BLUE_NORMAL); p.setAlignment(Element.ALIGN_CENTER); PdfPCell c = new PdfPCell(); c.addElement(p);/*from w ww. j a v a 2s .co m*/ c.setBorder(0); table.addCell(c); }
From source file:org.agmip.ui.afsirs.util.AFSIRSUtils.java
private void addParagraphToTableSoilName(PdfPTable t, String key, String value) { PdfPCell c; Paragraph p = new Paragraph(); Chunk keyChunk = new Chunk(key, BLACK_NORMAL); Chunk valChunk = new Chunk(value, BLACK_BOLD); p.add(keyChunk);// ww w. j ava2 s.c o m p.add(valChunk); c = new PdfPCell(p); c.setHorizontalAlignment(Element.ALIGN_CENTER); c.setBorder(0); t.addCell(c); }
From source file:org.agmip.ui.afsirs.util.AFSIRSUtils.java
private void addUserDetails(PdfPTable t, String key, String value) { PdfPCell c; Paragraph p = new Paragraph(); Chunk keyChunk = new Chunk(key, BLACK_NORMAL); Chunk valChunk = new Chunk(value, BLACK_BOLD); p.add(keyChunk);//from w w w. j a va 2s . c o m p.add(valChunk); c = new PdfPCell(p); c.setHorizontalAlignment(Element.ALIGN_LEFT); c.setBorder(0); t.addCell(c); }
From source file:org.fossa.rolp.util.PdfFormatHelper.java
License:Open Source License
public static PdfPTable buildHeaderNameLine(String schuelername, Font headerFont) throws DocumentException { PdfPCell labelCell = new PdfPCell(new Phrase("Name", headerFont)); labelCell.setBorder(Rectangle.BOTTOM); labelCell.setBorderWidth(1f);//from w w w .ja v a 2 s .c o m PdfPCell nameCell = new PdfPCell(new Phrase(schuelername, headerFont)); nameCell.setBorder(Rectangle.BOTTOM); nameCell.setBorderWidth(1f); nameCell.setColspan(5); PdfPTable table = prebuildHeaderTable(); table.addCell(labelCell); table.addCell(nameCell); return table; }
From source file:org.fossa.rolp.util.PdfFormatHelper.java
License:Open Source License
public static PdfPTable buildHeaderKlassendatenLine(LebData lebData, Font headerFont) throws DocumentException { PdfPCell leftLabelCell = new PdfPCell(new Phrase("Klasse", headerFont)); leftLabelCell.setBorder(Rectangle.BOTTOM); leftLabelCell.setBorderWidth(1f);// w w w . j av a 2 s . c o m PdfPCell leftValueCell = new PdfPCell(new Phrase(lebData.getKlassenname(), headerFont)); leftValueCell.setBorder(Rectangle.BOTTOM); leftValueCell.setBorderWidth(1f); PdfPCell centerLabelCell = new PdfPCell(new Phrase("Schuljahr", headerFont)); centerLabelCell.setBorder(Rectangle.BOTTOM); centerLabelCell.setBorderWidth(1f); PdfPCell centerValueCell = new PdfPCell(new Phrase(lebData.getSchuljahr(), headerFont)); centerValueCell.setBorder(Rectangle.BOTTOM); centerValueCell.setBorderWidth(1f); PdfPCell rightLabelCell = new PdfPCell(new Phrase("Schulhalbjahr", headerFont)); rightLabelCell.setBorder(Rectangle.BOTTOM); rightLabelCell.setBorderWidth(1f); PdfPCell rightValueCell = new PdfPCell( new Phrase(lebData.getSchulhalbjahr().getId().toString(), headerFont)); rightValueCell.setBorder(Rectangle.BOTTOM); rightValueCell.setBorderWidth(1f); PdfPTable table = prebuildHeaderTable(); table.addCell(leftLabelCell); table.addCell(leftValueCell); table.addCell(centerLabelCell); table.addCell(centerValueCell); table.addCell(rightLabelCell); table.addCell(rightValueCell); return table; }