List of usage examples for com.itextpdf.text BaseColor LIGHT_GRAY
BaseColor LIGHT_GRAY
To view the source code for com.itextpdf.text BaseColor LIGHT_GRAY.
Click Source Link
From source file:be.mxs.common.util.pdf.general.chuk.GeneralPDFCreator.java
protected void printAdminHeader(AdminPerson activePerson) { try {//from w w w .j a v a2 s .co m doc.add(new Paragraph(" ")); table = new PdfPTable(4); table.setWidthPercentage(100); // title cell = new PdfPCell( new Paragraph(getTran("Web.Occup", "medwan.common.administrative-data").toUpperCase(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.ITALIC))); cell.setColspan(4); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); // firstname cell = new PdfPCell(new Paragraph(activePerson.firstname + " " + activePerson.lastname, FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD))); cell.setColspan(2); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); table.addCell(cell); // dateOfBirth cell = new PdfPCell(new Paragraph("" + activePerson.dateOfBirth, FontFactory.getFont( FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD))); cell.setColspan(1); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); table.addCell(cell); // gender cell = new PdfPCell(new Paragraph(activePerson.gender + "", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD))); cell.setColspan(1); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); table.addCell(cell); // address AdminPrivateContact contact = activePerson.getActivePrivate(); if (contact != null) { cell = new PdfPCell(new Paragraph( contact.district + " - " + ScreenHelper.getTran(null, "province", contact.province, sPrintLanguage), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.NORMAL))); cell.setColspan(4); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); table.addCell(cell); } doc.add(table); } catch (Exception e) { e.printStackTrace(); } }
From source file:be.roots.taconic.pricingguide.service.PDFServiceImpl.java
License:Open Source License
private byte[] createModelPages(Contact contact, List<Model> models, Toc tableOfContents) throws IOException, DocumentException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Document document = iTextUtil.createNewDocument(); PdfWriter writer = PdfWriter.getInstance(document, bos); document.open();//from w w w . jav a 2 s. co m // create a PdfPTable for every model (so we can measure the height) final List<PdfPTable> modelPageTables = new ArrayList<>(); Collections.sort(models); for (Model model : models) { if (model != null) { modelPageTables.add(createModelPage(contact, model, writer)); } } // put the PdfPTable Models tables on PDF pages (multiple per page if possible) byte[] pages = new byte[] {}; int height = 0; List<String> pageNames = new ArrayList<>(); int i = 0; for (PdfPTable modelPageTable : modelPageTables) { // create a new pdf page, if necessary if (height != 0 && (height + modelPageTable.getTotalHeight() + 20 /* for the line separator */ ) >= iTextUtil.PAGE_HEIGHT) { writer.close(); document.close(); bos.close(); byte[] page = bos.toByteArray(); tableOfContents.addEntries(2, pageNames, page, true, Toc.MODEL_SORT_PREFIX + "___" + IntUtil.format(++i)); pages = iTextUtil.merge(pages, page); height = 0; pageNames.clear(); bos = new ByteArrayOutputStream(); document = iTextUtil.createNewDocument(); writer = PdfWriter.getInstance(document, bos); document.open(); } else if (height != 0) { // if not the first model on the page, draw a separator document.add(new Paragraph( new Chunk(new LineSeparator(.25f, 80f, BaseColor.LIGHT_GRAY, Element.ALIGN_CENTER, -2)))); document.add(new Paragraph(new Chunk(" "))); } // rerender the table (with a valid pdfWriter) document.add(createModelPage(contact, models.get(modelPageTables.indexOf(modelPageTable)), writer)); height += modelPageTable.getTotalHeight(); pageNames.add(models.get(modelPageTables.indexOf(modelPageTable)).getProductNameProcessed()); } writer.close(); document.close(); byte[] page = bos.toByteArray(); tableOfContents.addEntries(2, pageNames, page, true, Toc.MODEL_SORT_PREFIX + "___" + IntUtil.format(++i)); pages = iTextUtil.merge(pages, page); return pages; }
From source file:beans.ManagedBeanReportes.java
public PdfPTable traerSubtabla(Tienda t) throws DocumentException { PdfPTable tabla_PesajeDetalle = new PdfPTable(4); tabla_PesajeDetalle.setWidthPercentage(100); tabla_PesajeDetalle.setTotalWidth(450f); tabla_PesajeDetalle.setLockedWidth(true); tabla_PesajeDetalle.setWidths(anchocol03); tabla_PesajeDetalle.getDefaultCell(); PdfPCell Cell_Headers = new PdfPCell(new Paragraph("PRODUCTO", titulopequeFont)); Cell_Headers.setBackgroundColor(BaseColor.LIGHT_GRAY); Cell_Headers.setHorizontalAlignment(Paragraph.ALIGN_CENTER); Cell_Headers.setVerticalAlignment(Paragraph.ALIGN_MIDDLE); tabla_PesajeDetalle.addCell(Cell_Headers); Cell_Headers = new PdfPCell(new Paragraph("UBICACIONES", titulopequeFont)); Cell_Headers.setHorizontalAlignment(Paragraph.ALIGN_CENTER); Cell_Headers.setVerticalAlignment(Paragraph.ALIGN_MIDDLE); Cell_Headers.setBackgroundColor(BaseColor.LIGHT_GRAY); tabla_PesajeDetalle.addCell(Cell_Headers); Cell_Headers = new PdfPCell(new Paragraph("MINIMO", titulopequeFont)); Cell_Headers.setHorizontalAlignment(Paragraph.ALIGN_CENTER); Cell_Headers.setVerticalAlignment(Paragraph.ALIGN_MIDDLE); Cell_Headers.setBackgroundColor(BaseColor.LIGHT_GRAY); tabla_PesajeDetalle.addCell(Cell_Headers); Cell_Headers = new PdfPCell(new Paragraph("STOCK TOTAL", titulopequeFont)); Cell_Headers.setBackgroundColor(BaseColor.LIGHT_GRAY); Cell_Headers.setVerticalAlignment(Paragraph.ALIGN_MIDDLE); Cell_Headers.setHorizontalAlignment(Paragraph.ALIGN_CENTER); tabla_PesajeDetalle.addCell(Cell_Headers); for (StockProductoTiendaOrigen det : stockProductoTiendaOrigenFacade.lista_stock_tienda(t)) { tabla_PesajeDetalle.addCell(traerCelda(det.getProducto().getNombreProducto())); String ubicaciones_ = ""; for (DetalleAlmacenProductos p : detalleAlmacenProductosFacade.lista_para_stock_tienda(t, det.getProducto())) {/* ww w. java2 s . c o m*/ if (p.getUbicacionFisica().getIdUbicacionFisica() > 1) { ubicaciones_ = p.getUbicacionFisica().getNombreUbicacionFisica() + ";" + ubicaciones_; } } tabla_PesajeDetalle.addCell(traerCelda(ubicaciones_)); tabla_PesajeDetalle.addCell(traerCelda(String.valueOf(det.getCantidadMinimaStock()))); tabla_PesajeDetalle.addCell(traerCelda(String.valueOf(det.getCantidad()))); } return tabla_PesajeDetalle; }
From source file:bouttime.report.boutsheet.BoutSheetReport.java
License:Open Source License
/** * Generate a bout sheet report for the given list of bouts. * It is assumed that the list is in the desired order (no sorting is done here). * * @param list/*from w ww. j ava 2 s.co m*/ * @return True if the report was generated. */ public boolean generateReport(Dao dao, List<Bout> list) { // step 1: creation of a document-object // rotate to make page landscape Document document = new Document(PageSize.A4.rotate()); try { // step 2: creation of the writer FileOutputStream fos = createOutputFile(); if (fos == null) { return false; } PdfWriter writer = PdfWriter.getInstance(document, fos); writer.setPageEvent(this); // step 3: we open the document document.open(); // step 4: we grab the ContentByte and do some stuff with it PdfContentByte cb = writer.getDirectContent(); BaseFont bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); float pageWidth = cb.getPdfDocument().getPageSize().getWidth(); float midPage = pageWidth / 2; setHeaderString(dao); int count = 0; for (Bout b : list) { boolean rightSide = false; if ((count++ % 2) == 0) { if (count > 2) { // We could put this after Bout 2 is added, but // that could leave a blank last page. document.newPage(); } // Bout 1 (Left side) drawBout(cb, bf, 35, midPage - 35, b); } else { // Bout 2 (Right side) drawBout(cb, bf, midPage + 35, pageWidth - 35, b); rightSide = true; } // Print the watermark, if necessary boolean doWatermark = false; String gClass = b.getGroup().getClassification(); String wmValues = dao.getBoutsheetWatermarkValues(); if ((wmValues != null) && !wmValues.isEmpty()) { String[] tokens = wmValues.split(","); for (String s : tokens) { if (s.trim().equalsIgnoreCase(gClass)) { doWatermark = true; break; } } } if (doWatermark) { int rotation = 45; PdfContentByte ucb = writer.getDirectContentUnder(); BaseFont helv = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false); ucb.saveState(); ucb.setColorFill(BaseColor.LIGHT_GRAY); ucb.beginText(); ucb.setFontAndSize(helv, 86); float centerWidth = document.getPageSize().getWidth() / 4; if (rightSide) { centerWidth = centerWidth * 3; } ucb.showTextAligned(Element.ALIGN_CENTER, gClass, centerWidth, document.getPageSize().getHeight() / 2, rotation); ucb.endText(); ucb.restoreState(); } } } catch (DocumentException de) { logger.error("Document Exception", de); return false; } catch (IOException ioe) { logger.error("IO Exception", ioe); return false; } // step 5: we close the document document.close(); return true; }
From source file:bouttime.report.bracketsheet.BracketSheetReport.java
License:Open Source License
public static boolean generateReport(Dao dao, List<Group> list, String outputFile, boolean doBoutNumbers, boolean doTimestamp) { if (list.isEmpty()) { return false; }/*from w w w . j a v a 2 s . c o m*/ // step 1: creation of a document-object Document document = new Document(); try { // step 2: creation of the writer FileOutputStream fos = createOutputFile(outputFile); if (fos == null) { return false; } PdfWriter writer = PdfWriter.getInstance(document, fos); // step 3: we open the document document.open(); // step 4: we grab the ContentByte and do some stuff with it PdfContentByte cb = writer.getDirectContent(); String timestamp = ""; if (doTimestamp) { timestamp = DateFormat.getInstance().format(new Date()); } int rv; int i = 0; int size = list.size(); for (Group g : list) { rv = addBracket(cb, dao, g, doBoutNumbers); if (rv != PAGE_ERROR) { // Print the watermark, if necessary boolean doWatermark = false; String gClass = g.getClassification(); String wmValues = dao.getBracketsheetWatermarkValues(); if ((wmValues != null) && !wmValues.isEmpty()) { String[] tokens = wmValues.split(","); for (String s : tokens) { if (s.trim().equalsIgnoreCase(gClass)) { doWatermark = true; break; } } } int rotation = (rv == PAGE_ROUNDROBIN) ? 45 : 135; if (doWatermark) { PdfContentByte ucb = writer.getDirectContentUnder(); BaseFont helv = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false); ucb.saveState(); ucb.setColorFill(BaseColor.LIGHT_GRAY); ucb.beginText(); ucb.setFontAndSize(helv, 86); ucb.showTextAligned(Element.ALIGN_CENTER, gClass, document.getPageSize().getWidth() / 2, document.getPageSize().getHeight() / 2, rotation); ucb.endText(); ucb.restoreState(); } if (doTimestamp) { rotation -= 45; float width = cb.getPdfWriter().getPageSize().getWidth(); int x = (rv == PAGE_ROUNDROBIN) ? 15 : (int) (width - 15); int y = 15; BracketSheetUtil.drawTimestamp(cb, null, x, y, 10, timestamp, rotation); } // If not doing bout numbers, this is an 'award' type of // bracket. So print an image/logo, if configured. if (!doBoutNumbers && (dao.getBracketsheetAwardImage() != null) && !dao.getBracketsheetAwardImage().isEmpty()) { Image image = Image.getInstance(Image.getInstance(dao.getBracketsheetAwardImage())); image.setRotationDegrees((rv == PAGE_ROUNDROBIN) ? 0 : 90); PositionOnPage positionOnPage = dao.getBracketsheetAwardImagePosition(); if (PositionOnPage.UPPER_RIGHT == positionOnPage) { float x = (rv == PAGE_ROUNDROBIN) ? document.getPageSize().getWidth() - 10 - image.getWidth() : 10; float y = document.getPageSize().getHeight() - 10 - image.getHeight(); image.setAbsolutePosition(x, y); cb.addImage(image); } else if (PositionOnPage.CENTER == positionOnPage) { // put the image in the background, in the middle of the page PdfContentByte ucb = writer.getDirectContentUnder(); float pageX = document.getPageSize().getWidth() / 2; float pageY = document.getPageSize().getHeight() / 2; float imageX = image.getWidth() / 2; float imageY = image.getHeight() / 2; image.setAbsolutePosition(pageX - imageX, pageY - imageY); ucb.addImage(image); } } if (++i < size) { document.newPage(); } } } } catch (DocumentException de) { logger.error("Document Exception", de); return false; } catch (IOException ioe) { logger.error("IO Exception", ioe); return false; } // step 5: we close the document document.close(); return true; }
From source file:br.com.ifrn.panfleto.gui.PainelCadastrar.java
public BaseColor corPagina() { if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Branco")) { return BaseColor.WHITE; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Preto")) { return BaseColor.BLACK; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Azul")) { return BaseColor.BLUE; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cinza Escuro")) { return BaseColor.DARK_GRAY; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cinza")) { return BaseColor.GRAY; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cinza Claro")) { return BaseColor.LIGHT_GRAY; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Magenta")) { return BaseColor.MAGENTA; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Laranja")) { return BaseColor.ORANGE; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Rosa")) { return BaseColor.PINK; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Vermlho")) { return BaseColor.RED; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Amarero")) { return BaseColor.YELLOW; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cyan")) { return BaseColor.CYAN; }/*from w w w . j a v a 2 s . c o m*/ return BaseColor.WHITE; }
From source file:com.algoboss.erp.util.report.PDFExporter.java
License:Apache License
protected PdfPTable exportPDFTable(FacesContext context, DataTable table, boolean pageOnly, boolean selectionOnly, boolean filteredOnly, String encoding) { int columnsCount = getColumnsCount(table); PdfPTable pdfTable = new PdfPTable(columnsCount); this.cellFont = FontFactory.getFont(FontFactory.TIMES, encoding, 7, Font.NORMAL); this.facetFont = FontFactory.getFont(FontFactory.TIMES, encoding, 7, Font.BOLD, BaseColor.BLUE); this.facetBgColor = BaseColor.LIGHT_GRAY; addColumnFacets(table, pdfTable, ColumnType.HEADER); if (pageOnly) { exportPageOnly(context, table, pdfTable); } else if (selectionOnly) { exportSelectionOnly(context, table, pdfTable); } else if (filteredOnly) { exportFilteredOnly(context, table, pdfTable); } else {//from w w w .j a va2 s . c o m exportAll(context, table, pdfTable); } if (table.hasFooterColumn()) { addColumnFacets(table, pdfTable, ColumnType.FOOTER); } table.setRowIndex(-1); return pdfTable; }
From source file:com.chaschev.itext.columns.BalancedColumnsBuilder.java
License:Apache License
private BalancingResult _go() { if (b.drawBorders) { b.getCanvasBuilder().drawGrayRectangle(origRectangle.get(), BaseColor.LIGHT_GRAY); }/* w ww. ja va 2 s.co m*/ currentLeftResult.totalElementCount = currentRightResult.totalElementCount = bestResult.totalElementCount = sequence .size(); //try adding into a single infinite column to calc height final float hCenter = horCenter(); referenceHeight = calcReferenceHeight(hCenter); currentLeftResult.referenceHeight = currentRightResult.referenceHeight = bestResult.referenceHeight = referenceHeight; leftCTB = setColumn((float) referenceHeight, hCenter, true, true, singleColumnRect, b.newColumnTextBuilder()); rightCTB = setColumn((float) referenceHeight, hCenter, false, true, singleColumnRect, b.newColumnTextBuilder()); minimalLeftColumnHeight = MINIMAL_HEIGHT_COEFFICIENT * referenceHeight / 2; int i; List<Element> elements = sequence.getElements(); final DirectContentAdder.Result quickResult = new DirectContentAdder(leftCTB).setStartWith(initialLeftCTB) .setStartAtIndex(startAtElement).setQuickHeight(minimalLeftColumnHeight).setSimulate(true).go(); i = quickResult.index; bestResult.assignIfWorseThan(currentLeftResult.setElementsAddedCount(i).setLeftElementSplitHeight(0, 0) .setLeftColumnHeight(leftCTB.getCurrentHeight()) .setPageSplit(i, quickResult.hasContentLeft(elements.size()))); boolean pageOverFlow = false; //the only situation possible is the content left from initialContent if (quickResult.contentLeft != null) { leftCTB.copyContentFrom(quickResult.contentLeft); pageOverFlow = iterateOnLeft(leftCTB.newAtomicIteratorFor(), i - 1, currentLeftResult, leftCTB.getTop(), sequence.initialContentHeight); } if (i == elements.size()) { bestResult.assignIfWorseThan(currentLeftResult.setLeftElementSplitHeight(0, 0) .setLeftColumnHeight(leftCTB.getCurrentHeight()).setElementsAddedCount(i) .setPageSplit(i, leftCTB.hasMoreText())); } if (pageOverFlow) { return applyBestResult(); } elementsCycle: for (; i < elements.size(); i++) { Element el = elements.get(i); final SplitResult currentResult = currentLeftResult; currentResult.setLeftElementSplitHeight(0, 0).setElementsAddedCount(i) .setLeftColumnHeight(leftCTB.getCurrentHeight()); considerAddingOnRightAtWholeElement(i); if (el instanceof SpaceElement) { SpaceElement space = (SpaceElement) el; currentResult.setElementsAddedCount(i); considerAddingToRight(i + 1, false); if (space.fits(leftCTB, origRectangle.getBottom())) { space.add(leftCTB, true); } else { if (leftCTB.getSimpleColumnRectangle().getBottom() - space.getHeight() < b.getDocument() .bottom()) { break; } leftCTB.growBottom(space.getHeight()).setYLine(leftCTB.getYLine() - space.getHeight()); } } else { float elementTop = leftCTB.getYLine(); final Iterator<AtomicIncreaseResult> iterator = leftCTB.newAtomicIteratorFor(el); if (iterateOnLeft(iterator, i, currentResult, elementTop, sequence.getHeight(i))) { break elementsCycle; } // leftCTB.restoreState(); } currentResult.setLeftColumnHeight(leftCTB.getCurrentHeight()).setElementsAddedCount(i + 1); } considerAddingOnRightAtWholeElement(i); //here we have bestResult, so let's add our content with no simulation! // setColumn(bestResult, b.newColumnTextBuilder()) return applyBestResult(); }
From source file:com.docdoku.server.extras.TitleBlockGenerator.java
License:Open Source License
protected void generateTable(Paragraph preface, ResourceBundle bundle) { // Author + date PdfPTable table = new PdfPTable(2); table.setWidthPercentage(TABLE_PERCENT_WIDTH); PdfPCell cell;/*from ww w . j ava 2 s .c om*/ cell = new PdfPCell(new Phrase(authorName, NORMAL_12)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Phrase(creationDate, NORMAL_12)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); preface.add(table); addEmptyLine(preface, 1); preface.add(new Paragraph(bundle.getString("iteration"), BOLD_12)); addEmptyLine(preface, 1); PdfPTable iterationTable = new PdfPTable(5); iterationTable.setWidthPercentage(TABLE_PERCENT_WIDTH); // Table header cell = new PdfPCell(new Phrase(bundle.getString("iteration.version"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); iterationTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("iteration.iteration"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); iterationTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("iteration.date"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); iterationTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("iteration.author"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); iterationTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("iteration.Notes"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); iterationTable.addCell(cell); // Table body cell = new PdfPCell(new Phrase(version, NORMAL_12)); iterationTable.addCell(cell); cell = new PdfPCell(new Phrase(currentIteration, NORMAL_12)); iterationTable.addCell(cell); cell = new PdfPCell(new Phrase(iterationDate, NORMAL_12)); iterationTable.addCell(cell); cell = new PdfPCell(new Phrase(authorName, NORMAL_12)); iterationTable.addCell(cell); cell = new PdfPCell(new Phrase(revisionNote, NORMAL_12)); iterationTable.addCell(cell); preface.add(iterationTable); }
From source file:com.docdoku.server.extras.TitleBlockGenerator.java
License:Open Source License
public void generateAttribute(Paragraph preface, ResourceBundle bundle) { // Table title preface.add(new Paragraph(bundle.getString("attributes"), BOLD_12)); addEmptyLine(preface, 1);/*from ww w . ja v a 2s .c o m*/ PdfPTable attributesTable = new PdfPTable(2); attributesTable.setWidthPercentage(100f); // Table head PdfPCell cell = new PdfPCell(new Phrase(bundle.getString("attributes.name"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); attributesTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("attributes.value"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); attributesTable.addCell(cell); // Table body for (InstanceAttribute attr : instanceAttributes) { cell = new PdfPCell(new Phrase(attr.getName(), NORMAL_12)); attributesTable.addCell(cell); Object value = attr.getValue(); cell = new PdfPCell(new Phrase(value != null ? String.valueOf(value) : "", NORMAL_12)); attributesTable.addCell(cell); } preface.add(attributesTable); }