List of usage examples for com.itextpdf.text PageSize A3
Rectangle A3
To view the source code for com.itextpdf.text PageSize A3.
Click Source Link
From source file:br.com.ifrn.panfleto.gui.PainelCadastrar.java
public Rectangle tamanhoDaPagina() { if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A0")) { return new Rectangle(PageSize.A0); } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A1")) { return new Rectangle(PageSize.A1); } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A2")) { return new Rectangle(PageSize.A2); } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A3")) { return new Rectangle(PageSize.A3); } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A4")) { return new Rectangle(PageSize.A4); } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("A5")) { return new Rectangle(PageSize.A5); } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B0")) { return new Rectangle(PageSize.B0); } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B1")) { return new Rectangle(PageSize.B1); } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B2")) { return new Rectangle(PageSize.B2); } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B3")) { return new Rectangle(PageSize.B3); } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B4")) { return new Rectangle(PageSize.B4); } else if (comboxSelecionarTamanhoPaginaPainelGerarPdf.getSelectedItem().equals("B5")) { return new Rectangle(PageSize.B5); }//from w w w. j ava 2s.c o m //caso erro, retorna o tamanho a4 como padrao return new Rectangle(PageSize.A4); }
From source file:bussiness.ReportHandler.java
public void BuildVeterinaryPrescription(String clientName, String petName, List<Medicine> medicines, String comments, Double totalCost) { try {//from w w w . j av a 2 s .co m Document veterinaryPrescription = new Document(PageSize.A3.rotate()); //Tal vez agregar la fecha al nombre de la receta FileOutputStream fileOutputStream = new FileOutputStream("prescription.pdf"); PdfWriter.getInstance(veterinaryPrescription, fileOutputStream).setInitialLeading(20); Image logo = Image.getInstance("logo2.png"); Image division = Image.getInstance("linea.png"); veterinaryPrescription.open(); division.setAbsolutePosition(20f, 600f); veterinaryPrescription.add(division); logo.setAbsolutePosition(400, 50f); veterinaryPrescription.add(logo); //Encabezado BuildHeaderPrescription(veterinaryPrescription, clientName, petName); //Cuerpo veterinaryPrescription.add(new Chunk("\n")); veterinaryPrescription.add(new Chunk("\n")); veterinaryPrescription.add(new Chunk("\n")); PdfPTable table = new PdfPTable(3); table.getDefaultCell().setBorder(PdfPCell.NO_BORDER); table.getDefaultCell().setPaddingLeft(60); BuildBodyPrescription(medicines, veterinaryPrescription, totalCost, table); BuildFooterPrescription(veterinaryPrescription, comments); veterinaryPrescription.close(); } catch (Exception e) { System.err.println("Ocurrio un error: " + e); System.exit(-1); } }
From source file:com.base2.kagura.core.ExportHandler.java
License:Apache License
/** * Takes the output and transforms it into a PDF file. * @param out Output stream.// ww w. j a v a 2 s . c o m * @param rows Rows of data from reporting-core * @param columns Columns to list on report */ public void generatePdf(OutputStream out, List<Map<String, Object>> rows, List<ColumnDef> columns) { try { Document document = new Document(); PdfWriter.getInstance(document, out); if (columns == null) { if (rows.size() > 0) return; columns = new ArrayList<ColumnDef>(CollectionUtils.collect(rows.get(0).keySet(), new Transformer() { @Override public Object transform(final Object input) { return new ColumnDef() { { setName((String) input); } }; } })); } if (columns.size() > 14) document.setPageSize(PageSize.A1); else if (columns.size() > 10) document.setPageSize(PageSize.A2); else if (columns.size() > 7) document.setPageSize(PageSize.A3); else document.setPageSize(PageSize.A4); document.open(); Font font = FontFactory.getFont(FontFactory.COURIER, 8, Font.NORMAL, BaseColor.BLACK); Font headerFont = FontFactory.getFont(FontFactory.COURIER, 8, Font.BOLD, BaseColor.BLACK); int size = columns.size(); PdfPTable table = new PdfPTable(size); for (ColumnDef column : columns) { PdfPCell c1 = new PdfPCell(new Phrase(column.getName(), headerFont)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); } table.setHeaderRows(1); if (rows != null) for (Map<String, Object> row : rows) { for (ColumnDef column : columns) { table.addCell(new Phrase(String.valueOf(row.get(column.getName())), font)); } } document.add(table); document.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.incosyz.sms.pdfcontroller.SalePdf.java
public String createPdf(String pathTo) throws FileNotFoundException, DocumentException, IOException { String html = getHtml();/*w w w. java 2s . c o m*/ Document document = new Document(PageSize.A3.rotate()); String path = pathTo; f = new File(path); FileOutputStream fileOutputStream = new FileOutputStream(f); PdfWriter pdfWriter = PdfWriter.getInstance(document, fileOutputStream); document.open(); StringReader fileReader = new StringReader(html); XMLWorkerHelper.getInstance().parseXHtml(pdfWriter, document, fileReader); document.close(); fileOutputStream.close(); return path; }
From source file:com.primeleaf.krystal.web.action.console.OpenDocumentClassAction.java
License:Open Source License
private File generatePdfFile(ArrayList<Hit> hits, ArrayList<IndexDefinition> indexes, User loggedInUser) throws Exception { File tempPdf = File.createTempFile("tempPdf", ".pdf"); FileOutputStream file = new FileOutputStream(tempPdf); Document document = new Document(PageSize.A3.rotate()); PdfWriter.getInstance(document, file); document.open();//w w w . j av a2 s . c om Font boldFont12 = new Font(FontFamily.HELVETICA, 12, Font.BOLD); Font normalFont10 = new Font(FontFamily.HELVETICA, 10, Font.NORMAL); int colCount = 9; //predefined columns count int colSize = indexes.size() + colCount; float[] columnWidths = new float[colSize]; for (int i = 0; i < columnWidths.length; i++) { columnWidths[i] = (100 / colSize); } PdfPTable table = new PdfPTable(columnWidths); table.setWidthPercentage(100f); if (hits.size() > 0) { BaseColor bgColor = new BaseColor(225, 240, 255); insertCellPDF(table, "Document ID", Element.ALIGN_CENTER, 1, boldFont12, bgColor); insertCellPDF(table, "Revision ID", Element.ALIGN_CENTER, 1, boldFont12, bgColor); insertCellPDF(table, "Created By", Element.ALIGN_CENTER, 1, boldFont12, bgColor); insertCellPDF(table, "Last Modified By", Element.ALIGN_CENTER, 1, boldFont12, bgColor); insertCellPDF(table, "File Size", Element.ALIGN_CENTER, 1, boldFont12, bgColor); insertCellPDF(table, "Created On", Element.ALIGN_CENTER, 1, boldFont12, bgColor); insertCellPDF(table, "Last Modified On", Element.ALIGN_CENTER, 1, boldFont12, bgColor); insertCellPDF(table, "Expiry On", Element.ALIGN_CENTER, 1, boldFont12, bgColor); for (IndexDefinition index : indexes) { insertCellPDF(table, index.getIndexDisplayName(), Element.ALIGN_CENTER, 1, boldFont12, bgColor); } insertCellPDF(table, "Note", Element.ALIGN_CENTER, 1, boldFont12, bgColor); int count = 0; for (Hit hit : hits) { count++; if (count % 2 == 0) { bgColor = new BaseColor(240, 240, 240); } else { bgColor = new BaseColor(210, 210, 210); } insertCellPDF(table, hit.documentId + "", Element.ALIGN_CENTER, 1, normalFont10, bgColor); insertCellPDF(table, hit.revisionId, Element.ALIGN_CENTER, 1, normalFont10, bgColor); insertCellPDF(table, hit.createdBy, Element.ALIGN_CENTER, 1, normalFont10, bgColor); insertCellPDF(table, hit.modifiedBy + "", Element.ALIGN_CENTER, 1, normalFont10, bgColor); insertCellPDF(table, StringHelper.formatSizeText(hit.fileLength), Element.ALIGN_CENTER, 1, normalFont10, bgColor); insertCellPDF(table, hit.created, Element.ALIGN_CENTER, 1, normalFont10, bgColor); insertCellPDF(table, hit.modified, Element.ALIGN_CENTER, 1, normalFont10, bgColor); insertCellPDF(table, hit.expiryOn, Element.ALIGN_CENTER, 1, normalFont10, bgColor); for (String index : hit.indexValues) { insertCellPDF(table, index, Element.ALIGN_LEFT, 1, normalFont10, bgColor); } ArrayList<DocumentNote> documentNotes = DocumentNoteDAO.getInstance() .readJournalNotes("DOCUMENTID=" + hit.documentId + " AND ACTIVE ='Y' ORDER BY 1 DESC"); String notesData = ""; if (documentNotes.size() > 0) { for (DocumentNote documentNote : documentNotes) { if (!"P".equalsIgnoreCase(documentNote.getNoteType())) { if (!loggedInUser.getUserName().equalsIgnoreCase(documentNote.getUserName())) { continue; } } User user = UserDAO.getInstance().readUserByName(documentNote.getUserName()); notesData += documentNote.getNoteData() + "\n"; notesData += "Posted By" + " : " + user.getRealName() + "\n"; notesData += "Posted On" + " : " + StringHelper.formatDate(documentNote.getCreated()); notesData += "\n"; } } insertCellPDF(table, notesData, Element.ALIGN_LEFT, 1, normalFont10, bgColor); } } try { document.add(table); document.close(); file.close(); } catch (Exception e) { e.printStackTrace(); } return tempPdf; }
From source file:com.wabacus.config.dataexport.PDFExportBean.java
License:Open Source License
public void loadConfig(XmlElementBean eleDataExport) { super.loadConfig(eleDataExport); if (this.isPrint) { pdftemplate = eleDataExport.getContent(); } else {/* ww w .jav a 2s .c o m*/ pdftemplate = eleDataExport.attributeValue("template"); } if (pdftemplate != null) pdftemplate = pdftemplate.trim(); String strpagesize = eleDataExport.attributeValue("pagesize"); if (strpagesize != null && !strpagesize.trim().equals("")) { this.pagesize = Integer.parseInt(strpagesize); } String pdfpagesize = eleDataExport.attributeValue("printpagesize"); if (pdfpagesize == null || pdfpagesize.trim().equals("")) pdfpagesize = "A3"; try { pdfpagesizeObj = (Rectangle) PageSize.class.getDeclaredField(pdfpagesize).get(null); if (pdfpagesizeObj == null) { pdfpagesizeObj = PageSize.A3; } } catch (Exception e) { throw new WabacusConfigLoadingException("" + this.owner.getPath() + "??pagesize" + pdfpagesize + "??", e); } String strwidth = eleDataExport.attributeValue("width"); if (strwidth != null && !strwidth.trim().equals("")) { width = Float.parseFloat(strwidth); } String fullpagesplit = eleDataExport.attributeValue("fullpagesplit"); if (fullpagesplit != null && !fullpagesplit.trim().equals("")) { this.fullpagesplit = !fullpagesplit.toLowerCase().trim().equals("false"); } else { this.fullpagesplit = true; } String titlefontsize = eleDataExport.attributeValue("titlefontsize"); if (titlefontsize != null && !titlefontsize.trim().equals("")) this.titlefontsize = Integer.parseInt(titlefontsize); String dataheaderfontsize = eleDataExport.attributeValue("dataheaderfontsize"); if (dataheaderfontsize != null && !dataheaderfontsize.trim().equals("")) this.dataheaderfontsize = Integer.parseInt(dataheaderfontsize); String datafontsize = eleDataExport.attributeValue("datafontsize"); if (datafontsize != null && !datafontsize.trim().equals("")) this.datafontsize = Integer.parseInt(datafontsize); String interceptor = eleDataExport.attributeValue("interceptor"); if (interceptor != null) { interceptor = interceptor.trim(); if (interceptor.equals("")) { this.interceptorObj = null; } else { Object objTmp = null; try { objTmp = ConfigLoadManager.currentDynClassLoader.loadClassByCurrentLoader(interceptor) .newInstance(); } catch (Exception e) { throw new WabacusConfigLoadingException("" + this.owner.getPath() + "?PDF" + interceptor + "", e); } if (!(objTmp instanceof AbsPdfInterceptor)) { throw new WabacusConfigLoadingException("" + this.owner.getPath() + "?PDF" + interceptor + "" + AbsPdfInterceptor.class.getName()); } this.interceptorObj = (AbsPdfInterceptor) objTmp; } } }
From source file:Export.TableOfSalary.java
public static void ciarDoc(String user, String idProcesso, String data) { FileOutputStream outputStraem; try {/*from ww w . j a v a2s.c o m*/ Font fontCabecalhoN = FontFactory.getFont(ConfigDoc.Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 9f); Font fontCorpo = FontFactory.getFont(ConfigDoc.Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 6f); Font fontCorpoN = FontFactory.getFont(ConfigDoc.Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 7f); Font fontCabecalhoNG = FontFactory.getFont(ConfigDoc.Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 16f, Font.UNDERLINE); SimpleDateFormat sdf1 = new SimpleDateFormat("dd-MM-yyyy hh'.'mm'.'ss"); File ff = new File(ConfigDoc.Fontes.getDiretorio() + "/" + user + "/Relatorio"); ff.mkdirs(); String Ddata = sdf1.format(new Date()); ff = new File(ff.getAbsoluteFile() + "/" + "Tabela de Salrio " + Ddata + ".pdf"); outputStraem = new FileOutputStream(ff); String reString = "../Documentos/" + user + "/Relatorio/Tabela de Salrio " + Ddata + ".pdf"; PdfPTable pTableEmpresaPricipal = new PdfPTable(new float[] { 7f, 93f }); PdfPTable pTableEmpresaInforImpres1 = 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(ConfigDoc.Empresa.NOME, fontCabecalhoNG)); pCellNomeEmpresa.setBorder(0); PdfPCell pCellNomeEndereco = new PdfPCell(new Phrase(ConfigDoc.Empresa.ENDERECO, fontCabecalhoN)); pCellNomeEndereco.setBorder(0); PdfPCell pCellCaixaPostal = new PdfPCell(new Phrase(ConfigDoc.Empresa.CAIXAPOSTAL, fontCabecalhoN)); pCellCaixaPostal.setBorder(0); PdfPCell pCellTeleFax = new PdfPCell( new Phrase(ConfigDoc.Empresa.TELEFAX + " " + ConfigDoc.Empresa.EMAIL, fontCabecalhoN)); pCellTeleFax.setBorder(0); PdfPCell pCellSociedade = new PdfPCell(new Phrase(ConfigDoc.Empresa.SOCIEDADE, fontCabecalhoN)); pCellSociedade.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); 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.setWidthPercentage(97); pTableEmpresaPricipal.addCell(cellTabela6); pTableEmpresaPricipal.addCell(cellTabela5); Document documento = new Document(PageSize.A3.rotate()); PdfWriter writer = PdfWriter.getInstance(documento, outputStraem); PdfPTable pTableDados = new PdfPTable(new float[] { 2.5f, 7.5f, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }); pTableDados.setWidthPercentage(105); /** * primeira linha de titulo inicio */ PdfPCell cellDados; Paragraph pTitile = new Paragraph(); // SimpleDateFormat sdfPT = new SimpleDateFormat("MMMM yyyy",new Locale("pt", "BR")); pTitile.add(new Paragraph(ConfigDoc.Empresa.NOME + "\n" + "TABELA SAL?RIO REFERENTE A " + data, fontCorpoN)); cellDados = new PdfPCell(pTitile); cellDados.setColspan(10); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("F\nSOC. SEGU. 4%", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("G", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("H", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("I", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("IMPOSTO\n18% : 20%", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); for (int j = 0; j < 8; j++) { cellDados = new PdfPCell(new Phrase(" ", fontCorpo)); pTableDados.addCell(cellDados); } cellDados = new PdfPCell(new Phrase("6\nSOC. SEGU.", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(" ", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableDados.addCell(cellDados); /** * primeira linha de titulo Fim */ /** * Segunda linha de titulo Inicio */ for (int j = 0; j < 3; j++) { cellDados = new PdfPCell(new Phrase(" ", fontCorpo)); pTableDados.addCell(cellDados); } cellDados = new PdfPCell(new Phrase("A", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("B", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("C", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("D", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("E", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("SUBSIDIO DE", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("VALOR A SER", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("F=(E*4%)", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("G=(E-F)", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(" ", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("I=G+", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("J=", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); for (int j = 0; j < 4; j++) { cellDados = new PdfPCell(new Phrase(" ", fontCorpo)); pTableDados.addCell(cellDados); } cellDados = new PdfPCell(new Phrase("SUBSIDIO DE", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("k=E-(F+G)", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("PYT", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(" ", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("I", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase("J", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableDados.addCell(cellDados); /** * Segunda linha de titulo Fim */ /** * Terceira linha de titulo Inicio */ for (int i = 0; i < 25; i++) { cellDados = new PdfPCell(new Phrase(getTitile(i), fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableDados.addCell(cellDados); } /** * Terceira linha de titulo FIM */ ArrayList<Processo> ps = getListData(idProcesso); for (Processo p : ps) { cellDados = new PdfPCell(new Phrase(p.CODIGO1, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.NOME2, fontCorpo)); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.DIAS3, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.S_BASE4, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.S_ALOJAMENTO5, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.S_TRANSPORTE6, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.S_ALMOCO7, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.TT_SEM8, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.ALMOCOLIVREIMPOSTO9, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.TRIBUTADO10, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.SSFUNCIONARIO11, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.MENOS_SS_FUNCIONARIO12, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.COMISOES13, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.TOTAL_E_COMISAO14, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.IRS15, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.PARCELABATER16, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.IRSAPURADO17, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.SITUAFAMILIAR18, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.IRSLIQUIDO19, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.ALMOCO20, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.SALARIOLIQUIDO21, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.AVANCO22, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.NETOUT23, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.SSEMPRESA24, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); cellDados = new PdfPCell(new Phrase(p.TOTAL25, fontCorpo)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableDados.addCell(cellDados); } PdfPTable pTableRodape = new PdfPTable(new float[] { 33.333333333f, 33.333333333f, 33.333333333f }); PdfPTable pTableSegurancaSocial = new PdfPTable( new float[] { 35f, 21.666666667f, 21.666666667f, 21.666666667f }); pTableSegurancaSocial.setWidthPercentage(75f); PdfPTable pTableImpostoSalario = new PdfPTable(new float[] { 25f, 25f, 25f, 25f }); pTableImpostoSalario.setWidthPercentage(75f); PdfPTable pTableNetSalaryPayble = new PdfPTable(new float[] { 70f, 30f }); pTableNetSalaryPayble.setWidthPercentage(75f); PdfPTable pTableAssinatura = new PdfPTable(new float[] { 25f, 25f, 25f, 25f }); /** * segurano social inicio */ cellDados = new PdfPCell(new Phrase("SEGURANA SOCIAL", fontCorpoN)); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setPaddingTop(8.5f); pTableRodape.addCell(cellDados); /** * segurano social Fim */ /** * IMPOSTO DE SAL?RIO inicio */ cellDados = new PdfPCell(new Phrase("IMPOSTO DE SAL?RIO", fontCorpoN)); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setPaddingTop(8.5f); pTableRodape.addCell(cellDados); /** * IMPOSTO DE SAL?RIO Fim */ /** * NET SALARY PAYABLE incial */ cellDados = new PdfPCell(new Phrase("NET SALARY PAYABLE", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setPaddingTop(8.5f); pTableRodape.addCell(cellDados); /** * NET SALARY PAYABLE Fim */ /** * segurano social inicio */ cellDados = new PdfPCell(new Phrase(" ", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setBorder(PdfPCell.NO_BORDER); pTableSegurancaSocial.addCell(cellDados); cellDados = new PdfPCell(new Phrase("4%", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableSegurancaSocial.addCell(cellDados); cellDados = new PdfPCell(new Phrase("6%", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableSegurancaSocial.addCell(cellDados); cellDados = new PdfPCell(new Phrase("TOTAL", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableSegurancaSocial.addCell(cellDados); cellDados = new PdfPCell(new Phrase("TOTAL", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableSegurancaSocial.addCell(cellDados); cellDados = new PdfPCell(new Phrase( Moeda.format(Double.valueOf(psList.get(0).SSFUNCIONARIO11.replace(',', '.'))), fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableSegurancaSocial.addCell(cellDados); cellDados = new PdfPCell(new Phrase( Moeda.format(Double.valueOf(psList.get(0).SSEMPRESA24.replace(',', '.'))), fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableSegurancaSocial.addCell(cellDados); cellDados = new PdfPCell( new Phrase(Moeda.format((Double.valueOf(psList.get(0).SSFUNCIONARIO11.replace(',', '.')) + Double.valueOf(psList.get(0).SSEMPRESA24.replace(',', '.')))), fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableSegurancaSocial.addCell(cellDados); pTableSegurancaSocial.setComplete(true); cellDados = new PdfPCell(pTableSegurancaSocial); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setPadding(8.5f); // cellDados.setCalculatedHeight(100); pTableRodape.addCell(cellDados); /** * segurano social Fim */ /** * IMPOSTO DE SAL?RIO inicio */ cellDados = new PdfPCell(new Phrase("TOTAL", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableImpostoSalario.addCell(cellDados); cellDados = new PdfPCell(new Phrase(" ", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableImpostoSalario.addCell(cellDados); cellDados = new PdfPCell(new Phrase(" ", fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableImpostoSalario.addCell(cellDados); cellDados = new PdfPCell(new Phrase( Moeda.format(Double.valueOf(psList.get(0).IRSLIQUIDO19.replace(',', '.'))), fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); pTableImpostoSalario.addCell(cellDados); pTableImpostoSalario.setComplete(true); cellDados = new PdfPCell(pTableImpostoSalario); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); // cellDados.setCalculatedHeight(100); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setPadding(8.5f); pTableRodape.addCell(cellDados); /** * IMPOSTO DE SAL?RIO Fim */ /** * NET SALARY PAYABLE incial */ for (Map.Entry<String, TotalBank> entrySet : tbs.entrySet()) { cellDados = new PdfPCell( new Phrase(((entrySet.getValue().nome.isEmpty()) ? "INDEFINIDO" : entrySet.getValue().nome), fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); pTableNetSalaryPayble.addCell(cellDados); cellDados = new PdfPCell(new Phrase(Moeda.format(entrySet.getValue().value), fontCorpoN)); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableNetSalaryPayble.addCell(cellDados); } cellDados = new PdfPCell(pTableNetSalaryPayble); cellDados.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); // cellDados.setCalculatedHeight(100); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setPadding(8.5f); pTableRodape.addCell(cellDados); /** * NET SALARY PAYABLE Fim */ /** * Asssinatura inicio */ cellDados = new PdfPCell(new Phrase("VISTO\nRESPONS?VEL CONTABILIDADE", fontCorpoN)); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); cellDados.setPaddingBottom(20.f); pTableAssinatura.addCell(cellDados); cellDados = new PdfPCell(new Phrase("VISTO\nDIRETOR ADMINISTRATIVO & FINANCEIRO", fontCorpoN)); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); cellDados.setPaddingBottom(20.f); pTableAssinatura.addCell(cellDados); cellDados = new PdfPCell(new Phrase("VISTO\nDIRETOR GERAL", fontCorpoN)); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); cellDados.setPaddingBottom(20.f); pTableAssinatura.addCell(cellDados); cellDados = new PdfPCell(new Phrase("VISTO\nAUDITOR INTERNO", fontCorpoN)); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); cellDados.setPaddingBottom(20.f); pTableAssinatura.addCell(cellDados); cellDados = new PdfPCell( new Phrase("______________________________________________________", fontCorpoN)); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); cellDados.setPaddingBottom(5.f); pTableAssinatura.addCell(cellDados); cellDados = new PdfPCell( new Phrase("______________________________________________________", fontCorpoN)); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); pTableAssinatura.addCell(cellDados); cellDados = new PdfPCell( new Phrase("______________________________________________________", fontCorpoN)); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); pTableAssinatura.addCell(cellDados); cellDados = new PdfPCell( new Phrase("______________________________________________________", fontCorpoN)); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); pTableAssinatura.addCell(cellDados); cellDados = new PdfPCell(pTableAssinatura); cellDados.setBorder(PdfPCell.NO_BORDER); cellDados.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); cellDados.setColspan(3); pTableRodape.addCell(cellDados); /** * Asssinatura fim */ cellDados = new PdfPCell(pTableRodape); cellDados.setColspan(25); pTableDados.addCell(cellDados); documento.open(); documento.add(pTableEmpresaPricipal); documento.add(pTableDados); documento.close(); psList = new ArrayList<>(); tbs = new LinkedHashMap<>(); RequestContext.getCurrentInstance().execute("openAllDocument('" + reString + "')"); } catch (FileNotFoundException ex) { Logger.getLogger(TableOfSalary.class.getName()).log(Level.SEVERE, null, ex); } catch (BadElementException ex) { Logger.getLogger(TableOfSalary.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException | DocumentException ex) { Logger.getLogger(TableOfSalary.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:net.digitstar.vanadio.AbstractReportPdf.java
License:Apache License
private Document initPageLayout(Document document) { if (getReportOptions().getPageType() != ReportOptions.PageType.TYPE_AUTO) { if (getReportOptions().getPageType() == ReportOptions.PageType.TYPE_A4) { document.setPageSize(/*from w ww . j a v a 2 s. c o m*/ getReportOptions().getPageOrientation() == ReportOptions.PageOrientation.PAGE_VERTICAL ? PageSize.A4 : PageSize.A4.rotate()); } else { document.setPageSize( getReportOptions().getPageOrientation() == ReportOptions.PageOrientation.PAGE_VERTICAL ? PageSize.A3 : PageSize.A3.rotate()); } } else { } document.open(); return document; }
From source file:org.fhaes.neofhchart.PDFExportOptionsDialog.java
License:Open Source License
/** * Handles when actions are performed on the dialog. *//*from www . ja v a2 s. co m*/ @Override public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals("OK")) { // Perform the export operation boolean completedSuccessfully = doExportToPDF(); if (completedSuccessfully) { MainWindow.getInstance().getFeedbackMessagePanel().updateFeedbackMessage(FeedbackMessageType.INFO, FeedbackDisplayProtocol.AUTO_HIDE, FeedbackDictionary.NEOFHCHART_PDF_EXPORT_MESSAGE.toString()); } else { MainWindow.getInstance().getFeedbackMessagePanel().updateFeedbackMessage(FeedbackMessageType.ERROR, FeedbackDisplayProtocol.MANUAL_HIDE, "An error occured while attempting to export chart as PDF."); } this.dispose(); } else if (evt.getActionCommand().equals("Cancel")) { // Close the dialog this.dispose(); } else if (evt.getActionCommand().equals("PaperSize")) { // Update the paper size label if (this.cboPaperSize.getSelectedItem() instanceof Rectangle) { Object value = this.cboPaperSize.getSelectedItem(); if (value.equals(PageSize.A5)) { this.lblSize.setText("148 x 210mm / 5.83 x 8.27\""); } else if (value.equals(PageSize.A4)) { this.lblSize.setText("210 x 297mm / 8.27 x 11.7\""); } else if (value.equals(PageSize.A3)) { this.lblSize.setText("297 x 420mm / 11.7 x 16.5\""); } else if (value.equals(PageSize.A2)) { this.lblSize.setText("420 x 594mm / 16.5 x 23.4\""); } else if (value.equals(PageSize.A1)) { this.lblSize.setText("594 x 841mm / 23.4 x 33.1\""); } else if (value.equals(PageSize.A0)) { this.lblSize.setText("841 x 1189mm / 33.1 x 46.8\""); } else if (value.equals(PageSize.LETTER)) { this.lblSize.setText("215.9 x 279.4mm / 8.5 x 11\""); } else if (value.equals(PageSize.LEGAL)) { this.lblSize.setText("215.9 x 355.6mm / 8.5 x 14\""); } else if (value.equals(PageSize.EXECUTIVE)) { this.lblSize.setText("184 x 267mm / 7.25 x 10.5\""); } else { this.lblSize.setText(""); } radLandscape.setEnabled(true); radPortrait.setEnabled(true); } else { this.lblSize.setText(""); radLandscape.setEnabled(false); radPortrait.setEnabled(false); } } }
From source file:org.gephi.ui.exporter.preview.UIExporterPDFPanel.java
License:Open Source License
public UIExporterPDFPanel() { initComponents();//from w w w .j a va2s. c o m sizeFormatter = NumberFormat.getNumberInstance(); sizeFormatter.setMaximumFractionDigits(3); marginFormatter = NumberFormat.getNumberInstance(); marginFormatter.setMaximumFractionDigits(1); //Page size model - http://en.wikipedia.org/wiki/Paper_size DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel(); comboBoxModel.addElement(new PageSizeItem(PageSize.A0, "A0", 841, 1189, 33.1, 46.8)); comboBoxModel.addElement(new PageSizeItem(PageSize.A1, "A1", 594, 841, 23.4, 33.1)); comboBoxModel.addElement(new PageSizeItem(PageSize.A2, "A2", 420, 594, 16.5, 23.4)); comboBoxModel.addElement(new PageSizeItem(PageSize.A3, "A3", 297, 420, 11.7, 16.5)); comboBoxModel.addElement(new PageSizeItem(PageSize.A4, "A4", 210, 297, 8.3, 11.7)); comboBoxModel.addElement(new PageSizeItem(PageSize.A5, "A5", 148, 210, 5.8, 8.3)); comboBoxModel.addElement(new PageSizeItem(PageSize.ARCH_A, "ARCH A", 229, 305, 9, 12)); comboBoxModel.addElement(new PageSizeItem(PageSize.ARCH_B, "ARCH B", 305, 457, 12, 18)); comboBoxModel.addElement(new PageSizeItem(PageSize.ARCH_C, "ARCH C", 457, 610, 18, 24)); comboBoxModel.addElement(new PageSizeItem(PageSize.ARCH_D, "ARCH D", 610, 914, 24, 36)); comboBoxModel.addElement(new PageSizeItem(PageSize.ARCH_E, "ARCH E", 914, 1219, 36, 48)); comboBoxModel.addElement(new PageSizeItem(PageSize.B0, "B0", 1000, 1414, 39.4, 55.7)); comboBoxModel.addElement(new PageSizeItem(PageSize.B1, "B1", 707, 1000, 27.8, 39.4)); comboBoxModel.addElement(new PageSizeItem(PageSize.B2, "B2", 500, 707, 19.7, 27.8)); comboBoxModel.addElement(new PageSizeItem(PageSize.B3, "B3", 353, 500, 13.9, 19.7)); comboBoxModel.addElement(new PageSizeItem(PageSize.B4, "B4", 250, 353, 9.8, 13.9)); comboBoxModel.addElement(new PageSizeItem(PageSize.B5, "B5", 176, 250, 6.9, 9.8)); comboBoxModel.addElement(new PageSizeItem(PageSize.LEDGER, "Ledger", 432, 279, 17, 11)); comboBoxModel.addElement(new PageSizeItem(PageSize.LEGAL, "Legal", 216, 356, 8.5, 14)); comboBoxModel.addElement(new PageSizeItem(PageSize.LETTER, "Letter", 216, 279, 8.5, 11)); comboBoxModel.addElement(new PageSizeItem(PageSize.TABLOID, "Tabloid", 279, 432, 11, 17)); customSizeString = NbBundle.getMessage(UIExporterPDFPanel.class, "UIExporterPDFPanel.pageSize.custom"); comboBoxModel.addElement(customSizeString); pageSizeCombo.setModel(comboBoxModel); loadPreferences(); initEvents(); refreshUnit(false); }