List of usage examples for com.lowagie.text.pdf PdfPCell setColspan
public void setColspan(int colspan)
From source file:com.lapis.jsfexporter.pdf.PDFExportType.java
License:Apache License
@Override public Integer exportRow(IExportRow row) { for (IExportCell cell : row.getCells()) { PdfPCell pdfCell = new PdfPCell(); pdfCell.setColspan(cell.getColumnSpanCount()); pdfCell.setRowspan(cell.getRowSpanCount()); pdfCell.setPhrase(new Phrase(cell.getValue(), font)); table.addCell(pdfCell);//from w w w . j av a2 s .c om } return rowCount++; }
From source file:com.nokia.s60tools.swmtanalyser.wizards.ReportCreationJob.java
License:Open Source License
/** * Returns a table for the selected issues. * @param issuesTree/*from w w w.j av a 2 s . c o m*/ * @return */ private PdfPTable getTableForTheSelectedIssues(Tree issuesTree) { float[] relativeWidth = { 50, 22, 14, 14 };//100% total PdfPTable table = new PdfPTable(relativeWidth); table.setWidthPercentage(100); PdfPCell cell = new PdfPCell(new Paragraph("Item name")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(colorTableHeaderBackGrd); cell.setPadding(cellPaddingTableHeader); table.addCell(cell); cell = new PdfPCell(new Paragraph("Event")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(colorTableHeaderBackGrd); cell.setPadding(cellPaddingTableHeader); table.addCell(cell); cell = new PdfPCell(new Paragraph("Delta")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(colorTableHeaderBackGrd); cell.setPadding(cellPaddingTableHeader); table.addCell(cell); cell = new PdfPCell(new Paragraph("Severity")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(colorTableHeaderBackGrd); cell.setPadding(cellPaddingTableHeader); table.addCell(cell); for (TreeItem item : issuesTree.getItems()) { ArrayList<TreeItem> selected = new ArrayList<TreeItem>(); for (TreeItem child : item.getItems()) if (child.getChecked()) selected.add(child); if (selected.size() > 0) { cell = new PdfPCell(new Paragraph(item.getText(1), fontTable2ndHeaderText)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBackgroundColor(colorTable2ndHeaderBackGrd); cell.setPadding(cellPaddingTableHeader); cell.setColspan(4); table.addCell(cell); for (TreeItem child : selected) { cell = new PdfPCell(new Paragraph(child.getText(1), fontNormalSmallTables)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setPadding(cellPaddingSmall); table.addCell(cell); cell = new PdfPCell(new Paragraph(child.getText(2), fontNormalSmallTables)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setPadding(cellPaddingSmall); table.addCell(cell); cell = new PdfPCell(new Paragraph(child.getText(3), fontNormalSmallTables)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setPadding(cellPaddingSmall); table.addCell(cell); cell = new PdfPCell(new Paragraph(child.getText(4), fontNormalSmallTables)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); if (child.getText(4).toLowerCase() .equals(AnalyserConstants.Priority.CRITICAL.toString().toLowerCase())) { cell.setBackgroundColor(colorSeverityCritical); } else if (child.getText(4).toLowerCase() .equals(AnalyserConstants.Priority.HIGH.toString().toLowerCase())) { cell.setBackgroundColor(colorSeverityHigh); } else if (child.getText(4).toLowerCase() .equals(AnalyserConstants.Priority.NORMAL.toString().toLowerCase())) { cell.setBackgroundColor(colorSeverityNormal); } cell.setPadding(cellPaddingSmall); table.addCell(cell); } } } return table; }
From source file:com.prime.location.billing.InvoicedBillingManager.java
/** * Print invoice/*w w w . ja v a2 s.c o m*/ */ public void printInvoice() { try { //catch better your exceptions, this is just an example FacesContext context = FacesContext.getCurrentInstance(); Document pdf = new Document(PageSize.A4, 5f, 5f, 75f, 45f); String fileName = "PDFFile"; ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter writer = PdfWriter.getInstance(pdf, baos); TableHeader event = new TableHeader(); event.setHeader("Header Here"); writer.setPageEvent(event); if (!pdf.isOpen()) { pdf.open(); } PdfPCell cell; PdfPTable header = new PdfPTable(new float[] { 1, 2, 1 }); cell = new PdfPCell(new Paragraph("INVOICE", FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLDITALIC, Color.BLACK))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(3); cell.setBorder(Rectangle.NO_BORDER); header.addCell(cell); header.setTotalWidth(527); header.setLockedWidth(true); cell = new PdfPCell(new Phrase("Agency: " + selectedAgency.getDescription())); cell.setColspan(2); cell.setBorder(Rectangle.NO_BORDER); header.addCell(cell); cell = new PdfPCell(new Phrase("Invoice#: " + selectedInvoice.getId())); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); header.addCell(cell); cell = new PdfPCell( new Phrase("Date: " + DateUtility.dateTimeFormat(selectedInvoice.getInvoiceDate()))); cell.setColspan(3); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); header.addCell(cell); pdf.add(header); PdfPTable table = new PdfPTable(new float[] { 1, 3, 2, 1 }); table.setSpacingBefore(15f); table.setTotalWidth(527); table.setLockedWidth(true); //table.setWidths(new int[]{3, 1, 1}); table.getDefaultCell().setBackgroundColor(Color.LIGHT_GRAY); table.addCell("Date"); table.addCell("Name"); table.addCell("Service"); table.addCell("Rate"); table.getDefaultCell().setBackgroundColor(null); cell = new PdfPCell(new Phrase("Total(US$): ")); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setColspan(3); cell.setBackgroundColor(Color.LIGHT_GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase(new DecimalFormat("###,###.###").format(selectedInvoice.getAmount()))); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBackgroundColor(Color.LIGHT_GRAY); table.addCell(cell); // There are three special rows table.setHeaderRows(2); // One of them is a footer table.setFooterRows(1); Font f = FontFactory.getFont(FontFactory.HELVETICA, 10); //add remaining for (AgencyBilling billing : selectedInvoice.getBillings()) { table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); table.getDefaultCell().setIndent(2); table.getDefaultCell().setFixedHeight(20); table.addCell(new Phrase(DateUtility.dateFormat(billing.getBillingDate()), f)); table.addCell(new Phrase(billing.getPerson().getName(), f)); table.addCell(new Phrase(billing.getTariff().getTariffType().getDescription(), f)); cell = new PdfPCell(new Phrase(new DecimalFormat("###,###.###").format(billing.getRate()), f)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); } pdf.add(table); writer.getAcroForm().setNeedAppearances(true); //document.add(new Phrase(TEXT)); //Keep modifying your pdf file (add pages and more) pdf.close(); writePDFToResponse(context.getExternalContext(), baos, fileName); context.responseComplete(); } catch (Exception e) { //e.printStackTrace(); } }
From source file:com.qcadoo.mes.deliveries.print.DeliveryReportPdf.java
License:Open Source License
private void addTotalRow(final PdfPTable productsTable, final Locale locale, final List<String> columnsName, Entity delivery) {// ww w . ja v a 2 s . co m DeliveryPricesAndQuantities deliveryPricesAndQuantities = new DeliveryPricesAndQuantities(delivery, numberService); PdfPCell total = new PdfPCell( new Phrase(translationService.translate("deliveries.delivery.report.totalCost", locale), FontUtils.getDejavuRegular7Dark())); total.setColspan(2); total.setHorizontalAlignment(Element.ALIGN_LEFT); total.setVerticalAlignment(Element.ALIGN_MIDDLE); total.setBackgroundColor(null); total.disableBorderSide(Rectangle.RIGHT); total.disableBorderSide(Rectangle.LEFT); total.setBorderColor(ColorUtils.getLineLightColor()); productsTable.addCell(total); for (int i = 2; i < columnsName.size(); i++) { if (columnsName.contains(OrderedProductFields.ORDERED_QUANTITY) && columnsName.indexOf(OrderedProductFields.ORDERED_QUANTITY) == i) { productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); productsTable.addCell( new Phrase(numberService.format(deliveryPricesAndQuantities.getOrderedCumulatedQuantity()), FontUtils.getDejavuRegular7Dark())); } else if (columnsName.contains(DeliveredProductFields.DELIVERED_QUANTITY) && columnsName.indexOf(DeliveredProductFields.DELIVERED_QUANTITY) == i) { productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); productsTable.addCell(new Phrase( numberService.format(deliveryPricesAndQuantities.getDeliveredCumulatedQuantity()), FontUtils.getDejavuRegular7Dark())); } else if (columnsName.contains(DeliveredProductFields.TOTAL_PRICE) && columnsName.indexOf(DeliveredProductFields.TOTAL_PRICE) == i) { productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); productsTable.addCell( new Phrase(numberService.format(deliveryPricesAndQuantities.getDeliveredTotalPrice()), FontUtils.getDejavuRegular7Dark())); } else if (columnsName.contains(L_CURRENCY) && columnsName.indexOf(L_CURRENCY) == i) { productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); productsTable.addCell( new Phrase(deliveriesService.getCurrency(delivery), FontUtils.getDejavuRegular7Dark())); } else { productsTable.addCell(""); } } }
From source file:com.qcadoo.mes.deliveries.print.OrderReportPdf.java
License:Open Source License
private void addTotalRow(final PdfPTable productsTable, final Locale locale, final List<String> columnsName, Entity delivery) {/*from w w w . j a va2 s . co m*/ DeliveryPricesAndQuantities deliveryPricesAndQuantities = new DeliveryPricesAndQuantities(delivery, numberService); PdfPCell total = new PdfPCell( new Phrase(translationService.translate("deliveries.delivery.report.totalCost", locale), FontUtils.getDejavuRegular7Dark())); total.setColspan(2); total.setHorizontalAlignment(Element.ALIGN_LEFT); total.setVerticalAlignment(Element.ALIGN_MIDDLE); total.setBackgroundColor(null); total.disableBorderSide(Rectangle.RIGHT); total.disableBorderSide(Rectangle.LEFT); total.setBorderColor(ColorUtils.getLineLightColor()); productsTable.addCell(total); for (int i = 2; i < columnsName.size(); i++) { if (columnsName.contains(OrderedProductFields.ORDERED_QUANTITY) && columnsName.indexOf(OrderedProductFields.ORDERED_QUANTITY) == i) { productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); productsTable.addCell( new Phrase(numberService.format(deliveryPricesAndQuantities.getOrderedCumulatedQuantity()), FontUtils.getDejavuRegular7Dark())); } else if (columnsName.contains(OrderedProductFields.TOTAL_PRICE) && columnsName.indexOf(OrderedProductFields.TOTAL_PRICE) == i) { productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); productsTable.addCell( new Phrase(numberService.format(deliveryPricesAndQuantities.getOrderedTotalPrice()), FontUtils.getDejavuRegular7Dark())); } else if (columnsName.contains(L_CURRENCY) && columnsName.indexOf(L_CURRENCY) == i) { productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); productsTable.addCell( new Phrase(deliveriesService.getCurrency(delivery), FontUtils.getDejavuRegular7Dark())); } else { productsTable.addCell(""); } } }
From source file:com.qcadoo.mes.workPlans.pdf.document.WorkPlanPdfForDivision.java
License:Open Source License
private void addOperationTable(PdfWriter pdfWriter, GroupingContainer groupingContainer, Document document, OrderOperationComponent orderOperationComponent, Locale locale) throws DocumentException { Map<Long, Map<OperationProductColumn, ColumnAlignment>> outputProductsMap = groupingContainer .getOperationComponentIdProductOutColumnToAlignment(); Map<Long, Map<OperationProductColumn, ColumnAlignment>> inputProductsMap = groupingContainer .getOperationComponentIdProductInColumnToAlignment(); Entity operationComponent = orderOperationComponent.getOperationComponent(); Entity order = orderOperationComponent.getOrder(); Entity product = order.getBelongsToField(OrderFields.PRODUCT); Map<OperationProductColumn, ColumnAlignment> inputProductColumnAlignmentMap = inputProductsMap .get(operationComponent.getId()); Map<OperationProductColumn, ColumnAlignment> outputProductColumnAlignmentMap = outputProductsMap .get(operationComponent.getId()); PdfPTable table = pdfHelper.createPanelTable(3); PdfPCell headerCell = new PdfPCell(); headerCell.setBorder(Rectangle.NO_BORDER); headerCell.setColspan(2); PdfPCell inputCell = new PdfPCell(); inputCell.setBorder(Rectangle.NO_BORDER); PdfPCell outputCell = new PdfPCell(); outputCell.setBorder(Rectangle.NO_BORDER); PdfPCell codeCell = new PdfPCell(); codeCell.setBorder(Rectangle.NO_BORDER); codeCell.setHorizontalAlignment(Element.ALIGN_CENTER); codeCell.setVerticalAlignment(Element.ALIGN_TOP); codeCell.setRowspan(2);//from w w w .ja va 2s. c o m // addOperationSummary(headerCell, operationComponent); addOrderSummary(headerCell, order, product, operationComponent); addOperationProductsTable(inputCell, operationProductInComponents(operationComponent, order), inputProductColumnAlignmentMap, ProductDirection.IN, locale); addOperationProductsTable(outputCell, operationProductOutComponents(operationComponent, order), outputProductColumnAlignmentMap, ProductDirection.OUT, locale); codeCell.addElement(createBarcode(pdfWriter, operationComponent)); float[] tableColumnWidths = new float[] { 70f, 70f, 10f }; table.setWidths(tableColumnWidths); table.setTableEvent(null); table.addCell(headerCell); table.addCell(codeCell); table.addCell(inputCell); table.addCell(outputCell); table.setKeepTogether(true); document.add(table); }
From source file:com.qcadoo.mes.workPlans.pdf.document.WorkPlanPdfForDivision.java
License:Open Source License
private void addOrderSummary(PdfPCell cell, Entity order, Entity product, Entity operationComponent) throws DocumentException { Entity operation = operationComponent.getBelongsToField(TechnologyOperationComponentFields.OPERATION); PdfPTable orderTable = pdfHelper.createPanelTable(3); PdfPCell operationCell = new PdfPCell(); operationCell.setBorder(Rectangle.NO_BORDER); Paragraph operationName = new Paragraph(operation.getStringField(OperationFields.NUMBER) + " - " + operation.getStringField(OperationFields.NAME), FontUtils.getDejavuBold7Dark()); operationCell.addElement(operationName); PdfPCell numberCell = new PdfPCell(); numberCell.setBorder(Rectangle.NO_BORDER); Paragraph number = new Paragraph(order.getStringField(OrderFields.NUMBER), FontUtils.getDejavuBold7Dark()); number.setAlignment(Element.ALIGN_RIGHT); numberCell.addElement(number);/* w w w. j a v a 2 s . com*/ PdfPCell quantityCell = new PdfPCell(); quantityCell.setBorder(Rectangle.NO_BORDER); Paragraph quantity = new Paragraph( numberService.formatWithMinimumFractionDigits(order.getDecimalField(OrderFields.PLANNED_QUANTITY), 0) + " " + product.getStringField(ProductFields.UNIT), FontUtils.getDejavuBold7Dark()); quantity.setAlignment(Element.ALIGN_CENTER); quantityCell.addElement(quantity); PdfPCell descriptionCell = new PdfPCell(); descriptionCell.setBorder(Rectangle.NO_BORDER); descriptionCell.setColspan(3); String comment = operationComponent.getStringField(TechnologyOperationComponentFields.COMMENT); Paragraph description = null; if (!StringUtils.isEmpty(comment)) { description = new Paragraph(comment, FontUtils.getDejavuBold7Dark()); } float[] tableColumnWidths = new float[] { 160f, 30f, 10f }; orderTable.setWidths(tableColumnWidths); orderTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); orderTable.setTableEvent(null); orderTable.addCell(operationCell); orderTable.addCell(numberCell); orderTable.addCell(quantityCell); if (description != null) { descriptionCell.addElement(description); orderTable.addCell(descriptionCell); } cell.addElement(orderTable); }
From source file:com.senacor.wbs.web.project.ProjectListPanel.java
License:Apache License
public ProjectListPanel(final String id, final List<Project> projects) { super(id);//w w w. ja v a 2 s. com this.locale = getLocale(); SortableListDataProvider<Project> projectProvider = new SortableListDataProvider<Project>(projects) { @Override protected Locale getLocale() { return ProjectListPanel.this.getLocale(); } public IModel model(final Object object) { return new CompoundPropertyModel(object); } }; projectProvider.setSort("name", true); dataView = new DataView("projects", projectProvider, 4) { @Override protected void populateItem(final Item item) { Project project = (Project) item.getModelObject(); PageParameters pageParameters = new PageParameters(); pageParameters.put("projectId", project.getId()); item.add(new BookmarkablePageLink("tasks", ProjectDetailsPage.class, pageParameters) .add(new Label("id"))); item.add(new Label("kuerzel")); item.add(new Label("titel", project.getName())); item.add(new Label("budget")); item.add(new Label("costPerHour")); item.add(new Label("start")); item.add(new Label("ende")); item.add(new Label("state")); // Alternieren der Farbe zwischen geraden und // ungeraden Zeilen item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel() { @Override public Object getObject() { return (item.getIndex() % 2 == 1) ? "even" : "odd"; } })); } }; add(dataView); Form localeForm = new Form("localeForm"); ImageButton deButton = new ImageButton("langde", new ResourceReference(BaseWBSPage.class, "de.png")) { @Override public void onSubmit() { ProjectListPanel.this.locale = Locale.GERMANY; } }; localeForm.add(deButton); ImageButton usButton = new ImageButton("langus", new ResourceReference(BaseWBSPage.class, "us.png")) { @Override public void onSubmit() { ProjectListPanel.this.locale = Locale.US; } }; localeForm.add(usButton); add(localeForm); final IResourceStream pdfResourceStream = new AbstractResourceStreamWriter() { public void write(final OutputStream output) { Document document = new Document(); try { PdfWriter.getInstance(document, output); document.open(); // document.add(new // Paragraph("WBS-Projektliste")); // document.add(new Paragraph("")); PdfPTable table = new PdfPTable(new float[] { 1f, 1f, 2f, 1f }); PdfPCell cell = new PdfPCell(new Paragraph("WBS-Projektliste")); cell.setColspan(4); cell.setGrayFill(0.8f); table.addCell(cell); table.addCell("ID"); table.addCell("Krzel"); table.addCell("Titel"); table.addCell("Budget in PT"); for (Project project : projects) { table.addCell("" + project.getId()); table.addCell(project.getKuerzel()); table.addCell(project.getName()); table.addCell("" + project.getBudget()); } document.add(table); document.close(); } catch (DocumentException e) { throw new RuntimeException(e); } } public String getContentType() { return "application/pdf"; } }; WebResource projectsResource = new WebResource() { { setCacheable(false); } @Override public IResourceStream getResourceStream() { return pdfResourceStream; } @Override protected void setHeaders(final WebResponse response) { super.setHeaders(response); // response.setAttachmentHeader("projekte.pdf"); } }; WebResource projectsResourceDL = new WebResource() { { setCacheable(false); } @Override public IResourceStream getResourceStream() { return pdfResourceStream; } @Override protected void setHeaders(final WebResponse response) { super.setHeaders(response); response.setAttachmentHeader("projekte.pdf"); } }; ResourceLink pdfDownload = new ResourceLink("pdfDownload", projectsResourceDL); ResourceLink pdfPopup = new ResourceLink("pdfPopup", projectsResource); PopupSettings popupSettings = new PopupSettings(PopupSettings.STATUS_BAR); popupSettings.setWidth(500); popupSettings.setHeight(700); pdfPopup.setPopupSettings(popupSettings); Link pdfReqTarget = new Link("pdfReqTarget") { @Override public void onClick() { RequestCycle.get() .setRequestTarget(new ResourceStreamRequestTarget(pdfResourceStream, "projekte.pdf")); } }; add(pdfReqTarget); add(pdfDownload); add(pdfPopup); add(new OrderByBorder("orderByKuerzel", "kuerzel", projectProvider)); add(new OrderByBorder("orderByName", "name", projectProvider)); add(new OrderByBorder("orderByBudget", "budget", projectProvider)); add(new OrderByBorder("orderByCostPerHour", "costPerHour", projectProvider)); add(new OrderByBorder("orderByStart", "start", projectProvider)); add(new OrderByBorder("orderByEnde", "ende", projectProvider)); add(new OrderByBorder("orderByState", "state", projectProvider)); add(new PagingNavigator("projectsNavigator", dataView)); }
From source file:corner.orm.tapestry.pdf.components.AbstractPdfTableDisplay.java
License:Apache License
/** * PdfPTableFooter// w ww . ja v a2 s. c o m * * @param table */ protected void beginTableFooter(PdfPTable table, PdfWriter writer) { if (this.getDisplayTableModel().getFooters() != null) { List<String> cells = this.getDisplayTableModel().getFooters(); Font footerFont = this.getDisplayTableModel().getFootersFont(); if (footerFont == null) {//footer footerFont = PdfUtils.createHeaderSongLightFont(10); } Iterator<String> it = cells.iterator(); while (it.hasNext()) { String key = it.next(); // TODO ?? PdfPCell cell = new PdfPCell(new Phrase(key, footerFont)); cell.setColspan(getDisplayTableModel().getColumnCount()); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);// ?? cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);// table.addCell(cell); } } }
From source file:domain.reports.menu.PDFReportMenu.java
License:LGPL
/** * Return a report section formatted as a table * @param data/*from w w w. j a va 2 s.c om*/ * @return */ PdfPTable getGroupDetail(Recordset master, Recordset detail) throws Throwable { //cols PdfPTable datatable = new PdfPTable(2); //header datatable.getDefaultCell().setPadding(1); int headerwidths[] = { 50, 50 }; // percentage datatable.setWidths(headerwidths); datatable.setWidthPercentage(70); // percentage datatable.setHorizontalAlignment(Element.ALIGN_CENTER); datatable.getDefaultCell().setBorderWidth(1); datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell c = null; String v = ""; //encabezados de columnas c = new PdfPCell(new Phrase("ITEMS DEL MEN", tblHeaderFont)); c.setGrayFill(0.95f); c.setColspan(2); c.setHorizontalAlignment(Element.ALIGN_CENTER); datatable.addCell(c); c = new PdfPCell(new Phrase("Item del men", tblHeaderFont)); c.setGrayFill(0.95f); c.setHorizontalAlignment(Element.ALIGN_CENTER); datatable.addCell(c); c = new PdfPCell(new Phrase("Servicio", tblHeaderFont)); c.setGrayFill(0.95f); c.setHorizontalAlignment(Element.ALIGN_CENTER); datatable.addCell(c); while (detail.next()) { v = detail.getString("description"); c = new PdfPCell(new Phrase(v, tblBodyFont)); c.setHorizontalAlignment(Element.ALIGN_LEFT); datatable.addCell(c); v = detail.getString("path"); c = new PdfPCell(new Phrase(v, tblBodyFont)); c.setHorizontalAlignment(Element.ALIGN_LEFT); datatable.addCell(c); } datatable.setSpacingBefore(20); return datatable; }