List of usage examples for com.itextpdf.text Paragraph setAlignment
public void setAlignment(int alignment)
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private void insertCellProtocol(PdfPTable table, LicensePFEntity license) { this.insertHeaderCell(table, "6- CONTROLE DE RECEBIMENTO DO PROCESSO", 4); Paragraph officialPhrase = new Paragraph("USO OFICIAL" + SEPARATOR, FONT_PARAGRAPH); officialPhrase.setAlignment(Element.ALIGN_LEFT); Paragraph protocolPhrase = new Paragraph("ETIQUETA PROTOCOLO" + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE, FONT_PROTOCOL);//ww w. ja v a 2s . c o m protocolPhrase.setAlignment(Element.ALIGN_LEFT); Paragraph obsPhrase = new Paragraph(SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + "Observao Importante!" + SEPARATOR, FONT_HEADER); Paragraph obsStringPhrase = new Paragraph("- Etiqueta com data e assinatura." + SEPARATOR + "- Renovao: verificar a data de vencimento da licena." + SEPARATOR + "- Alterao Cadastral: apresentar o Anexo VI." + SEPARATOR_DOUBLE, FONT_PARAGRAPH); Paragraph phraseProtocol = new Paragraph(); phraseProtocol.add(officialPhrase); phraseProtocol.add(protocolPhrase); Paragraph phraseObs = new Paragraph(); phraseObs.add(obsPhrase); phraseObs.add(obsStringPhrase); PdfPCell cellProtocol = new PdfPCell(phraseProtocol); cellProtocol.setColspan(2); cellProtocol.disableBorderSide(Rectangle.RIGHT); PdfPCell cellObs = new PdfPCell(phraseObs); cellObs.setColspan(2); cellObs.disableBorderSide(Rectangle.LEFT); table.addCell(cellProtocol); table.addCell(cellObs); }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private Paragraph createHeader() { Paragraph anexo = new Paragraph("ANEXO IV" + SEPARATOR + "REQUERIMENTO - HABILITAO DE PESSOA JUR?DICA", FONT_BIG_HEADER_BOLD);//from w ww.j a v a 2 s .c o m anexo.setAlignment(Element.ALIGN_CENTER); Paragraph law = new Paragraph("( Lei n 10.357, de 27 de dezembro de 2001)" + SEPARATOR_DOUBLE, FONT_BIG_HEADER); law.setAlignment(Element.ALIGN_CENTER); Paragraph full = new Paragraph(); full.add(anexo); full.add(law); return full; }
From source file:com.solidmaps.webapp.report.LicenseCivilIncludeProductPDF.java
License:Open Source License
private void createParagraph(Document doc, LicensePCEntity license, String type, List<LicensePCProductEntity> listProducts) throws DocumentException { StringBuilder sbParagraph = new StringBuilder().append("A sociedade empresria ") .append(license.getCompany().getName()).append(", estabelecida em ") .append(license.getCompany().getStreet()).append(", com ramo de ") .append(license.getCompany().getCodCnae()).append(", telefone ") .append(license.getCompany().getPhoneNumber()).append(", fax ") .append(license.getCompany().getFaxNumber()).append(", e-mail: ") .append(license.getCompany().getUserResponsable().getEmail()).append(" e CEP ") .append(license.getCompany().getCep()).append(", com CNPJ N") .append(license.getCompany().getCnpjFormatted()).append("e inscrio Estadual N") .append(license.getCompany().getNumInscription()).append(", atravs de seu ") .append(license.getCompany().getUserResponsable().getOffice()).append(", Sr. ") .append(license.getCompany().getUserResponsable().getName()) .append(", vem respeitosamente requerer de V. Ex. a ALTERAO de seu:") .append(WINDOWS_LINE_SEPARATOR) .append("Certificado de Vistoria para Produtos Controlados, fixando-se sua capacidade nos seguintes limites mximos ") .append("de estoque: (Conforme relao em Anexo)").append(WINDOWS_LINE_SEPARATOR) .append("De acordo com o Decreto No 6.911 de 10 de Janeiro de 1935."); StringBuilder sbTerms = new StringBuilder().append("Nestes termos").append(WINDOWS_LINE_SEPARATOR) .append(" Pede deferimento."); StringBuilder sbDate = new StringBuilder().append(license.getCompany().getCity()).append("/") .append(license.getCompany().getState()).append(", ") .append(DateUtils.format(Calendar.getInstance())); StringBuilder sbSignature = new StringBuilder().append("____________________________________________") .append(WINDOWS_LINE_SEPARATOR).append("Nome: ") .append(license.getCompany().getUserResponsable().getName()).append(WINDOWS_LINE_SEPARATOR) .append("Cargo: ").append(license.getCompany().getUserResponsable().getOffice()) .append(WINDOWS_LINE_SEPARATOR).append("RG: ") .append(license.getCompany().getUserResponsable().getRg()).append(WINDOWS_LINE_SEPARATOR) .append("CPF: ").append(license.getCompany().getUserResponsable().getCpf()); // Header/* w w w. j av a 2 s .c o m*/ Paragraph paragraphHeader = new Paragraph("DEPARTAMENTO DE IDENTIFICAO E REGISTROS DIVERSOS DIRD " + "DIVISO DE PRODUTOS CONTROLADOS DPC"); paragraphHeader.setFont(FONT_HEADER); paragraphHeader.setAlignment(Element.ALIGN_CENTER); // Texto da Empresa Paragraph paragraphCompany = new Paragraph(sbParagraph.toString()); paragraphCompany.setFont(FONT_PARAGRAPH); Paragraph paragraphTerms = new Paragraph(sbTerms.toString()); paragraphTerms.setFont(FONT_PARAGRAPH); paragraphTerms.setAlignment(Element.ALIGN_CENTER); Paragraph paragraphDate = new Paragraph(sbDate.toString()); paragraphDate.setFont(FONT_PARAGRAPH); Paragraph paragraphSignature = new Paragraph(sbSignature.toString()); paragraphSignature.setFont(FONT_PARAGRAPH); paragraphSignature.setAlignment(Element.ALIGN_CENTER); doc.add(paragraphHeader); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(paragraphCompany); doc.add(Chunk.NEWLINE); doc.add(paragraphTerms); doc.add(Chunk.NEWLINE); doc.add(paragraphDate); doc.add(Chunk.NEWLINE); doc.add(paragraphSignature); doc.add(Chunk.NEWLINE); this.generateProducts(doc, listProducts); }
From source file:com.solidmaps.webapp.report.RenovationRequireExercitoPDF.java
private void createParagraph(Document doc, LicenseEXEntity license) throws DocumentException { StringBuilder sbHeader = new StringBuilder().append("Exmo Sr Comandante da ") .append(license.getCompany().getRegion()).append(" Regio Militar"); StringBuilder sbParagraph = new StringBuilder().append(license.getCompany().getName()) .append(", estabelecida em ").append(license.getCompany().getCity()).append("/") .append(license.getCompany().getState()).append(", ").append(license.getCompany().getStreet()) .append(", telefone n ").append(license.getCompany().getUserResponsable().getPhoneDDD()) .append(" ").append(license.getCompany().getUserResponsable().getPhoneNumber()) .append(", representada, neste ato, por seu proprietrio (scio ou diretor, etc.), ") .append(license.getCompany().getUserResponsable().getName()).append(", ") .append(license.getCompany().getUserResponsable().getCountry()).append(", ") .append(license.getCompany().getUserResponsable().getMaritalStatus()).append(", ") .append(license.getCompany().getUserResponsable().getOffice()).append(", ") .append(" (domiciliado ) ").append(license.getCompany().getUserResponsable().getStreet()) .append(", vem, pelo presente, requerer V Exa. (concesso ou revalidao) do Certificado de Registro n ") .append(license.getNumRegister()) .append(", de acordo com o art. 84 do Regulamento para a Fiscalizao de ") .append("Produtos Controlados (R-105), para importar, comerciar (ou manipular, utilizar industrialmente, ou o que for) ") .append("com armas, munies, plvora para caa (ou explosivos, produtos qumicos controlados), durante o trinio ") .append(DateUtils.format(license.getDateExpiration())).append(" - ") .append(DateUtils.format(DateUtils.addYear(license.getDateExpiration(), 3))); // Anexo// w w w .ja va 2 s . c o m Paragraph paragraphHeaderAnexo = new Paragraph("ANEXO XVI"); paragraphHeaderAnexo.setFont(FONT_HEADER); paragraphHeaderAnexo.setAlignment(Element.ALIGN_CENTER); // Texto cabealho Paragraph paragraphHeaderText = new Paragraph( "REQUERIMENTO PARA CONCESSO E REVALIDAO DE CERTIFICADO DE REGISTRO"); paragraphHeaderText.setFont(FONT_HEADER); paragraphHeaderText.setAlignment(Element.ALIGN_CENTER); // Texto Comandante Paragraph paragraphComand = new Paragraph(sbHeader.toString()); paragraphComand.setFont(FONT_PARAGRAPH); // Texto impresso Paragraph paragraphPrint = new Paragraph("(Impresso em papel liso com 16 espaos simples)"); paragraphPrint.setFont(FONT_PARAGRAPH); // Texto da Empresa Paragraph paragraphCompany = new Paragraph(sbParagraph.toString()); paragraphCompany.setFont(FONT_PARAGRAPH); // Texto Footer Paragraph paragraphFooter = new Paragraph("Nestes termos, pede deferimento"); paragraphCompany.setFont(FONT_PARAGRAPH); // Texto data Paragraph paragraphDate = new Paragraph(DateUtils.format(Calendar.getInstance())); paragraphDate.setFont(FONT_PARAGRAPH); doc.add(paragraphHeaderAnexo); doc.add(Chunk.NEWLINE); doc.add(paragraphHeaderText); doc.add(Chunk.NEWLINE); doc.add(paragraphComand); doc.add(Chunk.NEWLINE); doc.add(paragraphPrint); doc.add(Chunk.NEWLINE); doc.add(paragraphCompany); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(paragraphFooter); doc.add(Chunk.NEWLINE); doc.add(paragraphDate); doc.add(Chunk.NEWLINE); }
From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseExercitoPDF.java
private void createParagraph(Document doc, LicenseEXEntity license) throws DocumentException { StringBuilder sbHeader = new StringBuilder().append("Exmo Sr Comandante da ") .append(license.getCompany().getRegion()).append(" Regio Militar"); StringBuilder sbParagraph = new StringBuilder().append(license.getCompany().getName().toUpperCase()) .append(", incrita sob o CNPJ n ").append(license.getCompany().getCnpj()) .append(", estabelecida na cidade de ").append(license.getCompany().getCity().toUpperCase()) .append("/").append(license.getCompany().getState()).append(", ") .append(license.getCompany().getStreet()).append(", CEP ").append(license.getCompany().getCep()) .append(", email: ").append(license.getUserResponsable().getEmail()).append(", fone/fax ") .append(license.getUserResponsable().getPhoneDDD()).append(" ") .append(license.getUserResponsable().getPhoneNumber()).append(" representada neste ato por seu ") .append(license.getCompany().getUserResponsable().getOffice()).append(", Sr ") .append(license.getCompany().getUserResponsable().getName()).append(", inscrito sob o CPF: ") .append(license.getCompany().getUserResponsable().getCpf()) .append(", portador da cdula de identidade (RG): ") .append(license.getCompany().getUserResponsable().getRg()).append(", de nacionalidade ") .append(license.getCompany().getUserResponsable().getCountry()).append(", estado civil ") .append(license.getCompany().getUserResponsable().getMaritalStatus()) .append(" profisso Engenheiro Qumico, domiciliado a ") .append(license.getCompany().getUserResponsable().getStreet()) .append(license.getCompany().getUserResponsable().getStreet()).append(" CEP ") .append(license.getCompany().getUserResponsable().getCep()); if (license.getCompany().getProcuratorEntity() != null) { sbParagraph.append(" e seus procuradores, conforme procurao anexo, Sr ") .append(license.getCompany().getProcuratorEntity().getName()).append(" inscrito sob o CPF n: ") .append(license.getCompany().getProcuratorEntity().getCpf()) .append(" portador da cdula de identidade (RG) n: ") .append(license.getCompany().getProcuratorEntity().getRg()).append(" ") .append(license.getCompany().getProcuratorEntity().getRgExpeditionCity()); }/*from www. ja v a2 s.c o m*/ sbParagraph.append(", vem pelo presente, requerer V Ex.a "); // Texto cabealho Paragraph paragraphHeaderText = new Paragraph( "REQUERIMENTO PARA APOSTILAMENTO DE CERTIFICADO DE REGISTRO - PJ"); paragraphHeaderText.setFont(FONT_HEADER); paragraphHeaderText.setAlignment(Element.ALIGN_CENTER); // Texto Comandante Paragraph paragraphComand = new Paragraph(sbHeader.toString()); paragraphComand.setFont(FONT_PARAGRAPH); // Texto da Empresa Paragraph paragraphCompany = new Paragraph(sbParagraph.toString()); paragraphCompany.setFont(FONT_PARAGRAPH); doc.add(paragraphHeaderText); doc.add(Chunk.NEWLINE); doc.add(paragraphComand); doc.add(Chunk.NEWLINE); doc.add(paragraphCompany); doc.add(Chunk.NEWLINE); }
From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseExercitoPDF.java
private void createSignature(Document doc, LicenseEXEntity license) throws DocumentException { StringBuilder sbTerms = new StringBuilder().append("Nestes termos").append(WINDOWS_LINE_SEPARATOR) .append(" Pede deferimento."); StringBuilder sbDate = new StringBuilder().append(license.getCompany().getCity()).append("/") .append(license.getCompany().getState()).append(", ") .append(DateUtils.format(Calendar.getInstance())); StringBuilder sbSignature = new StringBuilder().append("____________________________________________") .append(WINDOWS_LINE_SEPARATOR).append(license.getCompany().getName()) .append(WINDOWS_LINE_SEPARATOR).append(license.getCompany().getUserResponsable().getName()) .append(" - ").append(license.getCompany().getUserResponsable().getOffice()); Paragraph paragraphTerms = new Paragraph(sbTerms.toString()); paragraphTerms.setFont(FONT_PARAGRAPH); paragraphTerms.setAlignment(Element.ALIGN_CENTER); Paragraph paragraphDate = new Paragraph(sbDate.toString()); paragraphDate.setFont(FONT_PARAGRAPH); Paragraph paragraphSignature = new Paragraph(sbSignature.toString()); paragraphSignature.setFont(FONT_PARAGRAPH); paragraphSignature.setAlignment(Element.ALIGN_CENTER); doc.add(Chunk.NEWLINE);//from w w w . j a v a 2 s . c om doc.add(paragraphTerms); doc.add(Chunk.NEWLINE); doc.add(paragraphDate); doc.add(Chunk.NEWLINE); doc.add(Chunk.NEWLINE); doc.add(paragraphSignature); doc.add(Chunk.NEWLINE); }
From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseFederalPDF.java
private void insertCellProtocol(PdfPTable table, LicensePFEntity license) { PdfPTable tableProtocol = new PdfPTable(1); tableProtocol.setWidthPercentage(100f); Paragraph officialPhrase = new Paragraph("USO OFICIAL" + SEPARATOR, FONT_PARAGRAPH); officialPhrase.setAlignment(Element.ALIGN_LEFT); Paragraph protocolPhrase = new Paragraph("ETIQUETA PROTOCOLO" + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + SEPARATOR, FONT_PROTOCOL); protocolPhrase.setAlignment(Element.ALIGN_LEFT); Paragraph obsPhrase = new Paragraph("Observao Importante!" + SEPARATOR, FONT_HEADER); Paragraph obsStringPhrase = new Paragraph( "Protocolar este Anexo somente quando no conjugado com a alterao efetiva ou a renovao da licena.", FONT_PARAGRAPH);//from w ww. j a v a 2 s.c o m Paragraph fullPhrase = new Paragraph(); fullPhrase.add(officialPhrase); fullPhrase.add(protocolPhrase); fullPhrase.add(obsPhrase); fullPhrase.add(obsStringPhrase); PdfPCell cell = new PdfPCell(fullPhrase); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPadding(5f); tableProtocol.addCell(cell); PdfPCell cellProtocol = new PdfPCell(tableProtocol); cellProtocol.setColspan(2); table.addCell(cellProtocol); table.addCell(this.createCellEtiqueta(license)); }
From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseFederalPDF.java
private Paragraph createHeader() { Paragraph anexo = new Paragraph("ANEXO VI" + SEPARATOR + "COMUNICADO DE ALTERAO CADASTRAL", FONT_BIG_HEADER_BOLD);// w ww . j a v a 2 s . c o m anexo.setAlignment(Element.ALIGN_CENTER); Paragraph law = new Paragraph("( Lei n 10.357, de 27 de dezembro de 2001)" + SEPARATOR_DOUBLE, FONT_BIG_HEADER); law.setAlignment(Element.ALIGN_CENTER); Paragraph full = new Paragraph(); full.add(anexo); full.add(law); return full; }
From source file:com.swayam.bhasha.engine.io.writers.impl.PDFGenerator.java
License:Apache License
private Paragraph getParagraph(Para para) throws DocumentException, IOException, DocGenerationException { int align = para.getAlignment(); int pdfAlign; switch (align) { case Para.CENTER: pdfAlign = Paragraph.ALIGN_CENTER; break;// www .j a va2 s .co m case Para.RIGHT: pdfAlign = Paragraph.ALIGN_RIGHT; break; case Para.JUSTIFIED: pdfAlign = Paragraph.ALIGN_JUSTIFIED; break; case Para.LEFT: default: pdfAlign = Paragraph.ALIGN_LEFT; break; } List<ParaText> paraTextList = para.getParaTextList(); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(pdfAlign); for (ParaText paraText : paraTextList) { int fontStyle = Font.NORMAL; if (paraText.isBold()) { fontStyle |= Font.BOLD; } if (paraText.isUnderline()) { fontStyle |= Font.UNDERLINE; } if (paraText.isItalic()) { fontStyle |= Font.ITALIC; } Font font = FontFactory.getFont(paraText.getFontFamily(), BaseFont.IDENTITY_H, BaseFont.EMBEDDED, paraText.getFontSize(), fontStyle, new BaseColor(paraText.getColor().getRGB())); // its very important to set the leading every time the font is set // otherwise, the chunks/phrases overlap. // paragraph.setLeading(font.getSize() * 1.5f); paragraph.add(new Phrase(paraText.getText(), font)); } return paragraph; }
From source file:com.systemevent.jsfclass.util.PdfEvento.java
public void imprimirPdf(Evento events) { Evento event = events;//from w ww. j a v a 2s .c o m //buscarPDF(n); try { //Generamos el archivo PDF String directorioArchivos; ServletContext ctx = (ServletContext) FacesContext.getCurrentInstance().getExternalContext() .getContext(); directorioArchivos = ctx.getRealPath("\'") + "reports"; String name = directorioArchivos + "\'document-report.pdf"; //String name="C:\\Users\\Jose_Gascon\\Documents\\NetBeansProjects\\SystemEvent\\target\\SystemEvent-1.0-SNAPSHOT\\reports\\document-report.pdf"; Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(name)); FormatoPDF encabezado = new FormatoPDF(""); Paragraph parrafo, datos, datos1; int i; // indicamos que objecto manejara los eventos al escribir el Pdf writer.setPageEvent(encabezado); document.open(); document.addAuthor("Erick Ramirez"); document.addTitle("Reporte"); //Creamos una cantidad significativa de paginas para probar el encabezado //for (i = 0; i < 4; i++) { parrafo = new Paragraph("Presupuesto de Evento"); parrafo.setAlignment(Element.ALIGN_CENTER); document.add(parrafo); // document.newPage(); //} datos = new Paragraph("Ubicacion: " + event.getUbicacion()); datos1 = new Paragraph("Pais: " + event.getCodigoPais().getNombre()); datos.setAlignment(Element.ALIGN_RIGHT); datos1.setAlignment(Element.ALIGN_RIGHT); document.add(datos1); document.add(datos); document.add(new Paragraph("")); document.add(new Paragraph("")); document.add(new Paragraph("")); document.add(new Paragraph("")); // PdfPTable table = new PdfPTable(2); // // table.addCell("Cliente: "); // table.addCell(event.getIdCliente().getNombre()); // // table.addCell("Descripcion del Evento: "); // table.addCell(event.getDescripcion()); // // document.add(table); document.add(Tabla_compleja()); document.close(); //---------------------------- //Abrimos el archivo PDF FacesContext context = FacesContext.getCurrentInstance(); HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); response.setContentType("application/pdf"); response.setHeader("Content-disposition", "inline=filename=" + name); try { response.getOutputStream().write(Util.getBytesFromFile(new File(name))); response.getOutputStream().flush(); response.getOutputStream().close(); context.responseComplete(); } catch (IOException e) { e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); } }