List of usage examples for com.itextpdf.text Font ITALIC
int ITALIC
To view the source code for com.itextpdf.text Font ITALIC.
Click Source Link
From source file:Export.ReciboPagamento.java
public PdfPTable detaDoc(HashMap<String, Object> map, Font fontTitile, Font fontRecibo, Font fontTitileShort, Font fontReciboTxt, Font fontConteudo, Font fontConteudoTxt, Font fontConteudoTxtUl) throws DocumentException { PdfPTable pTablePrincipal = new PdfPTable(new float[] { 100 }); try {// w w w . j a v a 2 s.co m pTablePrincipal.setWidthPercentage(100f); PdfPTable pTableTitulo = new PdfPTable(new float[] { 60, 40 }); pTableTitulo.setWidthPercentage(100); PdfPTable pTableTituloImage = new PdfPTable(new float[] { 20, 80 }); pTableTituloImage.setWidthPercentage(100); PdfPCell cellTitulo = new PdfPCell(new Phrase(ConfigDoc.Empresa.NOME, fontTitile)); cellTitulo.setHorizontalAlignment(Element.ALIGN_CENTER); cellTitulo.setBorder(0); cellTitulo.setPaddingTop(20f); cellTitulo.setPaddingLeft(70f); pTableTitulo.addCell(cellTitulo); cellTitulo = new PdfPCell(new Phrase("Recibo N ".toUpperCase() + map.get(IDAMORTIZACAO), fontRecibo)); cellTitulo.setVerticalAlignment(Element.ALIGN_BOTTOM); cellTitulo.setHorizontalAlignment(Element.ALIGN_RIGHT); cellTitulo.setBorder(0); pTableTitulo.addCell(cellTitulo); cellTitulo = new PdfPCell(new Phrase(ConfigDoc.Empresa.ENDERECO + ", " + ConfigDoc.Empresa.CAIXAPOSTAL + ", " + ConfigDoc.Empresa.TELEFAX, fontTitileShort)); cellTitulo.setHorizontalAlignment(Element.ALIGN_CENTER); cellTitulo.setPaddingLeft(70f); cellTitulo.setBorder(0); pTableTitulo.addCell(cellTitulo); cellTitulo = new PdfPCell(new Phrase(" ", fontTitileShort)); cellTitulo.setPaddingBottom(0f); cellTitulo.setPaddingTop(0f); cellTitulo.setBorder(0); pTableTitulo.addCell(cellTitulo); cellTitulo = new PdfPCell(new Phrase(ConfigDoc.Empresa.REPUBLICA, fontTitileShort)); cellTitulo.setHorizontalAlignment(Element.ALIGN_CENTER); cellTitulo.setBorder(0); cellTitulo.setPaddingLeft(70f); pTableTitulo.addCell(cellTitulo); cellTitulo = new PdfPCell(new Phrase(" ", fontTitileShort)); cellTitulo.setPaddingBottom(0f); cellTitulo.setPaddingTop(0f); cellTitulo.setBorder(0); pTableTitulo.addCell(cellTitulo); cellTitulo = new PdfPCell(new Phrase(ConfigDoc.Empresa.EMAIL, fontTitileShort)); cellTitulo.setHorizontalAlignment(Element.ALIGN_CENTER); cellTitulo.setBorder(0); cellTitulo.setPaddingLeft(70f); pTableTitulo.addCell(cellTitulo); cellTitulo = new PdfPCell(new Phrase(" ", fontTitileShort)); cellTitulo.setPaddingBottom(0f); cellTitulo.setPaddingTop(0f); cellTitulo.setBorder(0); pTableTitulo.addCell(cellTitulo); cellTitulo = new PdfPCell(new Phrase("Ordem de receita / recibo".toUpperCase(), fontRecibo)); cellTitulo.setHorizontalAlignment(Element.ALIGN_CENTER); cellTitulo.setBorder(0); cellTitulo.setPaddingLeft(70f); pTableTitulo.addCell(cellTitulo); cellTitulo = new PdfPCell(new Phrase(" ", fontTitileShort)); cellTitulo.setVerticalAlignment(Element.ALIGN_TOP); cellTitulo.setPaddingBottom(30f); cellTitulo.setPaddingTop(0f); cellTitulo.setBorder(0); pTableTitulo.addCell(cellTitulo); Image imageEmpresa = Image.getInstance("logo.png"); imageEmpresa.scaleToFit(120f, 85f); imageEmpresa.setAlignment(Image.ALIGN_CENTER); PdfPCell cellImagem = new PdfPCell(imageEmpresa); cellImagem.setBorder(PdfPCell.NO_BORDER); cellImagem.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellImagem.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); PdfPCell cellpTableTitulo = new PdfPCell(pTableTitulo); cellpTableTitulo.setBorder(PdfPCell.NO_BORDER); cellpTableTitulo.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableTituloImage.addCell(cellImagem); pTableTituloImage.addCell(cellpTableTitulo); PdfPCell cellpTableTituloPrincipal = new PdfPCell(pTableTituloImage); cellpTableTituloPrincipal.setBorder(PdfPCell.NO_BORDER); pTablePrincipal.addCell(cellpTableTituloPrincipal); PdfPTable pTableDataCaixaMontante = new PdfPTable(new float[] { 35f, 5f, 60f }); pTableDataCaixaMontante.setWidthPercentage(100f); PdfPCell cellDataCaixaMontante = new PdfPCell(new Phrase(" ", fontRecibo)); cellDataCaixaMontante.setBorder(0); pTableDataCaixaMontante.addCell(cellDataCaixaMontante); pTableDataCaixaMontante.addCell(cellDataCaixaMontante); cellDataCaixaMontante = new PdfPCell(); cellDataCaixaMontante.setBorder(0); Paragraph p = new Paragraph(); p.add(new Phrase("Data: ".toUpperCase(), fontRecibo)); p.add(new Phrase(converterData(map.get(REGISTROAMORTIZACAO), 1), fontReciboTxt)); p.setAlignment(Element.ALIGN_RIGHT); cellDataCaixaMontante.addElement(p); cellDataCaixaMontante.setPaddingBottom(5f); pTableDataCaixaMontante.addCell(cellDataCaixaMontante); cellDataCaixaMontante = new PdfPCell(); p = new Paragraph(); p.add(new Phrase("Caixa de: ".toUpperCase(), fontRecibo)); p.add(new Phrase("So Tom", fontReciboTxt)); p.setAlignment(Element.ALIGN_LEFT); cellDataCaixaMontante.addElement(p); cellDataCaixaMontante.setPaddingTop(-2f); cellDataCaixaMontante.setPaddingBottom(5f); cellDataCaixaMontante.setBorderColor(BaseColor.BLUE.darker().darker().darker()); pTableDataCaixaMontante.addCell(cellDataCaixaMontante); cellDataCaixaMontante = new PdfPCell(new Phrase(" ", fontRecibo)); cellDataCaixaMontante.setBorder(0); pTableDataCaixaMontante.addCell(cellDataCaixaMontante); cellDataCaixaMontante = new PdfPCell(); p = new Paragraph(); p.add(new Phrase("Montante: ".toUpperCase(), fontRecibo)); Double montade = Moeda.arrendodamento(toString(map.get(VALORAMORTIZADO))); // SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:"); Object dRegistro = map.get(DATAREGAPOLICE); montade *= valorCompra(map.get(SIGLAMOEDA) + "", dRegistro); p.add(new Phrase(converterMoeda(montade, "STD") + "", fontReciboTxt)); p.setAlignment(Element.ALIGN_LEFT); cellDataCaixaMontante.addElement(p); cellDataCaixaMontante.setPaddingTop(-2f); cellDataCaixaMontante.setPaddingBottom(5f); cellDataCaixaMontante.setBorderColor(BaseColor.BLUE.darker().darker().darker()); pTableDataCaixaMontante.addCell(cellDataCaixaMontante); PdfPCell cellDataCaixaMontantePrincipal = new PdfPCell(pTableDataCaixaMontante); cellDataCaixaMontantePrincipal.setBorder(PdfPCell.NO_BORDER); pTablePrincipal.addCell(cellDataCaixaMontantePrincipal); PdfPTable pTableConteudo = new PdfPTable(new float[] { 40, 60 }); pTableConteudo.setWidthPercentage(100f); PdfPCell cellConteudo = new PdfPCell(); cellConteudo.setBorder(0); Paragraph pConteudo = new Paragraph(); pConteudo.add(new Phrase("N Assegurado: ".toUpperCase(), fontConteudo)); pConteudo.add(new Phrase(map.get(NUMREGISTRO) + "\n", fontConteudoTxt)); /** * For alter */ pConteudo.add(new Phrase("Prmio Liquido: ".toUpperCase(), fontConteudo)); pConteudo.add(new Phrase(converterMoeda(map.get(TOTALBRUTO), map.get(SIGLAMOEDA) + "") + "\n", fontConteudoTxt)); pConteudo.add(new Phrase("Impostos: ".toUpperCase(), fontConteudo)); pConteudo.add(new Phrase(converterMoeda(impostosCalculo(map.get(TOTAl), map.get(IMPOSTOCONSUMO)), map.get(SIGLAMOEDA) + "") + "\n", fontConteudoTxt)); pConteudo.add(new Phrase("Impostos Selo: ".toUpperCase(), fontConteudo)); pConteudo.add(new Phrase( converterMoeda(impostosCalculo(map.get(TOTAl), map.get(IMPOSTOSELO)), map.get(SIGLAMOEDA) + "") + "\n", fontConteudoTxt)); pConteudo.add(new Phrase("FGA: ", fontConteudo)); pConteudo.add(new Phrase( converterMoeda(impostosCalculo(map.get(TOTAl), map.get(MOTORFOUND)), map.get(SIGLAMOEDA) + "") + "\n", fontConteudoTxt)); pConteudo.add(new Phrase("Total: ".toUpperCase(), fontConteudo)); pConteudo.add( new Phrase(converterMoeda(map.get(TOTAl), map.get(SIGLAMOEDA) + "") + "\n", fontConteudoTxt)); pConteudo.add(new Phrase("Efeito: ".toUpperCase(), fontConteudo)); pConteudo.add(new Phrase(converterData(map.get(EFEITO), 1) + "\n", fontConteudoTxt)); pConteudo.add(new Phrase("Vencimento: ".toUpperCase(), fontConteudo)); pConteudo.add(new Phrase(converterData(map.get(VENCIMENTO), 1) + "\n", fontConteudoTxt)); cellConteudo.addElement(pConteudo); pTableConteudo.addCell(cellConteudo); cellConteudo = new PdfPCell(); cellConteudo.setBorder(0); pConteudo = new Paragraph(); pConteudo.add(new Phrase("Recebido do Sr: ".toUpperCase(), fontConteudo)); pConteudo.add(new Phrase(map.get(CLIENTE) + "\n", fontConteudoTxt)); PdfPTable pTableNomeCod = new PdfPTable(new float[] { 70, 30 }); pTableNomeCod.setWidthPercentage(100); Paragraph pNomeCod = new Paragraph(); pNomeCod.add(new Phrase("Nome do Assegurado/Pagador: ".toUpperCase(), fontConteudo)); pNomeCod.add(new Phrase(map.get(CLIENTE) + "", fontConteudoTxt)); PdfPCell cellNomeCod = new PdfPCell(); cellNomeCod.addElement(pNomeCod); cellNomeCod.setBorder(0); cellNomeCod.setPaddingTop(-2f); cellNomeCod.setPaddingBottom(2f); pTableNomeCod.addCell(cellNomeCod); cellNomeCod = new PdfPCell(); pNomeCod = new Paragraph(); pNomeCod.add(new Phrase("Codigo: ".toUpperCase(), fontConteudo)); pNomeCod.add(new Phrase(" ", fontConteudoTxt)); cellNomeCod.addElement(pNomeCod); cellNomeCod.setBorder(0); cellNomeCod.setPaddingTop(-2f); cellNomeCod.setPaddingBottom(2f); pTableNomeCod.addCell(cellNomeCod); pNomeCod = new Paragraph(); pNomeCod.add(new Phrase("Nome do Intermedirio: ".toUpperCase(), fontConteudo)); pNomeCod.add(new Phrase(" ", fontConteudoTxt)); cellNomeCod = new PdfPCell(); cellNomeCod.addElement(pNomeCod); cellNomeCod.setBorder(0); cellNomeCod.setPaddingTop(-2f); cellNomeCod.setPaddingBottom(2f); pTableNomeCod.addCell(cellNomeCod); cellNomeCod = new PdfPCell(); pNomeCod = new Paragraph(); pNomeCod.add(new Phrase("Codigo: ".toUpperCase(), fontConteudo)); pNomeCod.add(new Phrase(" ", fontConteudoTxt)); cellNomeCod.addElement(pNomeCod); cellNomeCod.setBorder(0); cellNomeCod.setPaddingTop(-2f); cellNomeCod.setPaddingBottom(2f); pTableNomeCod.addCell(cellNomeCod); pConteudo.add(pTableNomeCod); JTextPane jtp = new JTextPane(); Double valor = Moeda.arrendodamento((map.get(VALORPRESTACAO) + "")); valor *= valorCompra(map.get(SIGLAMOEDA) + "", dRegistro); Moeda.EscreverEstenso(valor, jtp, "Dobras"); pConteudo.add(new Phrase("A soma (por extenso) ".toUpperCase(), fontConteudo)); pConteudo.add(new Phrase(jtp.getText().trim() + "\n", fontConteudoTxt)); PdfPTable pTableApoliceDatasP = new PdfPTable(new float[] { 20, 80 }); pTableApoliceDatasP.setWidthPercentage(100); PdfPTable pTableApoliceDatas = new PdfPTable(new float[] { 60, 40 }); pTableApoliceDatas.setWidthPercentage(100); for (int i = 0; i < 1; i++) { PdfPCell cellApolice = new PdfPCell(); Paragraph pApolice = new Paragraph(); pApolice.add(new Phrase("N ", fontConteudo)); pApolice.add(new Phrase(map.get(APOLICA) + "", fontConteudoTxt)); cellApolice.addElement(pApolice); cellApolice.setPaddingTop(-2f); cellApolice.setPaddingBottom(2f); cellApolice.setBorder(0); pTableApoliceDatas.addCell(cellApolice); PdfPCell cellDatas = new PdfPCell(); Paragraph pDatas = new Paragraph(); pDatas.add(new Phrase("Data: ".toUpperCase(), fontConteudo)); pDatas.add(new Phrase(converterData(map.get(DATAREGAPOLICE), 2) + "", fontConteudoTxt)); cellDatas.addElement(pDatas); cellDatas.setBorder(0); cellDatas.setPaddingTop(-2f); cellDatas.setPaddingBottom(2f); pTableApoliceDatas.addCell(cellDatas); } PdfPCell cellApoliceP = new PdfPCell(new Phrase("Apolices".toUpperCase(), fontConteudo)); cellApoliceP.setVerticalAlignment(Element.ALIGN_MIDDLE); cellApoliceP.setBorder(0); pTableApoliceDatasP.addCell(cellApoliceP); cellApoliceP = new PdfPCell(pTableApoliceDatas); cellApoliceP.setBorder(0); pTableApoliceDatasP.addCell(cellApoliceP); pConteudo.add(pTableApoliceDatasP); // PdfPTable pTableTipoPagemento = new PdfPTable(new float[] { 70f, 30f }); pTableTipoPagemento.setWidthPercentage(100f); PdfPCell cellTipoPageme = new PdfPCell(); Paragraph pDatas = new Paragraph(); pDatas.add(new Phrase("Pagamento: ".toUpperCase(), fontConteudo)); pDatas.add(new Phrase(map.get(TIPOPAGAMENTO) + " ", fontConteudoTxt)); cellTipoPageme.addElement(pDatas); cellTipoPageme.setBorder(0); cellTipoPageme.setPaddingTop(-2f); cellTipoPageme.setPaddingBottom(2f); // cellTipoPageme.setBorderColor(BaseColor.BLUE.darker().darker().darker()); // cellTipoPageme.setBorderWidthTop((i==0)?0.5f:0f); // cellTipoPageme.setBorderWidthBottom(0.5f); pTableTipoPagemento.addCell(cellTipoPageme); cellTipoPageme = new PdfPCell(); pDatas = new Paragraph(); pDatas.add(new Phrase("N ".toUpperCase(), fontConteudo)); pDatas.add(new Phrase(toString(map.get(DOCUMENTOAMORTIZACAO)) + " ", fontConteudoTxt)); cellTipoPageme.addElement(pDatas); cellTipoPageme.setBorder(0); cellTipoPageme.setPaddingTop(-2f); cellTipoPageme.setPaddingBottom(2f); // cellTipoPageme.setBorderColor(BaseColor.BLUE.darker().darker().darker()); // cellTipoPageme.setBorderWidthTop((i==0)?0.5f:0f); // cellTipoPageme.setBorderWidthBottom(0.5f); pTableTipoPagemento.addCell(cellTipoPageme); pConteudo.add(pTableTipoPagemento); cellConteudo.addElement(pConteudo); pTableConteudo.addCell(cellConteudo); PdfPCell cellConteudoPrincipal = new PdfPCell(new PdfPTable(pTableConteudo)); cellConteudoPrincipal.setBorder(PdfPCell.NO_BORDER); pTablePrincipal.addCell(cellConteudoPrincipal); PdfPTable pTableAssinatura = new PdfPTable(new float[] { 50f, 50f }); pTableAssinatura.setWidthPercentage(100f); Font fontConteudoTxt_acess = FontFactory.getFont(ConfigDoc.Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 5f, Font.ITALIC, BaseColor.BLACK.darker().darker().darker()); Font fontConteudo_acess = FontFactory.getFont(ConfigDoc.Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 5f, Font.NORMAL, BaseColor.BLUE.darker().darker()); PdfPCell cellAcessorio = new PdfPCell(); Paragraph pAcessorio = new Paragraph(); pAcessorio.add(new Phrase("Acessrios: ".toUpperCase(), fontConteudo_acess)); pAcessorio.add(new Phrase( (map.get(ACCESSORIO) == null) ? " " : (map.get(ACCESSORIO) + "").replaceAll("\n", " "), fontConteudoTxt_acess)); cellAcessorio.addElement(pAcessorio); cellAcessorio.setColspan(2); cellAcessorio.setBorder(0); cellAcessorio.setPaddingBottom(4f); cellAcessorio.setPaddingTop(-2f); pTableAssinatura.addCell(cellAcessorio); PdfPCell cellLinhaAssina = new PdfPCell(); Paragraph pAssinatura = new Paragraph(); pAssinatura.add(new Paragraph("_________________________________", fontConteudo)); pAssinatura.add(new Paragraph(" Carimbo e Assinatura", fontConteudo)); pAssinatura.setAlignment(Element.ALIGN_CENTER); cellLinhaAssina.addElement(pAssinatura); cellLinhaAssina.setPaddingBottom(2f); cellLinhaAssina.setBorder(0); cellLinhaAssina.setPaddingTop(25f); pTableAssinatura.addCell(cellLinhaAssina); PdfPCell cellCambio = new PdfPCell(); Paragraph pCombio = new Paragraph(); pCombio.add(new Phrase("Cambio (USD): ".toUpperCase(), fontConteudo)); pCombio.add(new Phrase(converterMoeda(valorCompra("USD", dRegistro), "") + "\n", fontConteudoTxt)); pCombio.add(new Phrase("Cambio (EUR): ".toUpperCase(), fontConteudo)); pCombio.add(new Phrase(converterMoeda(valorCompra("EUR", dRegistro), "") + "\n", fontConteudoTxt)); cellCambio.addElement(pCombio); cellCambio.setBorder(0); cellCambio.setPaddingTop(-2f); cellCambio.setPaddingBottom(2f); pTableAssinatura.addCell(cellCambio); PdfPCell cellpTableAssinaturaPrincipal = new PdfPCell(pTableAssinatura); cellpTableAssinaturaPrincipal.setBorder(PdfPCell.NO_BORDER); pTablePrincipal.addCell(new PdfPCell(cellpTableAssinaturaPrincipal)); // pTableAssinatura.writeSelectedRows(-1, 2, 10, 70, writer.getDirectContent()); // pTableImagem.writeSelectedRows(-1, 2, 52.5f, 402.5f, writer.getDirectContent()); } catch (BadElementException | IOException ex) { Logger.getLogger(ReciboPagamento.class.getName()).log(Level.SEVERE, null, ex); } return pTablePrincipal; }
From source file:Export.SeguroCargaMaritima.java
public String criarDoc(String numApolice, String numCliente, Contrato c, CargaMaritimaBean cm, String user, String arquivo) {/*from www.j a v a 2 s. c om*/ try { SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat sdf1 = new SimpleDateFormat("dd-MM-yyyy hh'.'mm'.'ss"); Font fontCabecalhoN = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 9.5f); Font fontCorpo = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f); Font fontCorpoP = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 7f); Font fontCorpoN = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f); Font fontCorpoNG = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 8.5f); Font fontCorpoNGT = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 10f); Font fontCabecalhoNG = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 16f, Font.UNDERLINE); Font fontUK = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 5.5f, Font.ITALIC); PdfPTable pTableEmpresaPricipal = new PdfPTable(new float[] { 25f, 75f }); PdfPTable pTableEmpresaInforImpres1 = new PdfPTable(1); // PdfPTable pTableEmpresaInforImpres2= new PdfPTable(1); PdfPTable pTableEmpresaInforImpres5 = new PdfPTable(1); PdfPTable pTableNull = new PdfPTable(1); PdfPCell cellNull = new PdfPCell(new Phrase(" ", fontCorpo)); cellNull.setBorder(0); pTableNull.addCell(cellNull); PdfPCell pCellNomeEmpresa = new PdfPCell(new Phrase(Empresa.NOME, fontCabecalhoNG)); pCellNomeEmpresa.setBorder(0); PdfPCell pCellNomeEndereco = new PdfPCell(new Phrase(Empresa.ENDERECO, fontCabecalhoN)); pCellNomeEndereco.setBorder(0); PdfPCell pCellCaixaPostal = new PdfPCell(new Phrase(CAIXAPOSTAL, fontCabecalhoN)); pCellCaixaPostal.setBorder(0); PdfPCell pCellTeleFax = new PdfPCell( new Phrase(Empresa.TELEFAX + " " + ConfigDoc.Empresa.EMAIL, fontCabecalhoN)); pCellTeleFax.setBorder(0); PdfPCell pCellSociedade = new PdfPCell(new Phrase(Empresa.SOCIEDADE, fontCabecalhoN)); pCellSociedade.setBorder(0); PdfPCell pCellPolice = new PdfPCell(new Phrase(Empresa.APOLICE + numApolice, fontCabecalhoN)); pCellPolice.setBorder(0); Image imageEmpresa = Image.getInstance("logo.png"); imageEmpresa.scaleToFit(120f, 85f); pTableEmpresaInforImpres1.addCell(pCellNomeEmpresa); pTableEmpresaInforImpres1.addCell(pCellNomeEndereco); pTableEmpresaInforImpres1.addCell(pCellCaixaPostal); pTableEmpresaInforImpres1.addCell(pCellTeleFax); pTableEmpresaInforImpres1.addCell(pCellSociedade); pTableEmpresaInforImpres1.addCell(pCellPolice); PdfPCell cellTabela3 = new PdfPCell(pTableEmpresaInforImpres1); cellTabela3.setBorder(0); pTableEmpresaInforImpres5.addCell(cellTabela3); PdfPCell cellTabela5 = new PdfPCell(pTableEmpresaInforImpres5); cellTabela5.setBorder(0); PdfPCell cellTabela6 = new PdfPCell(imageEmpresa); cellTabela6.setBorder(0); pTableEmpresaPricipal.addCell(cellTabela6); pTableEmpresaPricipal.addCell(cellTabela5); PdfPTable pTableSeguro = new PdfPTable(1); PdfPTable pTableCliente = new PdfPTable(1); PdfPTable pTableTitulo = new PdfPTable(1); Paragraph pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("Formulario de SEguro Carga Maritma".toUpperCase(), fontCorpoNGT)); pUK.add(new Phrase("\nMarine cargo policy schedule".toUpperCase(), fontUK)); PdfPCell cellTitulo = new PdfPCell(pUK); cellTitulo.setBorder(0); cellTitulo.setHorizontalAlignment(Element.ALIGN_CENTER); pTableTitulo.addCell(cellTitulo); pTableTitulo.addCell(cellNull); pTableTitulo.addCell(cellNull); ClienteI ci = new ClienteI(numCliente); pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("1 - Informaes do Segurado".toUpperCase(), fontCorpoNG)); pUK.add(new Phrase("\n1 - information Insured".toUpperCase(), fontUK)); PdfPCell cellTituloTsbleSegurado = new PdfPCell(pUK); cellTituloTsbleSegurado.setBorder(0); Paragraph pCl = new Paragraph(); pCl.add(new Phrase("-" + ci.getNOMEL_(), fontCorpo)); pCl.add(new Phrase(ci.getNOME_(), fontCorpoN)); pCl.add(new Phrase("\nNAME", fontUK)); PdfPCell cellNome = new PdfPCell(new Phrase(pCl)); cellNome.setBorder(0); pCl = new Paragraph(); pCl.add(new Phrase("-" + ci.getENDERECOL_(), fontCorpo)); pCl.add(new Phrase(ci.getENDERECO_(), fontCorpoN)); pCl.add(new Phrase("Address".toUpperCase(), fontUK)); PdfPCell cellEndereco = new PdfPCell(pCl); cellEndereco.setBorder(0); // pCl = new Paragraph(); // pCl.add(new Phrase(" " +ci.getNUNCLIENTEL_(),fontCorpo)); // pCl.add(new Phrase(ci.getNUNCLIENTE_(),fontCorpoN)); // PdfPCell cellNCliente = new PdfPCell( pCl ); // cellNCliente.setBorder(0); pCl = new Paragraph(); pCl.add(new Phrase("-" + ci.getPROFISSAOL_(), fontCorpo)); pCl.add(new Phrase(ci.getPROFISSAO_(), fontCorpoN)); pCl.add(new Phrase("occupation".toUpperCase(), fontUK)); PdfPCell cellProfissao = new PdfPCell(pCl); cellProfissao.setBorder(0); pCl = new Paragraph(); pCl.add(new Phrase("-" + ci.getLOCALTRABALHOL_(), fontCorpo)); pCl.add(new Phrase(ci.getLOCALTRABALHO_(), fontCorpoN)); pCl.add(new Phrase("\nworkplace".toUpperCase(), fontUK)); PdfPCell cellLocalTrabalho = new PdfPCell(pCl); cellLocalTrabalho.setBorder(0); pTableCliente.addCell(cellTituloTsbleSegurado); pTableCliente.addCell(cellNome); pTableCliente.addCell(cellEndereco); // pTableCliente.addCell(cellNCliente); pTableCliente.addCell(cellProfissao); pTableCliente.addCell(cellLocalTrabalho); pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("3 - Informaes do Seguro".toUpperCase(), fontCorpoNG)); pUK.add(new Phrase("\n3 - Insurance Information".toUpperCase(), fontUK)); PdfPCell cellTiltuloSegro = new PdfPCell(pUK); cellTiltuloSegro.setBorder(0); pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("N Aplice : ".toUpperCase() + numApolice, fontCorpoNG)); pUK.add(new Phrase("\npolicy no".toUpperCase(), fontUK)); PdfPCell cellApolice = new PdfPCell(pUK); cellApolice.setBorder(0); pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("VIAGEM ou Periodo Do Seguro: ".toUpperCase() + ((c.getDataInicio() != null) ? sdf.format(c.getDataInicio()) : "") + " " + ((c.getDataFim() != null) ? sdf.format(c.getDataFim()) : ""))); pUK.add(new Phrase("\nvoyage or period of insurance".toUpperCase(), fontUK)); PdfPCell cellPeriodo = new PdfPCell(pUK); cellPeriodo.setBorder(0); pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("Montante Segurado: ".toUpperCase() + c.getPremioLiquidoMoeda(), fontCorpo)); pUK.add(new Phrase("\namount insured hereunder".toUpperCase(), fontUK)); PdfPCell cellMontanteSegurado = new PdfPCell(pUK); cellMontanteSegurado.setBorder(0); pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("Premio: ".toUpperCase() + c.getPrimeiroPremio(), fontCorpo)); pUK.add(new Phrase("\npremium".toUpperCase(), fontUK)); PdfPCell cellPremio = new PdfPCell(pUK); cellPremio.setBorder(0); pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("Franquia: ".toUpperCase() + c.getFranquia(), fontCorpo)); pUK.add(new Phrase("\nfranchise".toUpperCase(), fontUK)); PdfPCell cellFranquia = new PdfPCell(pUK); cellFranquia.setBorder(0); pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("Condies e Garantia: ".toUpperCase() + numApolice, fontCorpo)); pUK.add(new Phrase("\nconditions & warrantes".toUpperCase(), fontUK)); PdfPCell cellCondicaoEGarantia = new PdfPCell(pUK); cellCondicaoEGarantia.setBorder(0); PdfPCell cellNotas = new PdfPCell(); Paragraph pTituloIntrucaoes = new Paragraph("INTRUDES PARA INSPECO", fontCorpoN); pTituloIntrucaoes.add(new Phrase("\nINSTRUTOIN FOR SERVEY", fontUK)); Paragraph pIntrucaoes = new Paragraph( "No Caso de perda ou dano que possa envolver uma reclamao ao abrigo deste seguro, aviso imediato do dano ser dado Seguradoura em um relatrio de inspeo obtido do inspetor ou por indicado.", fontCorpo); pIntrucaoes.add(new Phrase( "\nIn the envent of loss or damage which may involve a claim this insurance immediate notice of damage should be given to the assurers and survey report obtained from the survey or named herein.", fontUK)); Paragraph pTituloReclamacoes = new Paragraph("RECLAMAES", fontCorpoN); pTituloReclamacoes.add(new Phrase("\nclaims".toUpperCase(), fontUK)); Paragraph pReclamacoes = new Paragraph( "No caso reclamao de qualquer reclamao legal resultante sobre a aplice, fica acordado que as mesma sero resolvidas pela Coporao ou a reclamao estabelecida por agente indicado mediante entrega pela Corporao ou a sujeito s Leis e pratica Inglesas mas na Jurisdio Sontomense.", fontCorpo); pReclamacoes.add(new Phrase( "\nIn case of any lawful claim arising on the policy it is agreed that the same shall be settled by the claims settling agente named herein upon serrender of the orignal Policy duly signed. This insurance shall be subject to English Law and Practice but So Tom Jurisdiction.", fontUK)); cellNotas.addElement(pTituloIntrucaoes); cellNotas.addElement(pIntrucaoes); cellNotas.addElement(cellNull.getPhrase()); cellNotas.addElement(pTituloReclamacoes); cellNotas.addElement(pReclamacoes); cellNotas.setBorder(0); pTableSeguro.addCell(cellTiltuloSegro); pTableSeguro.addCell(cellApolice); pTableSeguro.addCell(cellPeriodo); pTableSeguro.addCell(cellMontanteSegurado); pTableSeguro.addCell(cellPremio); pTableSeguro.addCell(cellFranquia); pTableSeguro.addCell(cellCondicaoEGarantia); pTableSeguro.addCell(cellNull); pTableSeguro.addCell(cellNotas); PdfPTable pTableDadosTitulo = new PdfPTable(1); PdfPCell cellDadosTitulo = new PdfPCell(new Phrase()); cellDadosTitulo.setBorder(0); pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("I2 - nformao do Navio: ".toUpperCase() + c.getFranquia(), fontCorpoNG)); pUK.add(new Phrase("\n2 - Ship Information".toUpperCase(), fontUK)); Paragraph pInfoTitulo = pUK; pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("Navio: ".toUpperCase() + cm.getCargaMaritima().getNomeNavio(), fontCorpo)); pUK.add(new Phrase("\nShip".toUpperCase(), fontUK)); Paragraph pInfoShip = pUK; pUK = new Paragraph(new Phrase("", fontCorpo)); pUK.add(new Phrase("Mercadoria SeGurada: ".toUpperCase() + cm.getCargaMaritima().getDecricaoMecadoria(), fontCorpo)); pUK.add(new Phrase("\nSubject - matter insured".toUpperCase(), fontUK)); Paragraph pInfo1 = pUK; cellDadosTitulo.addElement(pInfoTitulo); cellDadosTitulo.addElement(pInfoShip); cellDadosTitulo.addElement(pInfo1); cellDadosTitulo.addElement(cellNull.getPhrase()); pTableDadosTitulo.addCell(cellDadosTitulo); Document documento = new Document(); documento.setPageSize(PageSize.A4); documento.setMargins(20f, 20f, 35f, 5f); // File ff= new File("Documentos\\"+user+"\\Seguro Carga Maritima\\"); // ff.mkdirs(); // ff =new File(ff.getAbsoluteFile()+"\\"+"Formulario Seguro Carga Maritima "+sdf1.format(new Date())+".pdf"); File ff = new File(arquivo + "/" + user + "/Seguro Carga Maritima/"); ff.mkdirs(); String Ddata = sdf1.format(new Date()); ff = new File(ff.getAbsoluteFile() + "/" + "Formulario Seguro Carga Maritima " + Ddata + ".pdf"); reString = "../Documentos/" + user + "/Seguro Carga Maritima/" + "Formulario Seguro Carga Maritima " + Ddata + ".pdf"; OutputStream outputStraem = new FileOutputStream(ff); PdfWriter writer = PdfWriter.getInstance(documento, outputStraem); if (MarcaDAgua.isSimulation) { MarcaDAgua.SimulacaoVertical v = new MarcaDAgua.SimulacaoVertical(); writer.setPageEvent(v); } if (MarcaDAgua.isCanceled) { MarcaDAgua.AnulacaoVertical v = new MarcaDAgua.AnulacaoVertical(); writer.setPageEvent(v); } documento.open(); documento.add(pTableEmpresaPricipal); documento.add(pTableNull); documento.add(pTableNull); documento.add(pTableTitulo); documento.add(pTableNull); documento.add(pTableCliente); documento.add(pTableNull); documento.add(pTableDadosTitulo); documento.add(pTableNull); documento.add(pTableSeguro); documento.close(); // PrintPdf printPdf = new PrintPdf(ff.getAbsolutePath(), ff.getAbsolutePath(), 0, 595f,842f,"Enviar Para o OneNote 2013",1); // //PrintPdf printPdf = new PrintPdf(ff.getAbsolutePath(), ff.getAbsolutePath(), 0, 595f,842f,"Hewlett-Packard HP LaserJet P2035",1); // // printPdf.print(); } catch (BadElementException | IOException ex) { Logger.getLogger(SeguroAPG.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException ex) { Logger.getLogger(SeguroAPG.class.getName()).log(Level.SEVERE, null, ex); } return reString; }
From source file:Export.SeguroIncendio.java
public String criarDoc(String numApolice, String numCliente, Contrato c, IncendioBean ib, String user, String sigla, String arquivo) { try {/* www . ja v a2 s. c o m*/ SimpleDateFormat sdf = new SimpleDateFormat("dd 'DE' MMMM 'DE' yyyy", new Locale("pt", "BR")); SimpleDateFormat sdfS = new SimpleDateFormat("dd/MM/yyyy", new Locale("pt", "BR")); SimpleDateFormat sdf1 = new SimpleDateFormat("dd-MM-yyyy hh'.'mm'.'ss"); Font fontCabecalhoN = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 9.5f); Font fontCorpo = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 9f); // Font fontTableCo= new Font(Font.FontFamily.HELVETICA,9f , Font.NORMAL); // Font fontTableCa= new Font(Font.FontFamily.HELVETICA,9.5f , Font.BOLD); Font fontCorpoP = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f); Font fontCorpoN = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 9f); // Font fontCorpoNG= FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED ,8.5f ); Font fontCorpoNGT = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 10f); Font fontCabecalhoNG = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 16f, Font.UNDERLINE); Font fontUK = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 5.5f, Font.ITALIC); PdfPTable pTableEmpresaPricipal = new PdfPTable(new float[] { 25f, 75f }); pTableEmpresaPricipal.setWidthPercentage(90f); PdfPTable pTableEmpresaInforImpres1 = new PdfPTable(1); // PdfPTable pTableEmpresaInforImpres2= new PdfPTable(1); PdfPTable pTableEmpresaInforImpres5 = new PdfPTable(1); PdfPTable pTableNull = new PdfPTable(1); PdfPCell cellNull = new PdfPCell(new Phrase(" ", fontCorpo)); cellNull.setBorder(0); pTableNull.addCell(cellNull); PdfPCell pCellNomeEmpresa = new PdfPCell(new Phrase(Empresa.NOME, fontCabecalhoNG)); pCellNomeEmpresa.setBorder(0); PdfPCell pCellNomeEndereco = new PdfPCell(new Phrase(Empresa.ENDERECO, fontCabecalhoN)); pCellNomeEndereco.setBorder(0); PdfPCell pCellCaixaPostal = new PdfPCell(new Phrase(Empresa.CAIXAPOSTAL, fontCabecalhoN)); pCellCaixaPostal.setBorder(0); PdfPCell pCellTeleFax = new PdfPCell( new Phrase(Empresa.TELEFAX + " " + ConfigDoc.Empresa.EMAIL, fontCabecalhoN)); pCellTeleFax.setBorder(0); PdfPCell pCellSociedade = new PdfPCell(new Phrase(Empresa.SOCIEDADE, fontCabecalhoN)); pCellSociedade.setBorder(0); PdfPCell pCellPolice = new PdfPCell(new Phrase(Empresa.APOLICE + numApolice, fontCabecalhoN)); pCellPolice.setBorder(0); Image imageEmpresa = Image.getInstance("logo.png"); imageEmpresa.scaleToFit(120f, 85f); pTableEmpresaInforImpres1.addCell(pCellNomeEmpresa); pTableEmpresaInforImpres1.addCell(pCellNomeEndereco); pTableEmpresaInforImpres1.addCell(pCellCaixaPostal); pTableEmpresaInforImpres1.addCell(pCellTeleFax); pTableEmpresaInforImpres1.addCell(pCellSociedade); pTableEmpresaInforImpres1.addCell(pCellPolice); PdfPCell cellTabela3 = new PdfPCell(pTableEmpresaInforImpres1); cellTabela3.setBorder(0); pTableEmpresaInforImpres5.addCell(cellTabela3); PdfPCell cellTabela5 = new PdfPCell(pTableEmpresaInforImpres5); cellTabela5.setBorder(0); PdfPCell cellTabela6 = new PdfPCell(imageEmpresa); cellTabela6.setBorder(0); pTableEmpresaPricipal.addCell(cellTabela6); pTableEmpresaPricipal.addCell(cellTabela5); // PdfPTable pTableSeguro =new PdfPTable(1); PdfPTable pTableCliente = new PdfPTable(1); pTableCliente.setWidthPercentage(90f); Phrase phraseUK; PdfPTable pTableTitulo = new PdfPTable(1); Paragraph pTitulo = new Paragraph("", fontCorpo); phraseUK = new Phrase("Formulario de SEguro Incndio".toUpperCase(), fontCorpoNGT); pTitulo.add(phraseUK); phraseUK = new Phrase("\nfire insurance schedule".toUpperCase(), fontUK); pTitulo.add(phraseUK); PdfPCell cellTitulo = new PdfPCell(pTitulo); cellTitulo.setBorder(0); cellTitulo.setHorizontalAlignment(Element.ALIGN_CENTER); pTableTitulo.addCell(cellTitulo); ClienteI ci = new ClienteI(numCliente); Paragraph p = new Paragraph("", fontCorpo); phraseUK = new Phrase("1 - Informaes Cliente".toUpperCase(), fontCorpoNGT); p.add(phraseUK); phraseUK = new Phrase("\n(1 - Customer information)".toUpperCase(), fontUK); p.add(phraseUK); PdfPCell cellTituloTsbleSegurado = new PdfPCell(p); cellTituloTsbleSegurado.setBorder(0); Paragraph pCl = new Paragraph(); pCl.add(new Phrase(ci.getNOMEL_(), fontCorpo)); pCl.add(new Phrase(ci.getNOME_(), fontCorpoN)); pCl.add(new Phrase("\n(THE INSURED)", fontUK)); PdfPCell cellNome = new PdfPCell(new Phrase(pCl)); cellNome.setBorder(0); pCl = new Paragraph(); pCl.add(new Phrase(ci.getENDERECOL_(), fontCorpo)); pCl.add(new Phrase(ci.getENDERECO_(), fontCorpoN)); pCl.add(new Phrase("\nAddress".toUpperCase(), fontUK)); PdfPCell cellEndereco = new PdfPCell(pCl); cellEndereco.setBorder(0); pCl = new Paragraph(); pCl.add(new Phrase("A SEGURADORA: ", fontCorpo)); pCl.add(new Phrase("NICON SEGUROS S.A", fontCorpoN)); pCl.add(new Phrase("\n(THE COMPANY)", fontUK)); PdfPCell cellNCliente = new PdfPCell(pCl); cellNCliente.setBorder(0); pCl = new Paragraph(); pCl.add(new Phrase(ci.getPROFISSAOL_(), fontCorpo)); pCl.add(new Phrase(ci.getPROFISSAO_(), fontCorpoN)); pCl.add(new Phrase("\n(occupation)".toUpperCase(), fontUK)); PdfPCell cellProfissao = new PdfPCell(pCl); cellProfissao.setBorder(0); pCl = new Paragraph(); pCl.add(new Phrase(ci.getLOCALTRABALHOL_(), fontCorpo)); pCl.add(new Phrase(ci.getLOCALTRABALHO_(), fontCorpoN)); pCl.add(new Phrase("\n(workplace)", fontUK)); PdfPCell cellLocalTrabalho = new PdfPCell(pCl); cellLocalTrabalho.setBorder(0); cellTituloTsbleSegurado.setPaddingBottom(8f); pTableCliente.addCell(cellTituloTsbleSegurado); cellNome.setPaddingBottom(8f); pTableCliente.addCell(cellNome); cellEndereco.setPaddingBottom(8f); pTableCliente.addCell(cellEndereco); cellProfissao.setPaddingBottom(8f); pTableCliente.addCell(cellProfissao); cellLocalTrabalho.setPaddingBottom(8f); pTableCliente.addCell(cellLocalTrabalho); cellNCliente.setPaddingBottom(8f); pTableCliente.addCell(cellNCliente); // CellData.setPaddingBottom(8f); pTableCliente.addCell(cellNull); // PdfPTable pTableDadosTitulo= new PdfPTable(1); // PdfPCell cellDadosTitulo= new PdfPCell(new Phrase()); // cellDadosTitulo.setBorder(0); Paragraph pInfoTitulo = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("2 - Informaes do seguro".toUpperCase(), fontCorpoN); pInfoTitulo.add(phraseUK); phraseUK = new Phrase("\n(2 - insurance information)".toUpperCase(), fontUK); pInfoTitulo.add(phraseUK); Paragraph pInfoPro1 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("Valor Da propriedade segurada: ".toUpperCase(), fontCorpo); pInfoPro1.add(phraseUK); phraseUK = new Phrase(c.getPremioLiquidoMoeda().toUpperCase(), fontCorpo); pInfoPro1.add(phraseUK); phraseUK = new Phrase("\n(insured property value)".toUpperCase(), fontUK); pInfoPro1.add(phraseUK); Paragraph pInfoPro = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("Endereo da propriedade segurada: ".toUpperCase(), fontCorpo); pInfoPro.add(phraseUK); phraseUK = new Phrase(ib.getIncendio().getEndereco(), fontCorpo); pInfoPro.add(phraseUK); phraseUK = new Phrase("\n(property address insured)".toUpperCase(), fontUK); pInfoPro.add(phraseUK); Paragraph pInfo1 = new Paragraph("".toUpperCase(), fontCorpoN); phraseUK = new Phrase("Riscos Bascos:".toUpperCase(), fontCorpoN); pInfo1.add(phraseUK); phraseUK = new Phrase("\n(basic risks)".toUpperCase(), fontUK); pInfo1.add(phraseUK); Paragraph pInfo2 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-Edifcio".toUpperCase(), fontCorpo); pInfo2.add(phraseUK); phraseUK = new Phrase("\n(Building)".toUpperCase(), fontUK); pInfo2.add(phraseUK); Paragraph pInfo3 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-Maquinaria: ".toUpperCase() + testeUsado(""), fontCorpo); pInfo3.add(phraseUK); phraseUK = new Phrase("\n(Machinery)".toUpperCase(), fontUK); pInfo3.add(phraseUK); Paragraph pInfo4 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-Contedos".toUpperCase(), fontCorpo); pInfo4.add(phraseUK); phraseUK = new Phrase("\n(contents)".toUpperCase(), fontUK); pInfo4.add(phraseUK); Paragraph pInfo5 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-Reserva: ".toUpperCase() + testeUsado(""), fontCorpo); pInfo5.add(phraseUK); phraseUK = new Phrase("\n(STOKS) NA".toUpperCase(), fontUK); pInfo5.add(phraseUK); Paragraph pInfo6 = new Paragraph("", fontCorpo); phraseUK = new Phrase("-Risco Para com Terceiro/Vizinhos: ".toUpperCase() + testeUsado(""), fontCorpo); pInfo6.add(phraseUK); phraseUK = new Phrase("\n(third party/neighbour's risk )".toUpperCase(), fontUK); pInfo6.add(phraseUK); Paragraph pInfo7 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-Renda: ".toUpperCase() + testeUsado(""), fontCorpo); pInfo7.add(phraseUK); phraseUK = new Phrase("\n(RENT)".toUpperCase(), fontUK); pInfo7.add(phraseUK); Paragraph pInfo8 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-Despesas com perito: ".toUpperCase() + testeUsado(""), fontCorpo); pInfo8.add(phraseUK); phraseUK = new Phrase("\n(expert fees)".toUpperCase(), fontUK); pInfo8.add(phraseUK); Paragraph pInfo9 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-risco especiais: ".toUpperCase() + testeUsado(""), fontCorpo); pInfo9.add(phraseUK); phraseUK = new Phrase("\n(Special risk)".toUpperCase(), fontUK); pInfo9.add(phraseUK); Paragraph pInfo10 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-impactos: ".toUpperCase() + testeUsado(""), fontCorpo); pInfo10.add(phraseUK); phraseUK = new Phrase("\n(impacts)".toUpperCase(), fontUK); pInfo10.add(phraseUK); Paragraph pInfo11 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-motim & greve".toUpperCase(), fontCorpo); pInfo11.add(phraseUK); phraseUK = new Phrase("\n(Riot & Strike)".toUpperCase(), fontUK); pInfo11.add(phraseUK); Paragraph pInfo12 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase( "-incndio florestal: ".toUpperCase() + testeUsado(ib.getIncendioRisco().getIncendioFId()), fontCorpo); pInfo12.add(phraseUK); phraseUK = new Phrase("\n(bush fire)".toUpperCase(), fontUK); pInfo12.add(phraseUK); Paragraph pInfo12_1 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-exploso de tubos".toUpperCase(), fontCorpo); pInfo12_1.add(phraseUK); phraseUK = new Phrase("\n(Burst pipes)".toUpperCase(), fontUK); pInfo12_1.add(phraseUK); Paragraph pInfo12_2 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase( "-danos maliciosos: ".toUpperCase() + testeUsado(ib.getIncendioRisco().getDanoId()), fontCorpo); pInfo12_2.add(phraseUK); phraseUK = new Phrase("\n(malicious damage)".toUpperCase(), fontUK); pInfo12_2.add(phraseUK); Paragraph pInfo13 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-Exploso: ".toUpperCase() + testeUsado(ib.getIncendioRisco().getExplosaoId()), fontCorpo); pInfo13.add(phraseUK); phraseUK = new Phrase("\n(Explosion)".toUpperCase(), fontUK); pInfo13.add(phraseUK); Paragraph pInfo14 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("-terramoto: ".toUpperCase() + testeUsado(ib.getIncendioRisco().getTerramotoId()), fontCorpo); pInfo14.add(phraseUK); phraseUK = new Phrase("\n(earthquake)".toUpperCase(), fontUK); pInfo14.add(phraseUK); Paragraph pInfo14_1 = new Paragraph("", fontCorpo); phraseUK = new Phrase( "-Queda de aeronave: ".toUpperCase() + testeUsado(ib.getIncendioRisco().getRiscoAviaoId()), fontCorpo); pInfo14_1.add(phraseUK); phraseUK = new Phrase("\n(plane crash)".toUpperCase(), fontUK); pInfo14_1.add(phraseUK); Paragraph pInfo15 = new Paragraph("", fontCorpo); phraseUK = new Phrase("-trovoada, tempestade e inundao: ".toUpperCase() + testeUsado(ib.getIncendioRisco().getTempestadeId()), fontCorpo); pInfo15.add(phraseUK); phraseUK = new Phrase("\n(storm, tempest and flood)".toUpperCase(), fontUK); pInfo15.add(phraseUK); PdfPCell CellData = new PdfPCell(pInfoTitulo); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); CellData = new PdfPCell(pInfoPro); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); CellData = new PdfPCell(pInfoPro1); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfoPro1); CellData = new PdfPCell(pInfo1); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo1); CellData = new PdfPCell(pInfo2); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo2); CellData = new PdfPCell(pInfo3); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo3); CellData = new PdfPCell(pInfo4); CellData.setBorder(0); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo4); CellData = new PdfPCell(pInfo5); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo5); CellData = new PdfPCell(pInfo6); CellData.setBorder(0); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo6); CellData = new PdfPCell(pInfo7); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo7); CellData = new PdfPCell(pInfo8); CellData.setBorder(0); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo8); CellData = new PdfPCell(pInfo9); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo9); CellData = new PdfPCell(pInfo10); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo10); CellData = new PdfPCell(pInfo11); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo11); CellData = new PdfPCell(pInfo12); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo12); CellData = new PdfPCell(pInfo12_1); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo12_1); CellData = new PdfPCell(pInfo12_2); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo12_2); CellData = new PdfPCell(pInfo13); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo13); CellData = new PdfPCell(pInfo14); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo14); CellData = new PdfPCell(pInfo14_1); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellDadosTitulo.addElement(pInfo14_1); CellData = new PdfPCell(pInfo15); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); pTableCliente.addCell(cellNull); // cellDadosTitulo.addElement(pInfo15); // PdfPCell cellSeguro= new PdfPCell(new Phrase()); // cellSeguro.setBorder(0); Paragraph pSegTitulo = new Paragraph("".toUpperCase(), fontCorpoN); phraseUK = new Phrase("3 - Informaes Montante e periodo de Segurado".toUpperCase(), fontCorpoN); pSegTitulo.add(phraseUK); phraseUK = new Phrase("\n(3 - Amount information and period of Insured)".toUpperCase(), fontUK); pSegTitulo.add(phraseUK); Paragraph pSeg1 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("perodo Seguro de: ".toUpperCase(), fontCorpo); pSeg1.add(phraseUK); phraseUK = new Phrase(sdfS.format(c.getDataInicio()) + " at ".toUpperCase() + sdfS.format(c.getDataFim()) + " (16H00 HORAS DA DATA DE EXPIRAo)".toUpperCase(), fontCorpoN); pSeg1.add(phraseUK); phraseUK = new Phrase( "\n(preiod of insurance) (from) (to) (4 o'clock in the afternoon of the expiring date)" .toUpperCase(), fontUK); pSeg1.add(phraseUK); Paragraph pSeg2 = new Paragraph("", fontCorpo); phraseUK = new Phrase("Data Da renovao: ".toUpperCase(), fontCorpo); pSeg2.add(phraseUK); phraseUK = new Phrase( ((c.getDataRenovacao() == null) ? "" : sdfS.format(c.getDataRenovacao())).toUpperCase(), fontCorpo); pSeg2.add(phraseUK); phraseUK = new Phrase("\n(renewal date)".toUpperCase(), fontUK); pSeg2.add(phraseUK); // Paragraph pSeg3= new Paragraph(" Valo".toUpperCase(), fontCorpo); // Paragraph pSeg4= new Paragraph(" Data de Renovao: ".toUpperCase()+, fontCorpo); Paragraph pSeg5 = new Paragraph("", fontCorpo); phraseUK = new Phrase("valor do primeiro prMio: ".toUpperCase(), fontCorpo); pSeg5.add(phraseUK); phraseUK = new Phrase(c.getPrimeiroPremio(), fontCorpo); pSeg5.add(phraseUK); phraseUK = new Phrase("\n(first premiun)".toUpperCase(), fontUK); pSeg5.add(phraseUK); Paragraph pSeg6 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("Valor do Prmio Anual: ".toUpperCase(), fontCorpo); pSeg6.add(phraseUK); phraseUK = new Phrase(c.getPremioAnual(), fontCorpo); pSeg6.add(phraseUK); phraseUK = new Phrase("\n(annuals premium)".toUpperCase(), fontUK); pSeg6.add(phraseUK); Paragraph pSeg7 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("valor do prmio bruto: ".toUpperCase(), fontCorpo); pSeg7.add(phraseUK); phraseUK = new Phrase(c.getPremioBrutoMoeda(), fontCorpo); pSeg7.add(phraseUK); phraseUK = new Phrase("\n(gross premium)".toUpperCase(), fontUK); pSeg7.add(phraseUK); Paragraph pSeg8 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("menos (SE aplicvel) No".toUpperCase(), fontCorpo); pInfo14_1.add(phraseUK); phraseUK = new Phrase("\nLESS (if applicable)".toUpperCase(), fontUK); pInfo14_1.add(phraseUK); Paragraph pSeg9 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("a adicionar: impst. @ 5% + IMpost. sobre selo @ 0.6% = ".toUpperCase(), fontCorpo); pSeg9.add(phraseUK); phraseUK = new Phrase(" ", fontCorpo); pSeg9.add(phraseUK); phraseUK = new Phrase("\n(add)".toUpperCase(), fontUK); pSeg9.add(phraseUK); Paragraph pSeg10 = new Paragraph("".toUpperCase(), fontCorpo); phraseUK = new Phrase("Valor do prmio liquido a pagar: ".toUpperCase(), fontCorpo); pSeg10.add(phraseUK); phraseUK = new Phrase(c.getPremioLiquidoMoeda(), fontCorpo); pSeg10.add(phraseUK); phraseUK = new Phrase("\n(net premium payable)".toUpperCase(), fontUK); pSeg10.add(phraseUK); // Paragraph pSeg11= new Paragraph(" outras condies/memorado por favor, volte a pgina".toUpperCase(), fontCorpo); Paragraph pSeg13 = new Paragraph(" ".toUpperCase(), fontCorpo); Paragraph pSegData = new Paragraph("", fontCorpo); phraseUK = new Phrase("Data Em: ".toUpperCase(), fontCorpo); pSegData.add(phraseUK); phraseUK = new Phrase(sdf.format(new Date()).toUpperCase(), fontCorpo); pSegData.add(phraseUK); phraseUK = new Phrase("\n(DATE IN)".toUpperCase(), fontUK); pSegData.add(phraseUK); CellData = new PdfPCell(pSegTitulo); CellData.setBorder(0); pTableCliente.addCell(CellData); // cellSeguro.addElement(pSegTitulo); CellData = new PdfPCell(pSeg1); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellSeguro.addElement(pSeg1); CellData = new PdfPCell(pSeg2); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellSeguro.addElement(pSeg2); // cellSeguro.addElement(pSeg3); // cellSeguro.addElement(pSeg4); CellData = new PdfPCell(pSeg5); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellSeguro.addElement(pSeg5); CellData = new PdfPCell(pSeg6); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellSeguro.addElement(pSeg6); CellData = new PdfPCell(pSeg7); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellSeguro.addElement(pSeg7); CellData = new PdfPCell(pSeg8); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellSeguro.addElement(pSeg8); CellData = new PdfPCell(pSeg9); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellSeguro.addElement(pSeg9); CellData = new PdfPCell(pSeg10); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellSeguro.addElement(pSeg10); // cellSeguro.addElement(pSeg11); CellData = new PdfPCell(pSeg13); CellData.setBorder(0); CellData.setPaddingBottom(8f); pTableCliente.addCell(CellData); // cellSeguro.addElement(pSeg13); CellData = new PdfPCell(pSegData); CellData.setBorder(0); pTableCliente.addCell(CellData); // cellSeguro.addElement(pSegData); // pTableCliente.addCell(cellSeguro); PdfPTable pTableAssinaturaTitulo = new PdfPTable(1); PdfPTable pTableAssinatura = new PdfPTable(new float[] { 50f, 50f }); Paragraph p1 = new Paragraph(new Phrase("Assinaturas".toUpperCase(), fontCorpoN)); p1.add(new Phrase("\nsignature".toUpperCase(), fontUK)); PdfPCell cellAssinatora = new PdfPCell(p1); cellAssinatora.setBorder(0); cellAssinatora.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell celllinha1 = new PdfPCell( new Phrase("________________________________".toUpperCase(), fontCorpo)); celllinha1.setBorder(0); celllinha1.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell celllinha2 = new PdfPCell( new Phrase("________________________________".toUpperCase(), fontCorpo)); celllinha2.setBorder(0); celllinha2.setHorizontalAlignment(Element.ALIGN_CENTER); p1 = new Paragraph(new Phrase("para nicon Seguro sa stp".toUpperCase(), fontCorpoP)); p1.add(new Phrase("\nFor nicon seguros sa stp".toUpperCase(), fontUK)); PdfPCell celllinha11 = new PdfPCell(p1); celllinha11.setBorder(0); celllinha11.setHorizontalAlignment(Element.ALIGN_CENTER); p1 = new Paragraph(new Phrase("o segurado".toUpperCase(), fontCorpoP)); p1.add(new Phrase("\nthe insured".toUpperCase(), fontUK)); PdfPCell celllinha21 = new PdfPCell(p1); celllinha21.setBorder(0); celllinha21.setHorizontalAlignment(Element.ALIGN_CENTER); pTableAssinaturaTitulo.addCell(cellAssinatora); pTableAssinatura.addCell(celllinha1); pTableAssinatura.addCell(celllinha2); pTableAssinatura.addCell(celllinha11); pTableAssinatura.addCell(celllinha21); Document documento = new Document(); documento.setPageSize(PageSize.A4); documento.setMargins(20f, 20f, 35f, 60f); File ff = new File(arquivo + "/" + user + "/Seguro Incendio/"); ff.mkdirs(); String Ddata = sdf1.format(new Date()); ff = new File(ff.getAbsoluteFile() + "/" + "Formulario Seguro Incendio " + Ddata + ".pdf"); reString = "../Documentos/" + user + "/Seguro Incendio/" + "Formulario Seguro Incendio " + Ddata + ".pdf"; OutputStream outputStraem = new FileOutputStream(ff); PdfWriter writer = PdfWriter.getInstance(documento, outputStraem); if (MarcaDAgua.isSimulation) { MarcaDAgua.SimulacaoVertical v = new MarcaDAgua.SimulacaoVertical(); writer.setPageEvent(v); } if (MarcaDAgua.isCanceled) { MarcaDAgua.AnulacaoVertical v = new MarcaDAgua.AnulacaoVertical(); writer.setPageEvent(v); } documento.open(); documento.add(pTableEmpresaPricipal); documento.add(pTableNull); documento.add(pTableTitulo); documento.add(pTableNull); documento.add(pTableCliente); // documento.add(pTableNull); // documento.add(pTableDadosTitulo); // documento.add(pTableNull); // documento.add(pTableSeguro); documento.add(pTableNull); documento.add(pTableAssinaturaTitulo); documento.add(pTableNull); documento.add(pTableNull); documento.add(pTableAssinatura); documento.close(); // PrintPdf printPdf = new PrintPdf(ff.getAbsolutePath(), ff.getAbsolutePath(), 0, 595f,842f,"Enviar Para o OneNote 2013",1); // //PrintPdf printPdf = new PrintPdf(ff.getAbsolutePath(), ff.getAbsolutePath(), 0, 595f,842f,"Hewlett-Packard HP LaserJet P2035",1); // // printPdf.print(); } catch (BadElementException | IOException ex) { Logger.getLogger(SeguroAPG.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException ex) { Logger.getLogger(SeguroAPG.class.getName()).log(Level.SEVERE, null, ex); } return reString; }
From source file:Export.SeguroViatura.java
public String criarDoc(String numApolice, String numCliente, Contrato c, VeiculoBean vb, String user, String arquivo) {/*from w w w . j a v a 2s .co m*/ try { SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat sdf1 = new SimpleDateFormat("dd-MM-yyyy hh'.'mm'.'ss"); Font fontCabecalhoN = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 10.5f); Font fontCorpo = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 9f); Font fontCorpoTabT = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 6.5f); Font fontCorpoTab = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 6.5f); Font fontCorpoP = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f); Font fontCorpoN = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 9f); Font fontCorpoNG = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 9.5f); Font fontCorpoNGT = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 10f); Font fontCabecalhoNG = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 16f, Font.UNDERLINE); Font fontUK = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 6f, Font.ITALIC); Font fontUKb = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 6f, Font.ITALIC); PdfPTable pTableEmpresaPricipal = new PdfPTable(new float[] { 25f, 75f }); pTableEmpresaPricipal.setWidthPercentage(88f); PdfPTable pTableEmpresaInforImpres1 = new PdfPTable(1); // PdfPTable pTableEmpresaInforImpres2 = new PdfPTable(1); PdfPTable pTableEmpresaInforImpres5 = new PdfPTable(1); PdfPTable pTableNull = new PdfPTable(1); PdfPCell cellNull = new PdfPCell(new Phrase(" ", fontCorpo)); cellNull.setBorder(0); pTableNull.addCell(cellNull); PdfPCell pCellNomeEmpresa = new PdfPCell(new Phrase(Empresa.NOME, fontCabecalhoNG)); pCellNomeEmpresa.setBorder(0); PdfPCell pCellNomeEndereco = new PdfPCell(new Phrase(Empresa.ENDERECO, fontCabecalhoN)); pCellNomeEndereco.setBorder(0); PdfPCell pCellCaixaPostal = new PdfPCell(new Phrase(Empresa.CAIXAPOSTAL, fontCabecalhoN)); pCellCaixaPostal.setBorder(0); PdfPCell pCellTeleFax = new PdfPCell( new Phrase(Empresa.TELEFAX + " " + ConfigDoc.Empresa.EMAIL, fontCabecalhoN)); pCellTeleFax.setBorder(0); PdfPCell pCellSociedade = new PdfPCell(new Phrase(Empresa.SOCIEDADE, fontCabecalhoN)); pCellSociedade.setBorder(0); PdfPCell pCellPolice = new PdfPCell(new Phrase(Empresa.APOLICE + numApolice, fontCabecalhoN)); pCellPolice.setBorder(0); Image imageEmpresa = Image.getInstance("logo.png"); imageEmpresa.scaleToFit(190f, 100f); pTableEmpresaInforImpres1.addCell(pCellNomeEmpresa); pTableEmpresaInforImpres1.addCell(pCellNomeEndereco); pTableEmpresaInforImpres1.addCell(pCellCaixaPostal); pTableEmpresaInforImpres1.addCell(pCellTeleFax); pTableEmpresaInforImpres1.addCell(pCellSociedade); pTableEmpresaInforImpres1.addCell(pCellPolice); PdfPCell cellTabela3 = new PdfPCell(pTableEmpresaInforImpres1); cellTabela3.setBorder(0); pTableEmpresaInforImpres5.addCell(cellTabela3); PdfPCell cellTabela5 = new PdfPCell(pTableEmpresaInforImpres5); cellTabela5.setBorder(0); PdfPCell cellTabela6 = new PdfPCell(imageEmpresa); cellTabela6.setBorder(0); pTableEmpresaPricipal.addCell(cellTabela6); pTableEmpresaPricipal.addCell(cellTabela5); PdfPTable pTableSeguro = new PdfPTable(1); pTableSeguro.setWidthPercentage(88f); PdfPTable pTableCliente = new PdfPTable(1); pTableCliente.setWidthPercentage(88f); PdfPTable pTableTitulo = new PdfPTable(1); pTableTitulo.setWidthPercentage(88f); Paragraph paTitulo = new Paragraph(); Paragraph pTitulo = new Paragraph("resumo de aplice para Automvel".toUpperCase(), fontCorpoNGT); Paragraph pTituloUk = new Paragraph("\nthe motor policy sumay".toUpperCase(), fontUKb); paTitulo.add(pTitulo); paTitulo.add(pTituloUk); PdfPCell cellTitulo = new PdfPCell(paTitulo); cellTitulo.setBorder(0); cellTitulo.setHorizontalAlignment(Element.ALIGN_CENTER); pTableTitulo.addCell(cellTitulo); ClienteI ci = new ClienteI(numCliente); Paragraph para = new Paragraph(); Paragraph phrase = new Paragraph("1 - Informaes Do Cliente".toUpperCase(), fontCorpoNG); Paragraph paraUK = new Paragraph("\n1 - Customer information".toUpperCase(), fontUKb); para.add(phrase); para.add(paraUK); PdfPCell cellTituloTsbleSegurado = new PdfPCell(para); cellTituloTsbleSegurado.setBorder(0); Paragraph pCl = new Paragraph(); pCl.add(new Phrase(ci.getNOMEL_(), fontCorpo)); pCl.add(new Phrase(ci.getNOME_(), fontCorpoN)); pCl.add(new Phrase("\nNAME:", fontUK)); PdfPCell cellNome = new PdfPCell(new Phrase(pCl)); cellNome.setBorder(0); pCl = new Paragraph(); pCl.add(new Phrase(ci.getENDERECOL_(), fontCorpo)); pCl.add(new Phrase(ci.getENDERECO_(), fontCorpoN)); pCl.add(new Phrase("\nADDRESS:", fontUK)); PdfPCell cellEndereco = new PdfPCell(pCl); cellEndereco.setBorder(0); /** pCl = new Paragraph(); pCl.add(new Phrase(" " +ci.getNUNCLIENTEL_(),fontCorpo)); pCl.add(new Phrase(ci.getNUNCLIENTE_(),fontCorpoN)); PdfPCell cellNCliente = new PdfPCell( pCl ); cellNCliente.setBorder(0); * */ pCl = new Paragraph(); pCl.add(new Phrase(ci.getPROFISSAOL_(), fontCorpo)); pCl.add(new Phrase(ci.getPROFISSAO_(), fontCorpoN)); pCl.add(new Phrase("\nPROFISSION/OCCUPATION/ACTIVITY AREA:", fontUK)); PdfPCell cellProfissao = new PdfPCell(pCl); cellProfissao.setBorder(0); pCl = new Paragraph(); pCl.add(new Phrase(ci.getLOCALTRABALHOL_(), fontCorpo)); pCl.add(new Phrase(ci.getLOCALTRABALHO_(), fontCorpoN)); pCl.add(new Phrase("\nPLACE OF WORK", fontUK)); PdfPCell cellLocalTrabalho = new PdfPCell(pCl); cellLocalTrabalho.setBorder(0); cellNome.setPaddingTop(7f); cellNome.setPaddingBottom(7f); cellNome.setBorder(0); cellEndereco.setPaddingTop(7f); cellEndereco.setPaddingBottom(7f); cellEndereco.setBorder(0); // PdfPCell cellNCliente= new PdfPCell( new Phrase(" "+ci.getNUNCLIENTE(),fontCorpo));cellNome.setPaddingTop(5f); // cellNCliente.setPaddingTop(7f); // cellNCliente.setPaddingBottom(7f); // cellNCliente.setBorder(0); cellProfissao.setPaddingTop(7f); cellProfissao.setPaddingBottom(7f); cellProfissao.setBorder(0); cellLocalTrabalho.setPaddingTop(7f); cellLocalTrabalho.setPaddingBottom(7f); cellLocalTrabalho.setBorder(0); pTableCliente.addCell(cellTituloTsbleSegurado); pTableCliente.addCell(cellNome); pTableCliente.addCell(cellEndereco); // pTableCliente.addCell(cellNCliente); pTableCliente.addCell(cellProfissao); pTableCliente.addCell(cellLocalTrabalho); para = new Paragraph(); Paragraph p = new Paragraph("3 - Premio E Cobertura".toUpperCase(), fontCorpoNG); Paragraph p1 = new Paragraph("\n3 - PREMIUM AND COVER".toUpperCase(), fontUKb); para.add(p); para.add(p1); PdfPCell cellTiltuloSegro = new PdfPCell(para); cellTiltuloSegro.setPaddingTop(7f); cellTiltuloSegro.setPaddingBottom(7f); cellTiltuloSegro.setBorder(0); // PdfPCell cellApolice= new PdfPCell( new Phrase(" N Aplice: ".toUpperCase()+numApolice,fontCorpo)); // cellApolice.setPaddingTop(7f); // cellApolice.setPaddingBottom(7f); // cellApolice.setBorder(0); Paragraph pTotalSegurado = new Paragraph(); pTotalSegurado.add(new Phrase("Prmio: ".toUpperCase().toUpperCase(), fontCorpo)); /** * * * ildo - premio liquido -> */ pTotalSegurado.add(new Phrase( ((c.getPremioLiquidoMoeda() == null /*&& vb.getVeiculo().getTipoCobertura().equals("41") */ ) ? " " : c.getPremioLiquidoMoeda() + " " + c.getSigla()), fontCorpoN)); pTotalSegurado.add(new Phrase("\nPREMIUM", fontUK)); PdfPCell cellTotalSegurado = new PdfPCell(pTotalSegurado); cellTotalSegurado.setPaddingTop(7f); cellTotalSegurado.setPaddingBottom(7f); cellTotalSegurado.setBorder(0); Paragraph pExcesso = new Paragraph(); pExcesso.add(new Phrase("Excesso: ".toUpperCase(), fontCorpo)); pExcesso.add(new Phrase((c.getFranquia() == null) ? "No aplicvel".toUpperCase() : c.getFranquia(), fontCorpoN)); pExcesso.add(new Phrase("\nEXCESS: ", fontUK)); PdfPCell cellExcesso = new PdfPCell(pExcesso); cellExcesso.setPaddingTop(7f); cellExcesso.setPaddingBottom(7f); cellExcesso.setBorder(0); // PdfPCell cellValor1Preminio= new PdfPCell( new Phrase(" Valor Primeiro Premio: ".toUpperCase()+((c.getPrimeiroPremio()==null)?" ":c.getPrimeiroPremio()),fontCorpo)); // cellValor1Preminio.setPaddingTop(7f); // cellValor1Preminio.setPaddingBottom(7f); // cellValor1Preminio.setBorder(0); // // PdfPCell cellTotalPremioAnual= new PdfPCell( new Phrase(" Valor Premio Anual: ".toUpperCase()+((c.getPremioAnual()==null)?" ":c.getPremioAnual()),fontCorpo)); // cellTotalPremioAnual.setPaddingTop(7f); // cellTotalPremioAnual.setPaddingBottom(7f); // cellTotalPremioAnual.setBorder(0); // PdfPCell cellPeriodo= new PdfPCell( new Phrase(" Periodo Do Seguro: ".toUpperCase()+((c.getDataInicio()!= null) ? sdf.format(c.getDataInicio()): " " )+" "+((c.getDataFim()!= null) ? sdf.format(c.getDataFim()): " " ),fontCorpo)); // cellPeriodo.setPaddingTop(7f); // cellPeriodo.setPaddingBottom(7f); // cellPeriodo.setBorder(0) Paragraph pDataRenovacao = new Paragraph(); pDataRenovacao.add(new Phrase("Data Renovao de Seguro: ".toUpperCase(), fontCorpo)); pDataRenovacao.add(new Phrase(((c.getDataRenovacao() != null) ? sdf.format(c.getDataRenovacao()) : " "), fontCorpoN)); pDataRenovacao.add(new Phrase("\nRENEWAL DATE OF COVER", fontUK)); PdfPCell cellDataRenovacao = new PdfPCell(pDataRenovacao); cellDataRenovacao.setPaddingTop(7f); cellDataRenovacao.setPaddingBottom(7f); cellDataRenovacao.setBorder(0); Paragraph pTipoCobert = new Paragraph(); pTipoCobert.add(new Phrase("Tipo De Cobertura: ".toUpperCase(), fontCorpo)); pTipoCobert .add(new Phrase( ((vb.getVeiculo().getTipoCobertura() != null) ? (vb.getVeiculo().getTipoCobertura().equals("41") ? "Contra Terceiros".toUpperCase() : (vb.getVeiculo().getTipoCobertura().equals("42") ? "CONTRA Todos os riscos".toUpperCase() : (vb.getVeiculo().getTipoCobertura().equals("43") ? "Compreensivo limitado".toUpperCase() : vb.getVeiculo().getTipoCobertura()))) : " "), fontCorpoN)); pTipoCobert.add(new Phrase("\nTYPE OF CAVER", fontUK)); PdfPCell cellTipoCobert = new PdfPCell(pTipoCobert); cellTipoCobert.setPaddingTop(7f); cellTipoCobert.setPaddingBottom(7f); cellTipoCobert.setBorder(0); Paragraph pLimiteArea = new Paragraph(); pLimiteArea.add(new Phrase("Limite de rea geogrfica: ".toUpperCase(), fontCorpo)); pLimiteArea.add(new Phrase("so Tom e principe".toUpperCase(), fontCorpoN)); pLimiteArea.add(new Phrase("\nLIMIT OF GEOGRAPHICAL AREA".toUpperCase(), fontUK)); PdfPCell cellLimiteArea = new PdfPCell(pLimiteArea); cellLimiteArea.setPaddingTop(7f); cellLimiteArea.setPaddingBottom(7f); cellLimiteArea.setBorder(0); Paragraph pLeis = new Paragraph(); pLeis.add(new Phrase("legislao: ".toUpperCase(), fontCorpo)); pLeis.add(new Phrase("artigos 1 36, lei n 30/2000 da repblica democrtica de stp".toUpperCase(), fontCorpoN)); pLeis.add(new Phrase("\nLEGISLATION: ", fontUK)); pLeis.add(new Phrase("ARTICLES 1 TO 36, LAW NO 30/2000 OF THE DEMOCRATIC REPUBLIC OF STP", fontUKb)); PdfPCell cellLeis = new PdfPCell(pLeis); cellLeis.setPaddingTop(7f); cellLeis.setPaddingBottom(7f); cellLeis.setBorder(0); pTableSeguro.addCell(cellTiltuloSegro); // pTableSeguro.addCell(cellApolice); pTableSeguro.addCell(cellTotalSegurado); // pTableSeguro.addCell(cellValor1Preminio); // pTableSeguro.addCell(cellTotalPremioAnual); pTableSeguro.addCell(cellExcesso); pTableSeguro.addCell(cellDataRenovacao); pTableSeguro.addCell(cellTipoCobert); pTableSeguro.addCell(cellLimiteArea); pTableSeguro.addCell(cellLeis); PdfPTable pTableDadosTitulo = new PdfPTable(1); pTableDadosTitulo.setWidthPercentage(88f); para = new Paragraph(); Phrase PDadosTitulo = new Phrase("2 - Informaes do(s) Veculo(s)".toUpperCase(), fontCorpoN); Phrase PDadosTitulos = new Phrase("\n2 - VEHICLE (S) INFORMATIONS".toUpperCase(), fontUKb); para.add(PDadosTitulo); para.add(PDadosTitulos); PdfPCell cellDadosTitulo = new PdfPCell(para); cellDadosTitulo.setBorder(0); pTableDadosTitulo.addCell(cellDadosTitulo); pTableDadosTitulo.addCell(cellNull); PdfPTable pTableDados = new PdfPTable(new float[] { 13.5f, 13.5f, 14, 17, 16, 12, 14 }); pTableDados.setWidthPercentage(88f); para = new Paragraph(); Phrase PMarca = new Phrase("Marca".toUpperCase(), fontCorpoTabT); Phrase PMarcaUK = new Phrase("\nMARK".toUpperCase(), fontUK); para.add(PMarca); para.add(PMarcaUK); PdfPCell cellMarca = new PdfPCell(para); cellMarca.setPaddingTop(5f); cellMarca.setPaddingBottom(5f); cellMarca.setHorizontalAlignment(Element.ALIGN_CENTER); para = new Paragraph(); Paragraph PModelo = new Paragraph("Modelo".toUpperCase(), fontCorpoTabT); Paragraph PModeloUK = new Paragraph("\nMODEL".toUpperCase(), fontUK); para.add(PModelo); para.add(PModeloUK); PdfPCell cellModelo = new PdfPCell(para); cellModelo.setHorizontalAlignment(Element.ALIGN_CENTER); cellModelo.setPaddingTop(5f); cellModelo.setPaddingBottom(5f); para = new Paragraph(); Phrase PMatricula = new Phrase("NO DE MATR?CULA".toUpperCase(), fontCorpoTabT); Phrase PMatriculaUK = new Phrase("\nREG. NUMBER".toUpperCase(), fontUK); para.add(PMatricula); para.add(PMatriculaUK); PdfPCell cellMatricula = new PdfPCell(para); cellMatricula.setHorizontalAlignment(Element.ALIGN_CENTER); cellMatricula.setPaddingTop(5f); cellMatricula.setPaddingBottom(5f); para = new Paragraph(); Phrase PChasii = new Phrase("No. de chissi/Motor".toUpperCase(), fontCorpoTabT); Phrase PChasiiUK = new Phrase("\nchissiS/ENGINE NO.".toUpperCase(), fontUK); para.add(PChasii); para.add(PChasiiUK); PdfPCell cellChasii = new PdfPCell(para); cellChasii.setHorizontalAlignment(Element.ALIGN_CENTER); cellChasii.setPaddingTop(5f); cellChasii.setPaddingBottom(5f); para = new Paragraph(); Phrase PAnoFabricoCompra = new Phrase("ano de Fabrico/Compra".toUpperCase(), fontCorpoTabT); Phrase PAnoFabricoCompraUK = new Phrase("\nYear of Manufacture/PURCHASE".toUpperCase(), fontUK); para.add(PAnoFabricoCompra); para.add(PAnoFabricoCompraUK); PdfPCell cellAnoFabricoCompra = new PdfPCell(para); cellAnoFabricoCompra.setHorizontalAlignment(Element.ALIGN_CENTER); cellAnoFabricoCompra.setPaddingTop(5f); cellAnoFabricoCompra.setPaddingBottom(5f); para = new Paragraph(); Phrase PTotalLuagares = new Phrase("lotao".toUpperCase(), fontCorpoTabT); Phrase PTotalLuagaresUK = new Phrase("\nSTOCKING", fontUK); para.add(PTotalLuagares); para.add(PTotalLuagaresUK); PdfPCell cellTotalLuagares = new PdfPCell(para); cellTotalLuagares.setHorizontalAlignment(Element.ALIGN_CENTER); cellTotalLuagares.setPaddingTop(5f); cellTotalLuagares.setPaddingBottom(5f); para = new Paragraph(); Phrase PDadosValorSeguro = new Phrase("Estimativa / Valor Segurado".toUpperCase(), fontCorpoTabT); Phrase PDadosValorSeguroUK = new Phrase("\nEstimation / Amount Insured".toUpperCase(), fontUK); para.add(PDadosValorSeguro); para.add(PDadosValorSeguroUK); PdfPCell cellDadosValorSeguro = new PdfPCell(para); cellDadosValorSeguro.setHorizontalAlignment(Element.ALIGN_CENTER); cellDadosValorSeguro.setPaddingTop(5f); cellDadosValorSeguro.setPaddingBottom(5f); pTableDados.addCell(cellMarca); pTableDados.addCell(cellModelo); pTableDados.addCell(cellMatricula); pTableDados.addCell(cellChasii); pTableDados.addCell(cellAnoFabricoCompra); pTableDados.addCell(cellTotalLuagares); pTableDados.addCell(cellDadosValorSeguro); int total = vb.getInfo().size(); for (int i = 0; i < total; i++) { cellMarca = new PdfPCell( new Phrase((vb.getInfo().get(i).getMarca() == null) ? " " : vb.getInfo().get(i).getMarca(), fontCorpoTab)); cellMarca.setHorizontalAlignment(Element.ALIGN_CENTER); cellModelo = new PdfPCell(new Phrase( (vb.getInfo().get(i).getModelo() == null) ? " " : vb.getInfo().get(i).getModelo(), fontCorpoTab)); cellModelo.setHorizontalAlignment(Element.ALIGN_CENTER); cellMatricula = new PdfPCell( new Phrase(((vb.getInfo().get(i).getNumeroMatricula() == null) ? ".........." : vb.getInfo().get(i).getNumeroMatricula()), fontCorpoTab)); cellMatricula.setHorizontalAlignment(Element.ALIGN_CENTER); cellDadosValorSeguro = new PdfPCell(new Phrase( ((vb.getInfo().get(i).getValorAtual() == null || vb.getInfo().get(i).getValorAtual().isEmpty() || vb.getVeiculo().getTipoCobertura().equals("41")) ? " NA " : Moeda.format(Double.valueOf(vb.getInfo().get(i).getValorAtual()))), fontCorpoTab)); cellDadosValorSeguro.setHorizontalAlignment(Element.ALIGN_CENTER); cellAnoFabricoCompra = new PdfPCell(new Phrase(((vb.getInfo().get(i).getAnoFabrico() == null || (vb.getInfo().get(i).getAnoFabrico().isEmpty())) ? "......." : vb.getInfo().get(i).getAnoFabrico()) + "/" + ((vb.getInfo().get(i).getAnoCompra() == null || (vb.getInfo().get(i).getAnoCompra().isEmpty())) ? "......." : vb.getInfo().get(i).getAnoCompra()), fontCorpoTab)); cellAnoFabricoCompra.setHorizontalAlignment(Element.ALIGN_CENTER); cellTotalLuagares = new PdfPCell( new Phrase(vb.getInfo().get(i).getCapacidade() + " LUGARES", fontCorpoTab)); cellTotalLuagares.setHorizontalAlignment(Element.ALIGN_CENTER); cellChasii = new PdfPCell(new Phrase(vb.getInfo().get(i).getChassi() + " ", fontCorpoTab)); cellChasii.setHorizontalAlignment(Element.ALIGN_CENTER); float pad = getPadding(total); cellMarca.setPaddingTop(pad); cellMarca.setPaddingBottom(pad); pTableDados.addCell(cellMarca); cellModelo.setPaddingTop(pad); cellModelo.setPaddingBottom(pad); pTableDados.addCell(cellModelo); cellMatricula.setPaddingTop(pad); cellMatricula.setPaddingBottom(pad); pTableDados.addCell(cellMatricula); cellChasii.setPaddingTop(pad); cellChasii.setPaddingBottom(pad); pTableDados.addCell(cellChasii); cellAnoFabricoCompra.setPaddingTop(pad); cellAnoFabricoCompra.setPaddingBottom(pad); pTableDados.addCell(cellAnoFabricoCompra); cellTotalLuagares.setPaddingTop(pad); cellTotalLuagares.setPaddingBottom(pad); pTableDados.addCell(cellTotalLuagares); cellDadosValorSeguro.setPaddingTop(pad); cellDadosValorSeguro.setPaddingBottom(pad); pTableDados.addCell(cellDadosValorSeguro); } // PdfPTable pTableAssinaturaTitulo= new PdfPTable(1); // pTableAssinaturaTitulo.setWidthPercentage(88f); // PdfPTable pTableAssinatura= new PdfPTable( new float[]{50f,50f}); // pTableAssinatura.setWidthPercentage(88f); // PdfPCell cellAssinatora= new PdfPCell(new Phrase("Assinaturas".toUpperCase(),fontCorpoN)); // cellAssinatora.setBorder(0); // cellAssinatora.setHorizontalAlignment(Element.ALIGN_CENTER); // PdfPCell celllinha1= new PdfPCell(new Phrase("____________________________________________".toUpperCase(),fontCorpo)); // celllinha1.setBorder(0); // celllinha1.setHorizontalAlignment(Element.ALIGN_CENTER); // PdfPCell celllinha2= new PdfPCell(new Phrase("____________________________________________".toUpperCase(),fontCorpo)); // celllinha2.setBorder(0); // celllinha2.setHorizontalAlignment(Element.ALIGN_CENTER); // PdfPCell celllinha11= new PdfPCell(new Phrase("para nicon Seguro sa stp".toUpperCase(),fontCorpoP)); // celllinha11.setBorder(0); // celllinha11.setHorizontalAlignment(Element.ALIGN_CENTER); // PdfPCell celllinha21= new PdfPCell(new Phrase("o segurado ".toUpperCase(),fontCorpoP)); // celllinha21.setBorder(0); // celllinha21.setHorizontalAlignment(Element.ALIGN_CENTER); // pTableAssinaturaTitulo.addCell(cellAssinatora); // pTableAssinatura.addCell(celllinha1); // pTableAssinatura.addCell(celllinha2); // pTableAssinatura.addCell(celllinha11); // pTableAssinatura.addCell(celllinha21); Document documento = new Document(); documento.setPageSize(PageSize.A4); documento.setMargins(20f, 20f, 35f, 5f); // File ff= new File("Documentos\\"+user+"\\Seguro Automovel\\"); // ff.mkdirs(); // ff =new File(ff.getAbsoluteFile()+"\\"+"Formulario Seguro Automovel "+sdf1.format(new Date())+".pdf"); File ff = new File(arquivo + "/" + user + "/Seguro Automovel/"); ff.mkdirs(); String Ddata = sdf1.format(new Date()); ff = new File(ff.getAbsoluteFile() + "/" + "Formulario Seguro Automovel " + Ddata + ".pdf"); reString = "../Documentos/" + user + "/Seguro Automovel/" + "Formulario Seguro Automovel " + Ddata + ".pdf"; OutputStream outputStraem = new FileOutputStream(ff); PdfWriter writer = PdfWriter.getInstance(documento, outputStraem); if (MarcaDAgua.isSimulation) { MarcaDAgua.SimulacaoVertical v = new MarcaDAgua.SimulacaoVertical(); writer.setPageEvent(v); } if (MarcaDAgua.isCanceled) { MarcaDAgua.AnulacaoVertical v = new MarcaDAgua.AnulacaoVertical(); writer.setPageEvent(v); } PdfPTable pTableLinha = new PdfPTable(1); pTableLinha.setWidthPercentage(88f); PdfPCell cellLinha = new PdfPCell(new Phrase( "----------------------------------------------------------------------------------------------------------------------", fontCorpo)); cellLinha.setBorder(0); pTableLinha.addCell(cellLinha); cellLinha.setPaddingTop(-9f); pTableLinha.addCell(cellLinha); PdfPTable pTableApoliceAndPeriodo = new PdfPTable(new float[] { 40, 60 }); pTableApoliceAndPeriodo.setWidthPercentage(88f); Paragraph pApolice = new Paragraph(); pApolice.add(new Phrase("N Aplice: ".toUpperCase(), fontCorpo)); pApolice.add(new Phrase(numApolice, fontCorpoN)); pApolice.add(new Phrase("\nPOLICY NO:", fontUK)); PdfPCell cellApolice = new PdfPCell(pApolice); // cellApolice.setPaddingTop(-2); // cellApolice.setPaddingBottom(4.5f); cellApolice.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableApoliceAndPeriodo.addCell(cellApolice); Paragraph pPeriodo = new Paragraph(); pPeriodo.add(new Phrase("Periodo Do Seguro: ".toUpperCase(), fontCorpo)); pPeriodo.add(new Phrase(((c.getDataInicio() != null) ? sdf.format(c.getDataInicio()) : " ") + " " + ((c.getDataFim() != null) ? sdf.format(c.getDataFim()) : " "), fontCorpoN)); pPeriodo.add(new Phrase("\nPERIOD OF INSURANCE:", fontUK)); PdfPCell cellPeriodo = new PdfPCell(pPeriodo); // cellPeriodo.setPaddingTop(-2); // cellPeriodo.setPaddingBottom(4.5f); cellPeriodo.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableApoliceAndPeriodo.addCell(cellPeriodo); documento.open(); documento.add(pTableEmpresaPricipal); documento.add(pTableNull); documento.add(pTableTitulo); documento.add(pTableNull); documento.add(pTableApoliceAndPeriodo); documento.add(pTableNull); documento.add(pTableCliente); documento.add(pTableNull); documento.add(pTableLinha); documento.add(pTableNull); documento.add(pTableDadosTitulo); documento.add(pTableDados); documento.add(pTableNull); documento.add(pTableLinha); documento.add(pTableNull); documento.add(pTableSeguro); // documento.add(pTableNull); // documento.add(pTableAssinaturaTitulo); // documento.add(pTableNull); // documento.add(pTableNull); // documento.add(pTableAssinatura); documento.close(); // PrintPdf printPdf = new PrintPdf(ff.getAbsolutePath(), ff.getAbsolutePath(), 0, 595f,842f,"Enviar Para o OneNote 2013",1); // //PrintPdf printPdf = new PrintPdf(ff.getAbsolutePath(), ff.getAbsolutePath(), 0, 595f,842f,"Hewlett-Packard HP LaserJet P2035",1); // // printPdf.print(); } catch (BadElementException | IOException ex) { Logger.getLogger(SeguroAPG.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException ex) { Logger.getLogger(SeguroAPG.class.getName()).log(Level.SEVERE, null, ex); } return reString; }
From source file:fenix.planner.pdf.PDFGenerator.java
License:Open Source License
private void parseAndAddBodyTextLineToParagraph(Paragraph paragraph, String line, Font font) { // TODO add support for additional styles // TODO add better error checking and reporting Font currentFont = new Font(font); StringBuilder sb = new StringBuilder(); for (char c : line.toCharArray()) { if (c == '*') { if (sb.length() > 0) { paragraph.add(new Phrase(sb.toString(), currentFont)); sb = new StringBuilder(); }//from w w w.j a v a 2 s. c om if (currentFont.isBold()) { currentFont = deriveWithStyle(currentFont, currentFont.getStyle() & ~Font.BOLD); } else { currentFont = deriveWithStyle(currentFont, currentFont.getStyle() | Font.BOLD); } } else if (c == '_') { if (sb.length() > 0) { paragraph.add(new Phrase(sb.toString(), currentFont)); sb = new StringBuilder(); } if (currentFont.isItalic()) { currentFont = deriveWithStyle(currentFont, currentFont.getStyle() & ~Font.ITALIC); } else { currentFont = deriveWithStyle(currentFont, currentFont.getStyle() | Font.ITALIC); } } else { sb.append(c); } } paragraph.add(new Phrase(sb.toString(), currentFont)); }
From source file:file.PDFWriter.java
License:Open Source License
/** * Set the font styles for the PDF//from ww w . j a v a 2s .c om */ private void setFontStyles() { lineFont = new Font(FontFamily.TIMES_ROMAN); lineFontUnderline = new Font(FontFamily.TIMES_ROMAN); errorFont = new Font(FontFamily.TIMES_ROMAN); lineFontBold = new Font(FontFamily.TIMES_ROMAN); errorFontBold = new Font(FontFamily.TIMES_ROMAN); lineFontUnderline.setStyle(Font.UNDERLINE); lineFontBold.setStyle(Font.BOLD); errorFont.setStyle(Font.ITALIC); errorFontBold.setStyle(Font.BOLDITALIC); }
From source file:file.PDFWriter.java
License:Open Source License
/** * Adds the table of possible errors to the PDF * @param errorIX the specific error to be bolded * @throws DocumentException //from w ww. j ava2s. c o m */ private void addErrorTableToPDF(int errorIX) throws DocumentException { PdfPTable errorTable = new PdfPTable(7); errorTable.setWidthPercentage(100); for (int i = 0; i < errorOutput.length; i++) { errorFont.setStyle(Font.ITALIC); PdfPCell cell; if (i == errorIX) { cell = new PdfPCell(new Paragraph(errorOutput[i], errorFontBold)); } else { cell = new PdfPCell(new Paragraph(errorOutput[i], errorFont)); } cell.setBorder(PdfPCell.NO_BORDER); errorTable.addCell(cell); } document.add(errorTable); }
From source file:frames.main.java
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { try {/*from w w w.j a va2 s. co m*/ BaseFont unicode = BaseFont.createFont("c:/windows/fonts/ALGER.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font1003 = new Font(unicode, 18, Font.ITALIC, new BaseColor(139, 0, 0)); Font font1008 = new Font(unicode, 20, Font.BOLD, new BaseColor(101, 67, 33)); Font font1004 = new Font(unicode, 18, Font.BOLD, new BaseColor(139, 0, 0)); Font font1009 = new Font(unicode, 10, Font.NORMAL, new BaseColor(139, 10, 20)); Font font1005 = new Font(unicode, 18, Font.UNDERLINE, new BaseColor(101, 67, 33)); Font font1006 = new Font(unicode, 9, Font.BOLDITALIC, new BaseColor(101, 67, 33)); // Rectangle rect=new RectangleReadOnly(590, 470, 0); ///////////////////////////////////// Font font100 = new Font(unicode, 10, Font.ITALIC, BaseColor.BLUE); Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("REGISTRATION-FORM.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); Font font111 = new Font(Font.FontFamily.COURIER, 16, Font.BOLD, BaseColor.ORANGE); Font font110 = new Font(Font.FontFamily.COURIER, 14, Font.NORMAL, BaseColor.GREEN); Font font11 = new Font(Font.FontFamily.COURIER, 12, Font.NORMAL, BaseColor.GREEN); com.itextpdf.text.Image image2 = com.itextpdf.text.Image .getInstance("C:\\smart kid\\src\\frames\\logo.jpg"); image2.scaleAbsolute(115f, 115f); image2.setAbsolutePosition(3, 716); Paragraph p = new Paragraph(); document.add(image2); document.add(new Chunk(" ", font1004)); document.add(new Chunk("ADMISSION FORM", font1005)); document.add(new Paragraph(" SMART KIDS CONVENT SCHOOL", font1004)); document.add(new Paragraph( " Managed By:The Smart Kids Educational Society,")); document.add(new Paragraph( " Reg.No:-00169")); document.add(new Paragraph( " 413A/23,HEERA NAGAR,GURGAON")); document.add(new Paragraph( " MOB:-9911752900 , 9891929835")); document.add(new Paragraph( " Reg.No" + " " + Rtf8.getText())); document.add(new Paragraph( "Admission No." + " " + new Date().toString())); document.add(new Paragraph(" ")); Paragraph p1 = new Paragraph(); p1.add(new Chunk("Certified that " + "Son/Daughter of:", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p1.add(new Chunk(Rtf1.getText(), font11)); document.add(p1); document.add(new Paragraph(" ")); Paragraph p2 = new Paragraph(); p2.add(new Chunk("Father's Name :" + Rtf2.getText() + "Mob:-", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p2.add(new Chunk(Rtf2.getText(), font11)); document.add(p2); document.add(new Paragraph(" ")); Paragraph p3 = new Paragraph(); p3.add(new Chunk("Mother's Name :" + Rtf2.getText() + "Mob:-", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p3.add(new Chunk(Rtf2.getText(), font11)); document.add(p3); document.add(new Paragraph(" ")); Paragraph p4 = new Paragraph(); p4.add(new Chunk("His/Her Date of birth :" + Rtf2.getText() + "Age", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p4.add(new Chunk(Rtf2.getText(), font11)); document.add(p4); document.add(new Paragraph(" ")); Paragraph p5 = new Paragraph(); p5.add(new Chunk("Corrosponding Address :", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p5.add(new Chunk("", font11)); document.add(p5); document.add(new Paragraph(" ")); Paragraph p6 = new Paragraph(); p6.add(new Chunk("Parmanent Address :", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p6.add(new Chunk("", font11)); document.add(p6); document.add(new Paragraph(" ")); Paragraph p7 = new Paragraph(); p7.add(new Chunk("Previous School & result :", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p7.add(new Chunk("He/She Wants Admmisiion in", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); document.add(p7); document.add(new Paragraph(" ")); Paragraph p8 = new Paragraph(); p8.add(new Chunk("Smart Kids Convent School in :", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p8.add(new Chunk("Class.He/She will always be regular and punctual to school.", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); document.add(p8); document.add(new Paragraph(" ")); Paragraph p9 = new Paragraph(); p9.add(new Chunk("Please admit him/her :" + "Signature", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p9.add(new Chunk( " in" + "Class" + "Parents/Guardian", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); document.add(p9); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph( " Principal(Signature) Permission of Director", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph("NOTE:- FEES WILL NOT BE REFUNDED AFTER ADMISSION.")); cb.saveState(); cb.setColorStroke(BaseColor.BLACK); cb.rectangle(2, 2, 588, 826); cb.stroke(); cb.restoreState(); JOptionPane.showMessageDialog(this, "receipt printed.."); document.close(); ; } catch (Exception ee) { JOptionPane.showMessageDialog(this, ee); } }
From source file:frames.main.java
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) { if (PRINTMODE.getSelectedIndex() == 0) { try {/*from www.j av a 2 s . c o m*/ //mrpno=Integer.parseInt(DTFrpno.getText()); BaseFont unicode = BaseFont.createFont("c:/windows/fonts/ALGER.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font1003 = new Font(unicode, 18, Font.ITALIC, new BaseColor(139, 0, 0)); Font font1008 = new Font(unicode, 20, Font.BOLD, new BaseColor(101, 67, 33)); Font font1004 = new Font(unicode, 14, Font.BOLD, new BaseColor(139, 0, 0)); Font font1005 = new Font(unicode, 12, Font.UNDERLINE, new BaseColor(255, 0, 0)); Font font1006 = new Font(unicode, 9, Font.BOLDITALIC, new BaseColor(101, 67, 33)); Rectangle rect = new RectangleReadOnly(590, 470, 0); ///////////////////////////////////// Font font100 = new Font(unicode, 10, Font.ITALIC, BaseColor.BLUE); Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("REGISTRATION.pdf")); document.setPageSize(rect); document.open(); // PdfContentByte cb = writer.getDirectContent(); Font font111 = new Font(Font.FontFamily.COURIER, 16, Font.BOLD, BaseColor.ORANGE); com.itextpdf.text.Image image2 = com.itextpdf.text.Image .getInstance("C:\\smart kid\\src\\frames\\logo.jpg"); image2.scaleAbsolute(115f, 115f); image2.setAbsolutePosition(2, 350); document.add(image2); document.add(new Chunk( " ", font100)); document.add(new Chunk("RECEIPT", font1005)); //document.add(p); // document.add(new Paragraph( )); document.add(new Paragraph( " SMART KID CONVENT SCHOOL ", font1003)); // document.add(new Chunk(" SMART KID CONVENT SCHOOL ",font1003)); // document.add(new Chunk(" 413A/23,HEERA NAGAR GURGAON. ",font100)); document.add(new Paragraph( " 413A/23,HEERA NAGAR GURGAON. ", font100)); // document.add(new Chunk(" ph:9911752900,9891929835 ",font100)); document.add(new Paragraph( " ph:9911752900,9891929835 ", font100)); // document.add(new Chunk(" E-mail:info.smartkids@gmail.com",FontFactory.getFont(FontFactory.COURIER,9,Font.BOLDITALIC,BaseColor.DARK_GRAY))); document.add(new Paragraph(" E-mail:info.smartkids@gmail.com", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLDITALIC, BaseColor.DARK_GRAY))); document.add(new Paragraph(" ")); PdfPTable table1 = new PdfPTable(4); PdfPCell c = new PdfPCell(new Paragraph("STUDENT PARTICULARS")); c.setColspan(4); c.setBackgroundColor(BaseColor.GREEN); c.setHorizontalAlignment(Element.ALIGN_CENTER); table1.addCell(c); table1.addCell("Student Name:"); table1.addCell(new PdfPCell(new Paragraph(Dtf2.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN)))); table1.addCell("Class:"); table1.addCell(new Paragraph((String) Dtf5.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); table1.addCell("Section:"); table1.addCell(new Paragraph((String) Dtf22.getText() + " " + "Phone.:" + Dtf20.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); table1.addCell("Registration No:"); table1.addCell(new PdfPCell(new Paragraph(Dtf1.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN)))); table1.addCell("Session:"); table1.addCell(new Paragraph("NA", FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); table1.addCell("Month:"); table1.addCell(new Paragraph((String) Djc1.getSelectedItem(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); float[] ColumnWidths1 = new float[] { 12f, 19f, 10f, 24f }; table1.setWidths(ColumnWidths1); table1.setWidthPercentage(113); document.add(table1); // document.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(5); PdfPCell cc = new PdfPCell(new Paragraph("FEE INFORMATION")); cc.setBackgroundColor(BaseColor.GREEN); cc.setHorizontalAlignment(Element.ALIGN_CENTER); cc.setColspan(5); table.addCell(cc); PdfPCell cell99 = new PdfPCell(new Paragraph("Sl No", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell90 = new PdfPCell(new Paragraph("Particulars", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell91 = new PdfPCell(new Paragraph("Cash", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell92 = new PdfPCell(new Paragraph("Cheque", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell93 = new PdfPCell(new Paragraph("Total", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell99); table.addCell(cell90); table.addCell(cell91); table.addCell(cell92); table.addCell(cell93); table.addCell("1"); PdfPCell cell1 = new PdfPCell(new Paragraph("Registration Fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell1); table.addCell(Dtf11.getText()); table.addCell(" "); table.addCell(" "); table.addCell("2"); PdfPCell cell2 = new PdfPCell(new Paragraph("Admission/Re admission fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell2); table.addCell(Dtf12.getText()); table.addCell(" "); table.addCell(" "); table.addCell("3"); PdfPCell cell3 = new PdfPCell(new Paragraph("Building fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell3); table.addCell(Dtf13.getText()); table.addCell(" "); table.addCell(" "); table.addCell("4"); PdfPCell cell4 = new PdfPCell(new Paragraph("Annual Charge", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell4); table.addCell(Dtf14.getText()); table.addCell(" "); table.addCell(" "); table.addCell("5"); PdfPCell cell14 = new PdfPCell(new Paragraph("Security (Refundable)", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell14); table.addCell(Dtf17.getText()); table.addCell(" "); table.addCell(" "); table.addCell("6"); PdfPCell cell5 = new PdfPCell(new Paragraph("Tution", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell5); table.addCell(Dtf6.getText()); table.addCell(" "); table.addCell(" "); table.addCell("7"); PdfPCell cell6 = new PdfPCell(new Paragraph("Total pupils fund", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell6); table.addCell(Dtf16.getText()); table.addCell(" "); table.addCell(" "); table.addCell("8"); PdfPCell cell7 = new PdfPCell(new Paragraph("Computer Fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell7); table.addCell(Dtf7.getText()); table.addCell(" "); table.addCell(" "); table.addCell("9"); PdfPCell cell8 = new PdfPCell(new Paragraph("Sports Fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell8); table.addCell(Dtf15.getText()); table.addCell(" "); table.addCell(" "); table.addCell("10"); PdfPCell cell9 = new PdfPCell(new Paragraph("House exam Fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell9); table.addCell(Dtf8.getText()); table.addCell(" "); table.addCell(" "); table.addCell("11"); PdfPCell cell10 = new PdfPCell(new Paragraph("Conveyance Charge", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell10); table.addCell(Dtf18.getText()); table.addCell(" "); //table.addCell(" "); table.addCell(""); PdfPCell cell12 = new PdfPCell(new Paragraph("12", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLD, BaseColor.BLACK))); PdfPCell cell13 = new PdfPCell(new Paragraph("Grand Total", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLD, BaseColor.BLACK))); table.addCell(cell12); table.addCell(cell13); table.addCell( String.valueOf((Integer.parseInt(Dtf11.getText())) + (Integer.parseInt(Dtf12.getText())) + (Integer.parseInt(Dtf13.getText())) + (Integer.parseInt(Dtf14.getText())) + (Integer.parseInt(Dtf17.getText())) + (Integer.parseInt(Dtf6.getText())) + (Integer.parseInt(Dtf16.getText())) + (Integer.parseInt(Dtf7.getText())) + (Integer.parseInt(Dtf15.getText())) + (Integer.parseInt(Dtf8.getText())) + (Integer.parseInt(Dtf18.getText())) + (Integer.parseInt(Dtf9.getText())))); float[] ColumnWidths = new float[] { 8f, 25f, 11f, 10f, 10f }; table.setWidths(ColumnWidths); table.setWidthPercentage(113); table.completeRow(); document.add(table); document.add(new Chunk( "# Fee once paid is not refundable . For Smart kid convent school Signature ")); //document.add(new Chunk("# The monthly fee has to be deposited before 10th of every month Signature ")); JOptionPane.showMessageDialog(this, "receipt printed.."); Dtf21.setText(String.valueOf(Integer.parseInt(Dtf21.getText()) + 1)); document.close(); ; } catch (Exception ee) { JOptionPane.showMessageDialog(this, ee); } } else if (PRINTMODE.getSelectedIndex() == 1) { try { //mrpno=Integer.parseInt(DTFrpno.getText()); BaseFont unicode = BaseFont.createFont("c:/windows/fonts/ALGER.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font1003 = new Font(unicode, 18, Font.ITALIC, new BaseColor(139, 0, 0)); Font font1008 = new Font(unicode, 20, Font.BOLD, new BaseColor(101, 67, 33)); Font font1004 = new Font(unicode, 14, Font.BOLD, new BaseColor(139, 0, 0)); Font font1005 = new Font(unicode, 12, Font.UNDERLINE, new BaseColor(255, 0, 0)); Font font1006 = new Font(unicode, 9, Font.BOLDITALIC, new BaseColor(101, 67, 33)); Rectangle rect = new RectangleReadOnly(590, 460, 0); ///////////////////////////////////// Font font100 = new Font(unicode, 10, Font.ITALIC, BaseColor.BLUE); Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("Feeslipp(MONTHLY).pdf")); document.setPageSize(rect); document.open(); // PdfContentByte cb = writer.getDirectContent(); Font font111 = new Font(Font.FontFamily.COURIER, 16, Font.BOLD, BaseColor.ORANGE); com.itextpdf.text.Image image2 = com.itextpdf.text.Image .getInstance("C:\\smart kid\\src\\frames\\logo.jpg"); image2.scaleAbsolute(115f, 115f); image2.setAbsolutePosition(2, 350); document.add(image2); Paragraph p = new Paragraph(); p.add(new Chunk(" ")); //p.add(new Chunk("RECEIPT",font1005)); //document.add(p); document.add(new Chunk(" RECEIPT", font1003)); document.add(new Paragraph(" SMART KID CONVENT SCHOOL ", font1003)); // document.add(new Chunk(" SMART KID CONVENT SCHOOL ",font1003)); // document.add(new Chunk(" 413A/23,HEERA NAGAR GURGAON. ",font100)); document.add(new Paragraph( " 413A/23,HEERA NAGAR GURGAON. ", font100)); // document.add(new Chunk(" ph:9911752900,9891929835 ",font100)); document.add(new Paragraph( " ph:9911752900,9891929835 ", font100)); // document.add(new Chunk(" E-mail:info.smartkids@gmail.com",FontFactory.getFont(FontFactory.COURIER,9,Font.BOLDITALIC,BaseColor.DARK_GRAY))); document.add(new Paragraph(" E-mail:info.smartkids@gmail.com", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLDITALIC, BaseColor.DARK_GRAY))); document.add(new Paragraph(" ")); PdfPTable table1 = new PdfPTable(4); PdfPCell c = new PdfPCell(new Paragraph("STUDENT PARTICULARS")); c.setColspan(4); c.setBackgroundColor(BaseColor.GREEN); c.setHorizontalAlignment(Element.ALIGN_CENTER); table1.addCell(c); table1.addCell("Student Name:"); table1.addCell(new PdfPCell(new Paragraph(Dtf2.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN)))); table1.addCell("Class:"); table1.addCell(new Paragraph(Dtf5.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); table1.addCell("Section:"); table1.addCell(new Paragraph(Dtf21.getText() + " " + "Phone.:" + Dtf20.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); table1.addCell("Registration No:"); table1.addCell(new PdfPCell(new Paragraph(Dtf1.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN)))); table1.addCell("Month:"); table1.addCell(new Paragraph((String) Djc1.getSelectedItem(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); float[] ColumnWidths1 = new float[] { 12f, 19f, 10f, 24f }; table1.setWidths(ColumnWidths1); table1.setWidthPercentage(113); document.add(table1); document.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(5); PdfPCell cc = new PdfPCell(new Paragraph("FEE INFORMATION")); cc.setBackgroundColor(BaseColor.GREEN); cc.setHorizontalAlignment(Element.ALIGN_CENTER); cc.setColspan(5); table.addCell(cc); PdfPCell cell99 = new PdfPCell(new Paragraph("Sl No", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell90 = new PdfPCell(new Paragraph("Particulars", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell91 = new PdfPCell(new Paragraph("Cash", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell92 = new PdfPCell(new Paragraph("Cheque", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell93 = new PdfPCell(new Paragraph("Total", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell99); table.addCell(cell90); table.addCell(cell91); table.addCell(cell92); table.addCell(cell93); table.addCell("1"); PdfPCell cell1 = new PdfPCell(new Paragraph("TUITION FEE", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell1); table.addCell(Dtf6.getText()); table.addCell(" "); table.addCell(" "); table.addCell("2"); PdfPCell cell2 = new PdfPCell(new Paragraph("COMPUTER FEE", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell2); table.addCell(Dtf7.getText()); table.addCell(" "); table.addCell(" "); table.addCell("3"); PdfPCell cell5 = new PdfPCell(new Paragraph("HOUSE EXAM FEE", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell5); table.addCell(Dtf8.getText()); table.addCell(" "); table.addCell(" "); table.addCell("4"); PdfPCell cell6 = new PdfPCell(new Paragraph("FINES", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell6); table.addCell(Dtf9.getText()); table.addCell(" "); table.addCell(" "); table.addCell("5"); PdfPCell cell7 = new PdfPCell(new Paragraph("OTHERS", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell7); table.addCell(Dtf10.getText()); table.addCell(" "); table.addCell(""); PdfPCell cell9 = new PdfPCell(new Paragraph("6", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLD, BaseColor.BLACK))); PdfPCell cell8 = new PdfPCell(new Paragraph("Grand Total", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLD, BaseColor.BLACK))); table.addCell(cell7); table.addCell(cell8); table.addCell(String.valueOf((Integer.parseInt(Dtf6.getText())) + (Integer.parseInt(Dtf7.getText())) + (Integer.parseInt(Dtf8.getText())) + (Integer.parseInt(Dtf9.getText())) + (Integer.parseInt(Dtf10.getText())))); float[] ColumnWidths = new float[] { 8f, 25f, 11f, 10f, 10f }; table.setWidths(ColumnWidths); table.setWidthPercentage(113); table.completeRow(); document.add(table); document.add(new Chunk( "# Fee once paid is not refundable . For smart kid convent School ")); document.add(new Chunk( "# The monthly fee has to be deposited before 10th of every month Signature ")); JOptionPane.showMessageDialog(this, "receipt printed.."); Dtf21.setText(String.valueOf(Integer.parseInt(Dtf21.getText()) + 1)); document.close(); ; } catch (Exception ee) { JOptionPane.showMessageDialog(this, ee); } } // TODO add your handling code here: }
From source file:frames.main.java
private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) { try {//ww w .j av a 2 s .c o m BaseFont unicode = BaseFont.createFont("c:/windows/fonts/ALGER.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); // Font font11113 = new Font(unicode, 16, Font.BOLD,BaseColor(2,2,2)); ///////////////////////////////////////////////dark brown////////////////////////////////////////////////////// Font font1003 = new Font(unicode, 16, Font.BOLD, new BaseColor(101, 67, 33)); Font font1008 = new Font(unicode, 20, Font.BOLD, new BaseColor(101, 67, 33)); ///////////////////////////////////// ///////////////////////////////////////////////dark red////////////////////////////////////////////////////// Font font1004 = new Font(unicode, 14, Font.BOLD, new BaseColor(139, 0, 0)); Font font1005 = new Font(unicode, 14, Font.BOLD, new BaseColor(255, 0, 0)); ///////////////////////////////////// Font font100 = new Font(unicode, 8, Font.ITALIC, BaseColor.BLUE); Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("SMART-TC.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); Font font111 = new Font(Font.FontFamily.COURIER, 16, Font.BOLD, BaseColor.ORANGE); com.itextpdf.text.Image image2 = com.itextpdf.text.Image .getInstance("C:\\smart kid\\src\\frames\\logo.jpg"); image2.scaleAbsolute(125f, 125f); image2.setAbsolutePosition(31, 700); document.add(image2); com.itextpdf.text.Image ing = com.itextpdf.text.Image.getInstance("C:\\smart kid\\src\\frames\\BC.jpg"); ing.setAbsolutePosition(1, 200); document.add(ing); Font font1111 = new Font(unicode, 16, Font.BOLD, BaseColor.ORANGE); Font font11111 = new Font(unicode, 14, Font.BOLD, BaseColor.ORANGE); java.awt.Font awtPlainFont = new java.awt.Font("ALGERIAN", java.awt.Font.PLAIN, 10); document.add(new Paragraph(" SMART KIDS CONVENT SCHOOL", font1008)); document.add(new Paragraph( " HEERA NAGAR (GURGAON) ", font1003)); document.add( new Chunk(" SCHOLOR'S REGISTER AND TRANSFER CERTIFICATE", font1005)); document.add(new Paragraph(" ")); document.add(new Paragraph( "----------------------------------------------------------------------------------------------------------------------------------")); document.add(new Paragraph(" ", font111)); Font font41 = new Font(Font.FontFamily.HELVETICA, 9, Font.BOLD, new BaseColor(0, 0, 0)); Font font23 = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD, new BaseColor(92, 64, 51)); Font font1 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD, new BaseColor(0, 0, 0)); Font font11 = new Font(Font.FontFamily.HELVETICA, 12, Font.ITALIC, new BaseColor(148, 0, 211)); Font font31 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD, new BaseColor(990000)); Font font2 = new Font(Font.FontFamily.COURIER, 18, Font.ITALIC | Font.UNDERLINE); Font font3 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD, new BaseColor(255, 255, 200)); document.add(new Paragraph( "Ref No: " + TC16.getText() + " " + new java.util.Date().toString(), FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK))); document.add(new Paragraph(" ")); String ho4 = TC1.getText(); Paragraph p1 = new Paragraph(); p1.add(new Chunk("NAME OF STUDENT :", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK))); p1.add(new Chunk(ho4, font11)); document.add(p1); String ho5 = TC2.getText(); Paragraph p2 = new Paragraph(); p2.add(new Chunk("FATHER'S NAME :", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK))); p2.add(new Chunk(ho5, font11)); document.add(p2); String ho6 = TC3.getText(); Paragraph p93 = new Paragraph(); p93.add(new Chunk("MOTHER'S NAME :", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK))); p93.add(new Chunk(ho6, font11)); document.add(p93); Font font15 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD, new BaseColor(0, 0, 0)); String ho8 = TC1.getText(); String tt = TC4.getText(); Paragraph p4 = new Paragraph(); p4.add(new Chunk("RELIGION :", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK))); p4.add(new Chunk(tt, font11)); document.add(p4); // document.add(new Paragraph(" ",font1003)); String kk = TC5.getText(); Paragraph p5 = new Paragraph(); p5.add(new Chunk("CASTE OF SCHOLOR :", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK))); p5.add(new Chunk(kk, font11)); document.add(p5); String ho10 = TC10.getText(); Paragraph p6 = new Paragraph(); p6.add(new Chunk("ADDRESS :", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK))); p6.add(new Chunk(ho10, font11)); document.add(p6); Paragraph p8 = new Paragraph(); p8.add(new Chunk("DATE OF BIRTH :", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK))); p8.add(new Chunk(TC9.getText(), font11)); document.add(p8); Paragraph p9 = new Paragraph(); p9.add(new Chunk("SECTION :", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK))); p9.add(new Chunk(TC7.getText(), font11)); document.add(p9); Paragraph p10 = new Paragraph(); p10.add(new Chunk("REGISTRATION NO: :", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK))); p10.add(new Chunk(TC8.getText(), font11)); document.add(p10); document.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(8); String vacume = ""; table.addCell("Class"); table.addCell("Date of Admission"); table.addCell("Date of Promotion"); table.addCell("Date of Removal"); table.addCell("Cause of Removal"); table.addCell("Year"); table.addCell("Conduct and Work"); table.addCell("Sign"); PdfPCell cell10 = new PdfPCell(new Paragraph("NURSERY", font100)); table.addCell(cell10); if (TC6.getSelectedIndex() == 0) { PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100)); PdfPCell cell12 = new PdfPCell( new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100)); PdfPCell cell13 = new PdfPCell( new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100)); ; PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100)); PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100)); PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100)); table.addCell(cell11); table.addCell(cell12); table.addCell(cell13); table.addCell(cell14); table.addCell(cell15); table.addCell(cell16); table.addCell(""); } else { for (int i = 0; i < 7; i++) table.addCell(vacume); } PdfPCell cell111 = new PdfPCell(new Paragraph("LKG", font100)); table.addCell(cell111); if (TC6.getSelectedIndex() == 1) { PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100)); PdfPCell cell12 = new PdfPCell( new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100)); PdfPCell cell13 = new PdfPCell( new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100)); ; PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100)); PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100)); PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100)); table.addCell(cell11); table.addCell(cell12); table.addCell(cell13); table.addCell(cell14); table.addCell(cell15); table.addCell(cell16); table.addCell(""); } else { for (int i = 0; i < 7; i++) table.addCell(vacume); } PdfPCell cell1 = new PdfPCell(new Paragraph("UKG", font100)); table.addCell(cell1); if (TC6.getSelectedIndex() == 2) { PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100)); PdfPCell cell12 = new PdfPCell( new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100)); PdfPCell cell13 = new PdfPCell( new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100)); ; PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100)); PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100)); PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100)); table.addCell(cell11); table.addCell(cell12); table.addCell(cell13); table.addCell(cell14); table.addCell(cell15); table.addCell(cell16); table.addCell(""); } else { for (int i = 0; i < 7; i++) table.addCell(vacume); } PdfPCell cell2 = new PdfPCell(new Paragraph("STD-1", font100)); table.addCell(cell2); if (TC6.getSelectedIndex() == 3) { PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100)); PdfPCell cell12 = new PdfPCell( new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100)); PdfPCell cell13 = new PdfPCell( new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100)); ; PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100)); PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100)); PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100)); table.addCell(cell11); table.addCell(cell12); table.addCell(cell13); table.addCell(cell14); table.addCell(cell15); table.addCell(cell16); table.addCell(""); } else { for (int i = 0; i < 7; i++) table.addCell(vacume); } PdfPCell cell3 = new PdfPCell(new Paragraph("STD-2", font100)); table.addCell(cell3); if (TC6.getSelectedIndex() == 4) { PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100)); PdfPCell cell12 = new PdfPCell( new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100)); PdfPCell cell13 = new PdfPCell( new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100)); ; PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100)); PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100)); PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100)); table.addCell(cell11); table.addCell(cell12); table.addCell(cell13); table.addCell(cell14); table.addCell(cell15); table.addCell(cell16); table.addCell(""); } else { for (int i = 0; i < 7; i++) table.addCell(vacume); } PdfPCell cell4 = new PdfPCell(new Paragraph("STD-3", font100)); table.addCell(cell4); if (TC6.getSelectedIndex() == 5) { PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100)); PdfPCell cell12 = new PdfPCell( new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100)); PdfPCell cell13 = new PdfPCell( new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100)); ; PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100)); PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100)); PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100)); table.addCell(cell11); table.addCell(cell12); table.addCell(cell13); table.addCell(cell14); table.addCell(cell15); table.addCell(cell16); table.addCell(""); } else { for (int i = 0; i < 7; i++) table.addCell(vacume); } PdfPCell cell5 = new PdfPCell(new Paragraph("STD-4", font100)); table.addCell(cell5); if (TC6.getSelectedIndex() == 6) { PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100)); PdfPCell cell12 = new PdfPCell( new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100)); PdfPCell cell13 = new PdfPCell( new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100)); ; PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100)); PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100)); PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100)); table.addCell(cell11); table.addCell(cell12); table.addCell(cell13); table.addCell(cell14); table.addCell(cell15); table.addCell(cell16); table.addCell(""); } else { for (int i = 0; i < 7; i++) table.addCell(vacume); } PdfPCell cell6 = new PdfPCell(new Paragraph("STD-5", font100)); table.addCell(cell6); if (TC6.getSelectedIndex() == 7) { PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100)); PdfPCell cell12 = new PdfPCell( new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100)); PdfPCell cell13 = new PdfPCell( new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100)); ; PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100)); PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100)); PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100)); table.addCell(cell11); table.addCell(cell12); table.addCell(cell13); table.addCell(cell14); table.addCell(cell15); table.addCell(cell16); table.addCell(""); } else { for (int i = 0; i < 7; i++) table.addCell(vacume); } PdfPCell cell8 = new PdfPCell(new Paragraph("STD-6", font100)); table.addCell(cell8); if (TC6.getSelectedIndex() == 8) { PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100)); PdfPCell cell12 = new PdfPCell( new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100)); PdfPCell cell13 = new PdfPCell( new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100)); ; PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100)); PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100)); PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100)); table.addCell(cell11); table.addCell(cell12); table.addCell(cell13); table.addCell(cell14); table.addCell(cell15); table.addCell(cell16); table.addCell(""); } else { for (int i = 0; i < 7; i++) table.addCell(vacume); } PdfPCell cell9 = new PdfPCell(new Paragraph("STD-7", font100)); table.addCell(cell9); if (TC6.getSelectedIndex() == 9) { PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100)); PdfPCell cell12 = new PdfPCell( new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100)); PdfPCell cell13 = new PdfPCell( new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100)); ; PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100)); PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100)); PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100)); table.addCell(cell11); table.addCell(cell12); table.addCell(cell13); table.addCell(cell14); table.addCell(cell15); table.addCell(cell16); table.addCell(""); } else { for (int i = 0; i < 7; i++) table.addCell(vacume); } PdfPCell cell18 = new PdfPCell(new Paragraph("STD-8", font100)); table.addCell(cell18); if (TC6.getSelectedIndex() == 2) { PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100)); PdfPCell cell12 = new PdfPCell( new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100)); PdfPCell cell13 = new PdfPCell( new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100)); ; PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100)); PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100)); PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100)); table.addCell(cell11); table.addCell(cell12); table.addCell(cell13); table.addCell(cell14); table.addCell(cell15); table.addCell(cell16); table.addCell(""); } else { for (int i = 0; i < 7; i++) table.addCell(vacume); } float[] ColumnWidths = new float[] { 8f, 12f, 12f, 12f, 22f, 8f, 15f, 7f }; table.setWidths(ColumnWidths); table.setWidthPercentage(106); table.setHorizontalAlignment(Element.ALIGN_LEFT); document.add(table); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph( "1. I certified that the entries as regard details of the student have been duly checked from the 'Admission form' and that they are complete.", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.NORMAL, BaseColor.BLACK))); // document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph( "2. Certified that the above Students register have been posted up-to date of students leaving as required by the departmental rules.", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.NORMAL, BaseColor.BLACK))); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph( "Prepared by:-" + " " + "Date:-" + " " + new java.util.Date().toString() + " " + "Principal's Sign:-", FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.NORMAL, BaseColor.BLACK))); document.add(new Paragraph(" ")); document.add(new Paragraph( "----------------------------------------------------------------------------------------------------------------------------------")); document.add(new Paragraph("An ISO 9001:2008 Certified School(Certificate Number:NOR/0712M/1505)", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLUE))); document.add(new Paragraph("(Run By:Smart Educational Society)Regd.No.(DR/GGN/285)", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLUE))); document.add(new Paragraph( "413A/23,Gali No:-2,Heera Nagar,Near Rajendra Hospital,Khandsa Road,Gurgaon(Haryana)", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLUE))); cb.saveState(); cb.setColorStroke(BaseColor.BLACK); cb.rectangle(2, 2, 588, 828); cb.stroke(); cb.restoreState(); JOptionPane.showMessageDialog(this, "it is saved"); document.close(); } catch (Exception ee) { JOptionPane.showMessageDialog(this, ee); } // TODO add your handling code here: }