List of usage examples for com.itextpdf.text.pdf PdfPTable setTotalWidth
public void setTotalWidth(final float columnWidth[]) throws DocumentException
From source file:Export.ExportMapaProducao__.java
public String criarDoc(String user, Date dataInicio, Date dataFim) { try {/*ww w . j a v a 2s .c om*/ SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy hh'.'mm'.'ss"); SimpleDateFormat sdfPT = new SimpleDateFormat("dd-MM-yyyy"); Font fontCabecalhoN = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 10f); Font fontCorpo = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 9f); Font fontCorpoTable = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f); Font fontCorpoBP = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f); Font fontCorpoN = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 8.5f); Font fontCorpoNG = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 9.5f); Font fontCabecalhoNG = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 16f, Font.UNDERLINE); Document documento = new Document(); documento.setPageSize(PageSize.A4.rotate()); documento.setMargins(10f, 10f, 35f, 80f); File ff = new File(getDiretorio() + "/" + user + "/Relatorio/"); ff.mkdirs(); String stringData = sdf.format(new Date()); ff = new File(ff.getAbsoluteFile() + "/" + "Export Mapa Producao " + stringData + ".pdf"); String reString = "../Documentos/" + user + "/Relatorio/" + "Export Mapa Producao " + stringData + ".pdf"; OutputStream outputStraem = new FileOutputStream(ff); PdfWriter writer = PdfWriter.getInstance(documento, outputStraem); MyFooter event = new MyFooter(); writer.setPageEvent(event); documento.open(); PdfPTable pTableEmpresaPricipal = new PdfPTable(new float[] { 10f, 90f }); 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(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); 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(95); pTableEmpresaPricipal.addCell(cellTabela6); pTableEmpresaPricipal.addCell(cellTabela5); documento.add(pTableEmpresaPricipal); documento.add(pTableNull); PdfPTable pptTitileMapa = new PdfPTable(new float[] { 100 }); pptTitileMapa.setWidthPercentage(95); PdfPCell cellTitileMapa = new PdfPCell(new Phrase("Mapa de produo de ".toUpperCase() + ((dataInicio != null) ? sdfPT.format(dataInicio) + " " : " dos Ultimos anos te hoje".toUpperCase()) + ((dataFim == null) ? "" : sdfPT.format(dataFim)), fontCorpoNG)); cellTitileMapa.setBorder(0); cellTitileMapa.setHorizontalAlignment(Element.ALIGN_CENTER); pptTitileMapa.addCell(cellTitileMapa); documento.add(pptTitileMapa); documento.add(pTableNull); ResultSet rs = ud.relatorioSeguroForImpresao(dataInicio, dataFim); Consumer<HashMap<String, Object>> act = (map) -> { list = new ArrayList<>(); putNewDado(map, dataInicio, dataFim); }; Call.forEchaResultSet(act, rs); int f = 0; for (Map.Entry<String, ArrayList<Producao>> al : hasList.entrySet()) { if (f > 0) { documento.add(pTableNull); documento.add(pTableNull); } f++; PdfPTable pptTitulo = new PdfPTable(new float[] { 100 }); pptTitulo.setWidthPercentage(95); PdfPCell cellTitulo = new PdfPCell(new Phrase(al.getKey().toUpperCase(), fontCorpoNG)); cellTitulo.setBorder(0); pptTitulo.addCell(cellTitulo); documento.add(pptTitulo); documento.add(pTableNull); PdfPTable pTableDate = HeadTablePrincipal(); documento.add(pTableDate); for (Producao pro : al.getValue()) { pTableDate = new PdfPTable(new float[] { 9.7f, 28.8f, 14.7f, 10.7f, 10.7f, 10.7f, 14.7f }); pTableDate.setWidthPercentage(95); if (!pro.DATA.equals("SOMATORIO")) { newDado(pro.NUMAPOLICE, fontCorpoTable, pTableDate, documento, Element.ALIGN_LEFT, 0.5f); newDado(pro.CLIENTESEGURO, fontCorpoTable, pTableDate, documento, Element.ALIGN_LEFT, 0.5f); priencherTable(pro, fontCorpoTable, pTableDate, documento, 0.5f); } else { PdfPTable pTableDate2 = rodapeTabelaPrincipal(); newDado(("TOTAL " + al.getKey()).toUpperCase(), fontCorpoN, pTableDate2, documento, Element.ALIGN_LEFT, 1.5f); priencherTable(pro, fontCorpoBP, pTableDate2, documento, 1.5f); } } } PdfPTable pTableAssinatura = new PdfPTable(new float[] { 50f, 50f }); pTableAssinatura.setTotalWidth(700f); PdfPCell cellAssinatura = new PdfPCell(); cellAssinatura.setBorder(0); Paragraph assinatora = new Paragraph("DIRETOR TECNICO", fontCorpoN); assinatora.setAlignment(Element.ALIGN_CENTER); Paragraph espaco = new Paragraph(" ", fontCorpoN); Paragraph linha = new Paragraph("______________________________________", fontCorpoN); linha.setAlignment(Element.ALIGN_CENTER); cellAssinatura.addElement(assinatora); cellAssinatura.addElement(espaco); cellAssinatura.addElement(linha); pTableAssinatura.addCell(cellAssinatura); cellAssinatura = new PdfPCell(); cellAssinatura.setBorder(0); assinatora = new Paragraph("DIRETORA GERAL", fontCorpoN); assinatora.setAlignment(Element.ALIGN_CENTER); linha.setAlignment(Element.ALIGN_CENTER); cellAssinatura.addElement(assinatora); cellAssinatura.addElement(espaco); cellAssinatura.addElement(linha); pTableAssinatura.addCell(cellAssinatura); pTableAssinatura.writeSelectedRows(-1, 2, 70, 80, writer.getDirectContent()); documento.close(); // PrintPdf printPdf = new PrintPdf(ff.getAbsolutePath(), ff.getAbsolutePath(), 0, 595f,842f,"Enviar Para o OneNote 2013",0); //PrintPdf printPdf = new PrintPdf(ff.getAbsolutePath(), ff.getAbsolutePath(), 0, 595f,842f,"Hewlett-Packard HP LaserJet P2035",0); // printPdf.print(); return reString; } 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 null; }
From source file:Export.ReciboPagamento.java
/** * new Documento Pagamento//www.j a v a 2 s. c o m * * @param Prestacao * @param user * @return String */ public String criarDoc(Integer Prestacao, String user) { try { SimpleDateFormat sdf1 = new SimpleDateFormat("dd-MM-yyyy hh'.'mm'.'ss"); numPrestacao = Prestacao; File ff = new File(ConfigDoc.Fontes.getDiretorio() + "/" + user + "/Pagamentos/"); ff.mkdirs(); String Ddata = sdf1.format(new Date()); ff = new File(ff.getAbsoluteFile() + "/" + "Recebimento " + Ddata + ".pdf"); OutputStream outputStraem = new FileOutputStream(ff); reString = "../Documentos/" + user + "/Pagamentos/" + "Recebimento " + Ddata + ".pdf"; Document document = new Document(PageSize.A4); document.setMargins(20f, 20f, 0f, 0f); PdfWriter writer = PdfWriter.getInstance(document, outputStraem); Font fontTitile = FontFactory.getFont(ConfigDoc.Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 17f, Font.NORMAL, BaseColor.BLUE.darker().darker()); Font fontTitileShort = FontFactory.getFont(ConfigDoc.Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 6f, Font.NORMAL, BaseColor.BLUE.darker().darker()); Font fontRecibo = FontFactory.getFont(ConfigDoc.Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 10f, Font.NORMAL, BaseColor.BLUE.darker().darker()); Font fontReciboTxt = FontFactory.getFont(ConfigDoc.Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 10f, Font.NORMAL, BaseColor.BLACK.darker().darker().darker()); Font fontConteudo = FontFactory.getFont(ConfigDoc.Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 7f, Font.NORMAL, BaseColor.BLUE.darker().darker()); Font fontConteudoTxt = FontFactory.getFont(ConfigDoc.Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 7f, Font.ITALIC, BaseColor.BLACK.darker().darker().darker()); Font fontConteudoTxtUl = FontFactory.getFont(ConfigDoc.Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 7f, Font.ITALIC + Font.UNDERLINE, BaseColor.BLACK.darker().darker().darker()); MyFooter event = new MyFooter(); writer.setPageEvent(event); daoRecibo r = new daoRecibo(); HashMap<String, Object> map = r.getDados(); document.open(); PdfPTable table = detaDoc(map, fontTitile, fontRecibo, fontTitileShort, fontReciboTxt, fontConteudo, fontConteudoTxt, fontConteudoTxtUl); // document.add(table); // document.add(new Paragraph("\n\n\n\n\n\n\n\n\n", fontTitileShort)); // document.add(table); // document.newPage(); table.setTotalWidth(555); table.writeSelectedRows(-1, 100, 22.5f, 820f, writer.getDirectContent()); table.writeSelectedRows(-1, 100, 22.5f, 400f, writer.getDirectContent()); // table.writeSelectedRows(-1, 2, 52.5f, 402.5f, writer.getDirectContent()); document.close(); return reString; } catch (DocumentException ex) { Logger.getLogger(ReciboPagamento.class.getName()).log(Level.SEVERE, null, ex); return reString; } catch (FileNotFoundException ex) { Logger.getLogger(ReciboPagamento.class.getName()).log(Level.SEVERE, null, ex); } return reString; }
From source file:ExternalNonFormClasses.PDFEnator.java
public PdfPTable writeHeaders(Font font) { PdfPTable pdftable = new PdfPTable(setTableDimensions()); pdftable.setTotalWidth(480); for (int a = 0; a < this.tableHeaderData.size(); a++) { System.out.println("Header #" + a); PdfPCell cell1 = new PdfPCell(new Paragraph(this.tableHeaderData.get(a), font)); cell1.setPaddingBottom(5);//from ww w .j av a 2 s. c o m cell1.setBackgroundColor(BaseColor.LIGHT_GRAY); cell1.setHorizontalAlignment(Element.ALIGN_LEFT); pdftable.addCell(cell1); } return pdftable; }
From source file:fc.extensions.itext.Writer.java
License:MIT License
public PdfPTable createTable(int columns, float width, int[] columnWidthScale) throws DocumentException { PdfPTable pdfTable = new PdfPTable(columns); //table.setTableEvent(null); pdfTable.setTotalWidth(width); pdfTable.setWidths(columnWidthScale); return pdfTable; }
From source file:fll.web.playoff.ScoresheetGenerator.java
License:Open Source License
/** * Stores the goal cells that are inserted into the output after the team name * headers and before the scoring/initials blanks at the bottom of the * scoresheet./* ww w . j av a 2 s.c o m*/ */ private void setChallengeInfo(final ChallengeDescription description) { setPageTitle(description.getTitle()); if (null != description.getRevision()) { setRevisionInfo(description.getRevision()); } if (null != description.getCopyright()) { m_copyright = description.getCopyright(); } else { m_copyright = null; } final PerformanceScoreCategory performanceElement = description.getPerformance(); // use ArrayList as we will be doing indexed access in the loop final List<AbstractGoal> goals = new ArrayList<>(performanceElement.getGoals()); final float[] relativeWidths = new float[3]; relativeWidths[0] = 4; relativeWidths[1] = 48; relativeWidths[2] = 48; m_goalsTable = new PdfPTable(relativeWidths); String prevCategory = null; for (int goalIndex = 0; goalIndex < goals.size(); ++goalIndex) { final AbstractGoal goal = goals.get(goalIndex); if (!goal.isComputed()) { final String category = goal.getCategory(); // add category cell if needed boolean firstRowInCategory = false; if (!StringUtils.equals(prevCategory, category)) { if (!StringUtils.isEmpty(category)) { // find out how many future goals have the same category int categoryRowSpan = 1; for (int otherIndex = goalIndex + 1; otherIndex < goals.size(); ++otherIndex) { final AbstractGoal otherGoal = goals.get(otherIndex); if (!otherGoal.isComputed()) { if (StringUtils.equals(category, otherGoal.getCategory())) { ++categoryRowSpan; } else { break; } } } final Paragraph catPara = new Paragraph(category, ARIAL_10PT_NORMAL); final PdfPCell categoryCell = new PdfPCell(catPara); categoryCell.setBorderWidthTop(1); categoryCell.setBorderWidthBottom(0); categoryCell.setBorderWidthLeft(0); categoryCell.setBorderWidthRight(0); categoryCell.setVerticalAlignment(Element.ALIGN_CENTER); categoryCell.setHorizontalAlignment(Element.ALIGN_CENTER); categoryCell.setRotation(90); categoryCell.setRowspan(categoryRowSpan); m_goalsTable.addCell(categoryCell); } // first row in a new category, which may be empty firstRowInCategory = true; } // This is the text for the left hand "label" cell final String title = goal.getTitle(); final Paragraph p = new Paragraph(title, ARIAL_10PT_NORMAL); final PdfPCell goalLabel = new PdfPCell(p); goalLabel.setHorizontalAlignment(Element.ALIGN_RIGHT); goalLabel.setVerticalAlignment(Element.ALIGN_CENTER); if (firstRowInCategory) { goalLabel.setBorderWidthTop(1); goalLabel.setBorderWidthBottom(0); goalLabel.setBorderWidthLeft(0); goalLabel.setBorderWidthRight(0); } else { goalLabel.setBorder(0); } goalLabel.setPaddingRight(9); goalLabel.setVerticalAlignment(Element.ALIGN_TOP); if (StringUtils.isEmpty(category)) { // category column and goal label column goalLabel.setColspan(2); } m_goalsTable.addCell(goalLabel); // define the value cell final double min = goal.getMin(); final String minStr = FP.equals(min, Math.round(min), 1E-6) ? String.valueOf((int) min) : String.valueOf(min); final double max = goal.getMax(); final String maxStr = FP.equals(max, Math.round(max), 1E-6) ? String.valueOf((int) max) : String.valueOf(max); // If element has child nodes, then we have an enumerated list // of choices. Otherwise it is either yes/no or a numeric field. final PdfPCell goalValue = new PdfPCell(); final Chunk choices = new Chunk("", COURIER_10PT_NORMAL); if (goal.isEnumerated()) { // replace spaces with "no-break" spaces boolean first = true; final List<EnumeratedValue> values = goal.getSortedValues(); for (final EnumeratedValue value : values) { if (!first) { choices.append(" /" + Utilities.NON_BREAKING_SPACE); } else { first = false; } choices.append(value.getTitle().toUpperCase().replace(' ', Utilities.NON_BREAKING_SPACE)); } goalValue.addElement(choices); } else { if (goal.isYesNo()) { // order of yes/no needs to match ScoreEntry.generateYesNoButtons final Paragraph q = new Paragraph("NO / YES", COURIER_10PT_NORMAL); goalValue.addElement(q); } else { final String range = "(" + minStr + " - " + maxStr + ")"; final PdfPTable t = new PdfPTable(2); t.setHorizontalAlignment(Element.ALIGN_LEFT); t.setTotalWidth(1 * POINTS_PER_INCH); t.setLockedWidth(true); final Phrase r = new Phrase("", ARIAL_8PT_NORMAL); t.addCell(new PdfPCell(r)); final Phrase q = new Phrase(range, ARIAL_8PT_NORMAL); t.addCell(new PdfPCell(q)); goalValue.setPaddingTop(9); goalValue.addElement(t); } } if (firstRowInCategory) { goalValue.setBorderWidthTop(1); goalValue.setBorderWidthBottom(0); goalValue.setBorderWidthLeft(0); goalValue.setBorderWidthRight(0); } else { goalValue.setBorder(0); } goalValue.setVerticalAlignment(Element.ALIGN_MIDDLE); m_goalsTable.addCell(goalValue); // setup for next loop prevCategory = category; } // if not computed goal } // foreach goal }
From source file:fll.web.report.ReportPageEventHandler.java
License:Open Source License
@Override // initialization of the header table public void onEndPage(final PdfWriter writer, final Document document) { final PdfPTable header = new PdfPTable(2); final Phrase p = new Phrase(); final Chunk ck = new Chunk(_challengeTitle + "\n" + _reportTitle, _font); p.add(ck);//from w w w. j av a2 s . c om header.getDefaultCell().setBorderWidth(0); header.addCell(p); header.getDefaultCell().setHorizontalAlignment(com.itextpdf.text.Element.ALIGN_RIGHT); header.addCell(new Phrase(new Chunk("Tournament: " + _tournament + "\nDate: " + _formattedDate, _font))); final PdfPCell blankCell = new PdfPCell(); blankCell.setBorder(0); blankCell.setBorderWidthTop(1.0f); blankCell.setColspan(2); header.addCell(blankCell); final PdfContentByte cb = writer.getDirectContent(); cb.saveState(); header.setTotalWidth(document.right() - document.left()); header.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight() - 10, cb); cb.restoreState(); }
From source file:fr.pigouchet.gestion.util.GeneratePdf.java
public static PdfPTable getHeaderTable(int x, int y) { PdfPTable table = new PdfPTable(2); table.setTotalWidth(527); table.setLockedWidth(true);// w ww. j a va 2 s .co m table.getDefaultCell().setFixedHeight(20); table.getDefaultCell().setBorder(Rectangle.BOTTOM); table.addCell("FOOBAR FILMFESTIVAL"); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(String.format("Page %d of %d", x, y)); return table; }
From source file:Funciones.TicketPDF.java
PdfPTable tablaCliente() { PdfPTable tablacliente = new PdfPTable(2); tablacliente.setTotalWidth(500); PdfPCell celdanombrecliente = new PdfPCell(new Paragraph("Nombre Del Cliente: " + cliente[0])); tablacliente.addCell(celdanombrecliente); PdfPCell celdavendedor = new PdfPCell(new Paragraph("Vendedor: APP")); tablacliente.addCell(celdavendedor); PdfPCell celdadireccion = new PdfPCell(new Paragraph("Direccion: " + cliente[1])); celdadireccion.setColspan(2);//from w ww . j ava2 s. c o m tablacliente.addCell(celdadireccion); ; vacio.setColspan(2); vacio.setBorder(Rectangle.BOTTOM | Rectangle.TOP); tablacliente.addCell(vacio); return tablacliente; }
From source file:Funciones.TicketPDF.java
PdfPTable tablaHeader() throws IOException, BadElementException { PdfPTable tablaheader = new PdfPTable(4); tablaheader.setTotalWidth(600); BasededatosManager bd = new BasededatosManager(); try {//from w w w . j av a 2s . com ResultSet consulta = bd.consultar("SELECT logoempresa FROM configuracion"); byte[] arreglo = null; while (consulta.next()) { arreglo = consulta.getBytes("logoempresa"); } Image logo = Image.getInstance(arreglo); logo.scalePercent(15); PdfPCell celdalogo = new PdfPCell(logo); celdalogo.setBorderColor(BaseColor.WHITE); celdalogo.setColspan(4); celdalogo.setHorizontalAlignment(Element.ALIGN_CENTER); tablaheader.addCell(celdalogo); } catch (SQLException ex) { Logger.getLogger(PedidoPDF.class.getName()).log(Level.SEVERE, null, ex); } Font a = new Font(FontFamily.HELVETICA, 18, Font.BOLD, BaseColor.BLACK); PdfPCell celdatitulo = new PdfPCell(new Paragraph("PEDIDO PIZZAS", a)); celdatitulo.setColspan(2); celdatitulo.setBorderColor(BaseColor.WHITE); tablaheader.addCell(celdatitulo); PdfPCell celdafecha = new PdfPCell(new Paragraph("Fecha: " + LocalDate.now(), f)); celdafecha.setBorderColor(BaseColor.WHITE); tablaheader.addCell(celdafecha); PdfPCell celdapedido = new PdfPCell(new Paragraph("N Pedido: " + idpedido, f)); celdapedido.setBorderColor(BaseColor.WHITE); tablaheader.addCell(celdapedido); vacio.setColspan(4); vacio.setBorder(Rectangle.BOTTOM); tablaheader.addCell(vacio); return tablaheader; }
From source file:fxml.test.PDFService.java
private PdfPTable createDocumentHeader() throws IOException, BadElementException { //start creating header for the document...... PdfPTable headerTable = new PdfPTable(3); headerTable.setHorizontalAlignment(Element.ALIGN_LEFT); try {//from w w w . j a v a2s .c o m headerTable.setTotalWidth(new float[] { 57.5f, 531.5f, 183f }); headerTable.setLockedWidth(true); } catch (DocumentException ex) { Logger.getLogger(PDFService.class.getName()).log(Level.SEVERE, null, ex); } Image image = Image.getInstance(getClass().getClassLoader().getResource("img/sust.jpg")); image.scalePercent(42f); image.setAlignment(Element.ALIGN_LEFT); PdfPCell imageCell = new PdfPCell(image, false); imageCell.setPaddingTop(6); imageCell.setBorder(Rectangle.NO_BORDER); headerTable.addCell(imageCell); //start info table..... PdfPTable infoTable = new PdfPTable(1); infoTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); String universityText = "SHAHJALAL UNIVERSITY OF SCIENCE & TECHNOLOGY SYLHET, BANGLADESH"; String tabulationText = "TABULATION SHEET"; String deptText = inputs.get(0).trim(); String s1 = inputs.get(1).trim(); String s2 = inputs.get(2).trim(); String semesterText = ("B.Sc (Engg.) " + s1 + " SEMESTER EXAMINATION " + s2); String session = inputs.get(3).trim(); String date = inputs.get(4).trim(); String sessionDateText = ("SESSION:" + session + " EXAMINATION HELD IN: " + date); infoTable.addCell(getCellForHeaderString(universityText, 0, false, 0, Element.ALIGN_CENTER, font10, true)); infoTable.addCell(getCellForHeaderString(tabulationText, 0, false, 0, Element.ALIGN_CENTER, font10, false)); infoTable.addCell(getCellForHeaderString(deptText, 0, false, 0, Element.ALIGN_CENTER, font10, false)); infoTable.addCell(getCellForHeaderString(semesterText, 0, false, 0, Element.ALIGN_CENTER, font10, false)); infoTable .addCell(getCellForHeaderString(sessionDateText, 0, false, 0, Element.ALIGN_CENTER, font10, false)); //end info table..... PdfPCell infoCell = new PdfPCell(infoTable); infoCell.setBorder(Rectangle.NO_BORDER); headerTable.addCell(infoCell); PdfPCell resultPublishDateCell = new PdfPCell( new Paragraph("Result Published On............................", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); resultPublishDateCell.setBorder(Rectangle.NO_BORDER); resultPublishDateCell.setVerticalAlignment(Element.ALIGN_MIDDLE); resultPublishDateCell.setHorizontalAlignment(Element.ALIGN_RIGHT); headerTable.addCell(resultPublishDateCell); headerTable.setSpacingAfter(17.5f); // System.err.println("completed header table"); return headerTable; //end creating header for the document...... }