List of usage examples for com.lowagie.text Phrase Phrase
private Phrase(boolean dummy)
From source file:biblivre3.administration.reports.DeweyReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { DeweyReportDto dto = (DeweyReportDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_DEWEY_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);//w w w .j a v a2 s . com document.add(new Phrase("\n\n")); PdfPTable table = new PdfPTable(6); table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); createHeader(table); PdfPCell cell; int totalRecords = 0; int totalHoldings = 0; List<String[]> dataList = dto.getData(); Collections.sort(dataList, this); for (String[] data : dataList) { if (StringUtils.isBlank(data[0])) { data[0] = this.getText("REPORTS_DEWEY_UNCLASSIFIED"); } totalRecords += Integer.parseInt(data[1]); totalHoldings += Integer.parseInt(data[2]); } if (totalRecords > 0) { dataList.add(new String[] { this.getText("REPORTS_TOTAL"), String.valueOf(totalRecords), String.valueOf(totalHoldings) }); } for (String[] data : dataList) { cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[0]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[1]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[2]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); } document.add(table); }
From source file:biblivre3.administration.reports.HoldingCreationByDatetReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { HoldingCreationByDateReportDto dto = (HoldingCreationByDateReportDto) reportData; totalUsuario = new HashMap<String, Integer>(); Paragraph p1 = new Paragraph(this.getText("REPORTS_INSERTION_BY_DATE_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);// w w w . j a va 2 s . c om document.add(new Phrase("\n")); String dateSpan = this.getText("REPORTS_FROM") + " " + dto.getInitialDate() + " " + this.getText("REPORTS_TO") + " " + dto.getFinalDate(); Paragraph p2 = new Paragraph(this.getHeaderChunk(dateSpan)); p2.setAlignment(Paragraph.ALIGN_LEFT); document.add(p2); document.add(new Phrase("\n")); if (dto.getData() != null) { PdfPTable table = createTable(dto.getData()); document.add(table); document.add(new Phrase("\n")); } if (totalUsuario.size() > 0) { Paragraph p3 = new Paragraph(this.getHeaderChunk(this.getText("REPORTS_INSERTION_BY_DATE_USER_TOTAL"))); p3.setAlignment(Paragraph.ALIGN_CENTER); document.add(p3); document.add(new Phrase("\n")); PdfPTable table = new PdfPTable(2); PdfPCell cell; cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_NAME")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_TOTAL")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); for (String nome : totalUsuario.keySet()) { cell = new PdfPCell(new Paragraph(this.getNormalChunk(nome))); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getNormalChunk(String.valueOf(totalUsuario.get(nome))))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); } document.add(table); document.add(new Phrase("\n")); } //Database totals table Paragraph p3 = new Paragraph( this.getHeaderChunk(this.getText("REPORTS_INSERTION_BY_DATE_DATABASE_TOTALS"))); p3.setAlignment(Paragraph.ALIGN_CENTER); document.add(p3); document.add(new Phrase("\n")); PdfPTable table = new PdfPTable(3); PdfPCell cell; cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_DATABASE")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_BIBLIO")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_HOLDING")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_MAIN")))); cell.setBackgroundColor(headerBgColor); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); String biblio = dto.getTotalBiblioMain(); biblio = biblio != null ? biblio : ""; cell = new PdfPCell(new Paragraph(this.getNormalChunk(biblio))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); String tombos = dto.getTotalHoldingMain(); tombos = tombos != null ? tombos : ""; PdfPCell cell2 = new PdfPCell(new Paragraph(this.getNormalChunk(tombos))); cell2.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell2.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell2); cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_WORK")))); cell.setBackgroundColor(headerBgColor); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); biblio = dto.getTotalBiblioWork(); biblio = biblio != null ? biblio : ""; cell = new PdfPCell(new Paragraph(this.getNormalChunk(biblio))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); tombos = dto.getTotalHoldingWork(); tombos = tombos != null ? tombos : ""; cell2 = new PdfPCell(new Paragraph(this.getNormalChunk(tombos))); cell2.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell2.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell2); document.add(table); }
From source file:biblivre3.administration.reports.LateReturnLendingsReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { DelayedLendingsDto dto = (DelayedLendingsDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_DELAYED_LENDING_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);/* w w w . j a v a 2 s . c o m*/ document.add(new Phrase("\n")); if (dto.getData().size() != 0) { Paragraph p2 = new Paragraph(this .getHeaderChunk(this.getText("REPORTS_DELAYED_LENDING_TOTAL") + ": " + dto.getData().size())); p2.setAlignment(Paragraph.ALIGN_LEFT); document.add(p2); document.add(new Phrase("\n")); PdfPTable table = createTable(dto.getData()); document.add(table); document.add(new Phrase("\n")); } }
From source file:biblivre3.administration.reports.LendingsByDateReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { LendingsByDateReportDto dto = (LendingsByDateReportDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_LENDINGS_BY_DATE_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);//from w w w .j a va2 s. co m document.add(new Phrase("\n")); StringBuilder header = new StringBuilder(); header.append(this.getText("REPORTS_FROM")); header.append(" " + dto.getInitialDate() + " "); header.append(this.getText("REPORTS_TO")); header.append(" " + dto.getFinalDate()); Paragraph p2 = new Paragraph(this.getHeaderChunk(header.toString())); p2.setAlignment(Paragraph.ALIGN_LEFT); document.add(p2); document.add(new Phrase("\n")); Paragraph p3 = new Paragraph( this.getHeaderChunk(this.getText("REPORTS_LENDINGS_BY_DATE_TOTAL") + ": " + dto.getTotals()[0])); p2.setAlignment(Paragraph.ALIGN_LEFT); document.add(p3); Paragraph p4 = new Paragraph(this .getHeaderChunk(this.getText("REPORTS_LENDINGS_BY_DATE_TOTAL_OUT") + ": " + dto.getTotals()[1])); p2.setAlignment(Paragraph.ALIGN_LEFT); document.add(p4); Paragraph p5 = new Paragraph(this .getHeaderChunk(this.getText("REPORTS_LENDINGS_BY_DATE_TOTAL_LATE") + ": " + dto.getTotals()[2])); p2.setAlignment(Paragraph.ALIGN_LEFT); document.add(p5); document.add(new Phrase("\n")); document.add(new Phrase(this.getText("REPORTS_LENDINGS_BY_DATE_TOP_LENDINGS"))); document.add(new Phrase("\n")); if (dto != null) { PdfPTable table = createTable(dto); document.add(table); document.add(new Phrase("\n")); } }
From source file:biblivre3.administration.reports.RequestsByDateReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { RequestsByDateReportDto dto = (RequestsByDateReportDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_REQUESTS_BY_DATE_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);/*w ww .j a va 2 s .c om*/ document.add(new Phrase("\n")); StringBuilder header = new StringBuilder(); header.append(this.getText("REPORTS_FROM")); header.append(" ").append(dto.getInitialDate()).append(" "); header.append(this.getText("REPORTS_TO")); header.append(" ").append(dto.getFinalDate()); Paragraph p2 = new Paragraph(this.getHeaderChunk(header.toString())); p2.setAlignment(Paragraph.ALIGN_LEFT); document.add(p2); document.add(new Phrase("\n")); if (dto.getData() != null) { PdfPTable table = createTable(dto.getData()); document.add(table); document.add(new Phrase("\n")); } }
From source file:biblivre3.administration.reports.ReservationReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { ReservationReportDto dto = (ReservationReportDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_RESERVATION_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);//w ww. j a v a 2s .co m document.add(new Phrase("\n\n")); boolean hasBiblioData = dto.getBiblioReservations() != null && !dto.getBiblioReservations().isEmpty(); boolean hasHoldingData = dto.getHoldingReservations() != null && !dto.getHoldingReservations().isEmpty(); if (hasBiblioData) { PdfPTable biblioTable = new PdfPTable(7); biblioTable.setWidthPercentage(100f); PdfPCell cell = new PdfPCell( new Paragraph(this.getHeaderChunk(this.getText("REPORTS_RESERVATION_BIBLIO")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setColspan(7); biblioTable.addCell(cell); createHeader(biblioTable); createBody(biblioTable, dto.getBiblioReservations()); document.add(biblioTable); document.add(new Phrase("\n")); } if (hasHoldingData) { PdfPTable holdingTable = new PdfPTable(7); holdingTable.setWidthPercentage(100f); PdfPCell cell = new PdfPCell( new Paragraph(this.getHeaderChunk(this.getText("REPORTS_RESERVATION_HOLDING")))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setColspan(7); holdingTable.addCell(cell); createHeader(holdingTable); createBody(holdingTable, dto.getHoldingReservations()); document.add(holdingTable); } if (!hasBiblioData && !hasHoldingData) { PdfPTable noDataTable = new PdfPTable(1); noDataTable.setWidthPercentage(100f); String message = this.getText("REPORTS_NO_DATA") + " - " + dateFormat.format(new Date()); PdfPCell cell = new PdfPCell(new Paragraph(this.getHeaderChunk(message))); cell.setBackgroundColor(headerBgColor); cell.setBorderWidth(headerBorderWidth); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); noDataTable.addCell(cell); document.add(noDataTable); } }
From source file:biblivre3.administration.reports.SearchesByDateReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { SearchesByDateReportDto dto = (SearchesByDateReportDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_SEARCHES_BY_DATE_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);/* w w w . jav a 2 s. com*/ document.add(new Phrase("\n")); StringBuilder p2Builder = new StringBuilder(); p2Builder.append(this.getText("REPORTS_FROM") + " "); p2Builder.append(dto.getInitialDate()); p2Builder.append(" " + this.getText("REPORTS_TO") + " "); p2Builder.append(dto.getFinalDate()); Paragraph p2 = new Paragraph(this.getHeaderChunk(p2Builder.toString())); p2.setAlignment(Paragraph.ALIGN_LEFT); document.add(p2); document.add(new Phrase("\n")); if (dto != null) { PdfPTable table = createTable(dto); document.add(table); document.add(new Phrase("\n")); } }
From source file:biblivre3.administration.reports.SummaryReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { SummaryReportDto dto = (SummaryReportDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_SUMMARY_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);// w ww.ja v a 2 s . c o m document.add(new Phrase("\n")); PdfPTable table = new PdfPTable(10); table.setWidthPercentage(100f); createHeader(table); Collections.sort(dto.getData(), this); PdfPCell cell; for (String[] data : dto.getData()) { cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[6]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[0]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[1]))); cell.setColspan(2); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[2]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[3]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[4]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[5]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[7]))); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); } document.add(table); }
From source file:biblivre3.administration.reports.UserReport.java
License:Open Source License
@Override protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception { UserReportDto dto = (UserReportDto) reportData; Paragraph p1 = new Paragraph(this.getText("REPORTS_USER_TITLE")); p1.setAlignment(Paragraph.ALIGN_CENTER); document.add(p1);/*from ww w. j a v a2s. c o m*/ document.add(new Phrase("\n")); PdfPTable dataTable = createUserDataTable(dto.getUser()); document.add(dataTable); Paragraph p2 = new Paragraph(this.getText("REPORTS_ADDRESS")); p2.setAlignment(Paragraph.ALIGN_CENTER); document.add(p2); document.add(new Phrase("\n")); document.add(createAddressTable(dto.getUser())); Paragraph p3 = null; if (dto.getLendings() != null && dto.getLendings().size() > 0) { document.add(new Phrase("\n")); p3 = new Paragraph(this.getText("REPORTS_USER_LENDINGS")); p3.setAlignment(Paragraph.ALIGN_CENTER); document.add(p3); document.add(new Phrase("\n")); document.add(createLendingsTable(dto.getLendings())); } if (dto.getLateLendings() != null && dto.getLateLendings().size() > 0) { document.add(new Phrase("\n")); p3 = new Paragraph(this.getText("REPORTS_USER_LATE_LENDINGS")); p3.setAlignment(Paragraph.ALIGN_CENTER); document.add(p3); document.add(new Phrase("\n")); document.add(createLendingsTable(dto.getLateLendings())); } if (dto.getReturnedLendings() != null && dto.getReturnedLendings().size() > 0) { document.add(new Phrase("\n")); p3 = new Paragraph(this.getText("REPORTS_USER_RETURNED_LENDINGS")); p3.setAlignment(Paragraph.ALIGN_CENTER); document.add(p3); document.add(new Phrase("\n")); document.add(createLendingsTable(dto.getReturnedLendings())); } }
From source file:biblivre3.cataloging.bibliographic.BiblioBO.java
License:Open Source License
public MemoryFileDTO createFileLabelsPDF(ArrayList<LabelDTO> labels, LabelConfigDTO labelConfig) { Document document = new Document(); final MemoryFileDTO file = new MemoryFileDTO(); file.setFileName("biblivre_etiquetas_" + new Date().getTime() + ".pdf"); try {// w w w .jav a 2 s . c o m ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter writer = PdfWriter.getInstance(document, baos); document.setPageSize(PageSize.A4); float verticalMargin = (297.0f - (labelConfig.getHeight() * labelConfig.getRows())) / 2; document.setMargins(7.15f * ApplicationConstants.MM_UNIT, 7.15f * ApplicationConstants.MM_UNIT, verticalMargin * ApplicationConstants.MM_UNIT, verticalMargin * ApplicationConstants.MM_UNIT); document.open(); PdfPTable table = new PdfPTable(labelConfig.getColumns()); table.setWidthPercentage(100f); PdfPCell cell; int i = 0; for (i = 0; i < labelConfig.getOffset(); i++) { cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setFixedHeight(labelConfig.getHeight() * ApplicationConstants.MM_UNIT); table.addCell(cell); } for (LabelDTO ldto : labels) { PdfContentByte cb = writer.getDirectContent(); String holdingSerial = String.valueOf(ldto.getHoldingSerial()); while (holdingSerial.length() < 10) { holdingSerial = "0" + holdingSerial; } Barcode39 code39 = new Barcode39(); code39.setExtended(true); code39.setCode(holdingSerial); code39.setStartStopText(false); Image image39 = code39.createImageWithBarcode(cb, null, null); if (labelConfig.getHeight() > 30.0f) { image39.scalePercent(110f); } else { image39.scalePercent(90f); } Paragraph para = new Paragraph(); Phrase p1 = new Phrase(StringUtils.left(ldto.getAuthor(), 28) + "\n"); Phrase p2 = new Phrase(StringUtils.left(ldto.getTitle(), 28) + "\n\n"); Phrase p3 = new Phrase(new Chunk(image39, 0, 0)); para.add(p1); para.add(p2); para.add(p3); cell = new PdfPCell(para); i++; cell.setNoWrap(true); cell.setFixedHeight(labelConfig.getHeight() * ApplicationConstants.MM_UNIT); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); Paragraph para2 = new Paragraph(); Phrase p5 = new Phrase(ldto.getLocationA() + "\n"); Phrase p6 = new Phrase(ldto.getLocationB() + "\n"); Phrase p7 = new Phrase(ldto.getLocationC() + "\n"); Phrase p8 = new Phrase(ldto.getLocationD() + "\n"); Phrase p4 = new Phrase(ldto.getAssetHolding() + "\n"); para2.add(p5); para2.add(p6); para2.add(p7); para2.add(p8); para2.add(p4); cell = new PdfPCell(para2); i++; cell.setFixedHeight(labelConfig.getHeight() * ApplicationConstants.MM_UNIT); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); } if ((i % labelConfig.getColumns()) != 0) { while ((i % labelConfig.getColumns()) != 0) { i++; cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); } } document.add(table); writer.flush(); document.close(); file.setFileData(baos.toByteArray()); } catch (Exception de) { System.out.println(de.getMessage()); } return file; }