List of usage examples for com.lowagie.text Document add
public boolean add(Element element) throws DocumentException
Element
to the Document
. From source file:com.qcadoo.mes.qualityControls.print.QualityControlForOrderPdfView.java
License:Open Source License
private void addProductSeries(final Document document, final Entry<Entity, List<Entity>> entry, final Locale locale) throws DocumentException { document.add(qualityControlsReportService.prepareTitle(entry.getKey(), locale, "order")); List<String> productHeader = new ArrayList<String>(); productHeader//from w w w . j av a2s . c om .add(translationService.translate("qualityControls.qualityControl.report.control.number", locale)); productHeader.add(translationService.translate( "qualityControls.qualityControlForOrderDetails.window.qualityControlForOrder.controlResult.label", locale)); PdfPTable table = pdfHelper.createTableWithHeader(2, productHeader, false); List<Entity> sortedOrders = entry.getValue(); Collections.sort(sortedOrders, new EntityNumberComparator()); for (Entity entity : sortedOrders) { table.addCell(new Phrase(entity.getStringField("number"), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase( translationService.translate("qualityControls.qualityForOrder.controlResult.value." + entity.getField("controlResult").toString(), locale), FontUtils.getDejavuRegular7Dark())); } document.add(table); }
From source file:com.qcadoo.mes.qualityControls.print.QualityControlForUnitPdfView.java
License:Open Source License
@Override protected final String addContent(final Document document, final Map<String, Object> model, final Locale locale, final PdfWriter writer) throws DocumentException, IOException { String documentTitle = translationService.translate("qualityControls.qualityControlForUnit.report.title", locale);/*from w ww . jav a 2 s . co m*/ String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale); pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, new Date()); qualityControlsReportService.addQualityControlReportHeader(document, model, locale); List<Entity> orders = qualityControlsReportService.getOrderSeries(model, "qualityControlsForUnit"); Map<Entity, List<Entity>> productOrders = qualityControlsReportService.getQualityOrdersForProduct(orders); Map<Entity, List<BigDecimal>> quantities = qualityControlsReportService .getQualityOrdersQuantitiesForProduct(orders); quantities = SortUtil.sortMapUsingComparator(quantities, new EntityNumberComparator()); addOrderSeries(document, quantities, locale); productOrders = SortUtil.sortMapUsingComparator(productOrders, new EntityNumberComparator()); for (Entry<Entity, List<Entity>> entry : productOrders.entrySet()) { document.add(Chunk.NEWLINE); addProductSeries(document, entry, locale); } return translationService.translate("qualityControls.qualityControlForUnit.report.fileName", locale); }
From source file:com.qcadoo.mes.qualityControls.print.QualityControlForUnitPdfView.java
License:Open Source License
private void addOrderSeries(final Document document, final Map<Entity, List<BigDecimal>> quantities, final Locale locale) throws DocumentException { List<String> qualityHeader = new ArrayList<String>(); qualityHeader// www .j a v a 2 s . c om .add(translationService.translate("qualityControls.qualityControl.report.product.number", locale)); qualityHeader.add(translationService.translate( "qualityControls.qualityControlForUnitDetails.window.mainTab.qualityControlForUnit.controlledQuantity.label", locale)); qualityHeader.add(translationService.translate( "qualityControls.qualityControlForUnitDetails.window.mainTab.qualityControlForUnit.rejectedQuantity.label", locale)); qualityHeader.add(translationService.translate( "qualityControls.qualityControlForUnitDetails.window.mainTab.qualityControlForUnit.acceptedDefectsQuantity.label", locale)); Map<String, HeaderAlignment> alignments = Maps.newHashMap(); alignments.put(translationService.translate("qualityControls.qualityControl.report.product.number", locale), HeaderAlignment.LEFT); alignments.put(translationService.translate( "qualityControls.qualityControlForUnitDetails.window.mainTab.qualityControlForUnit.controlledQuantity.label", locale), HeaderAlignment.RIGHT); alignments.put(translationService.translate( "qualityControls.qualityControlForUnitDetails.window.mainTab.qualityControlForUnit.rejectedQuantity.label", locale), HeaderAlignment.RIGHT); alignments.put(translationService.translate( "qualityControls.qualityControlForUnitDetails.window.mainTab.qualityControlForUnit.acceptedDefectsQuantity.label", locale), HeaderAlignment.RIGHT); PdfPTable table = pdfHelper.createTableWithHeader(4, qualityHeader, false, alignments); for (Entry<Entity, List<BigDecimal>> entry : quantities.entrySet()) { table.addCell(new Phrase(entry.getKey() == null ? "" : entry.getKey().getStringField("number"), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell( new Phrase(numberService.format(entry.getValue().get(0)), FontUtils.getDejavuRegular7Dark())); table.addCell( new Phrase(numberService.format(entry.getValue().get(1)), FontUtils.getDejavuRegular7Dark())); table.addCell( new Phrase(numberService.format(entry.getValue().get(2)), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); } document.add(table); }
From source file:com.qcadoo.mes.qualityControls.print.QualityControlForUnitPdfView.java
License:Open Source License
private void addProductSeries(final Document document, final Entry<Entity, List<Entity>> entry, final Locale locale) throws DocumentException { document.add(qualityControlsReportService.prepareTitle(entry.getKey(), locale, "unit")); List<String> productHeader = new ArrayList<String>(); productHeader//w w w . j av a 2s . c o m .add(translationService.translate("qualityControls.qualityControl.report.control.number", locale)); productHeader.add( translationService.translate("qualityControls.qualityControl.report.controlled.quantity", locale)); productHeader.add( translationService.translate("qualityControls.qualityControl.report.rejected.quantity", locale)); productHeader.add(translationService .translate("qualityControls.qualityControl.report.accepted.defects.quantity", locale)); Map<String, HeaderAlignment> alignments = Maps.newHashMap(); alignments.put(translationService.translate("qualityControls.qualityControl.report.control.number", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate("qualityControls.qualityControl.report.controlled.quantity", locale), HeaderAlignment.RIGHT); alignments.put( translationService.translate("qualityControls.qualityControl.report.rejected.quantity", locale), HeaderAlignment.RIGHT); alignments.put(translationService.translate( "qualityControls.qualityControl.report.accepted.defects.quantity", locale), HeaderAlignment.RIGHT); PdfPTable table = pdfHelper.createTableWithHeader(4, productHeader, false, alignments); List<Entity> sortedOrders = entry.getValue(); Collections.sort(sortedOrders, new EntityNumberComparator()); for (Entity entity : sortedOrders) { table.addCell(new Phrase(entity.getStringField("number"), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(new Phrase(numberService.format(entity.getField("controlledQuantity")), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(numberService.format(entity.getField("rejectedQuantity")), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(numberService.format(entity.getField("acceptedDefectsQuantity")), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); } document.add(table); }
From source file:com.qcadoo.mes.qualityControls.print.QualityControlsReportService.java
License:Open Source License
public final void addQualityControlReportHeader(final Document document, final Map<String, Object> model, final Locale locale) throws DocumentException { if (!model.containsKey(ENTITIES)) { Paragraph firstParagraphTitle = new Paragraph(new Phrase( translationService.translate("qualityControls.qualityControl.report.paragrah", locale), FontUtils.getDejavuBold11Light())); firstParagraphTitle.add(new Phrase(" " + model.get("dateFrom") + " - " + model.get("dateTo"), FontUtils.getDejavuBold11Light())); firstParagraphTitle.setSpacingBefore(20); document.add(firstParagraphTitle); }//ww w .j av a2 s. c o m Paragraph secondParagraphTitle = new Paragraph( new Phrase(translationService.translate("qualityControls.qualityControl.report.paragrah2", locale), FontUtils.getDejavuBold11Light())); secondParagraphTitle.setSpacingBefore(20); document.add(secondParagraphTitle); }
From source file:com.qcadoo.mes.simpleMaterialBalance.internal.print.SimpleMaterialBalancePdfService.java
License:Open Source License
private void addPanel(final Document document, final Entity simpleMaterialBalance, final Locale locale) throws DocumentException { PdfPTable panelTable = pdfHelper.createPanelTable(2); pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.panel.simpleMaterialBalance.date", locale), DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.DEFAULT, locale) .format((Date) simpleMaterialBalance.getField(L_DATE))); pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.panel.simpleMaterialBalance.name", locale),//from w w w . j a va 2 s .c o m simpleMaterialBalance.getStringField(L_NAME)); pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.panel.simpleMaterialBalance.worker", locale), simpleMaterialBalance.getStringField(L_WORKER)); pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.panel.simpleMaterialBalance.mrpAlgorithm", locale), translationService.translate("simpleMaterialBalance.simpleMaterialBalance.mrpAlgorithm.value." + simpleMaterialBalance.getStringField("mrpAlgorithm"), locale)); panelTable.setSpacingAfter(20); panelTable.setSpacingBefore(20); document.add(panelTable); }
From source file:com.qcadoo.mes.simpleMaterialBalance.internal.print.SimpleMaterialBalancePdfService.java
License:Open Source License
private void addBalance(final Document document, final Entity simpleMaterialBalance, final Locale locale) throws DocumentException { document.add(new Paragraph( translationService.translate("simpleMaterialBalance.simpleMaterialBalance.report.paragrah", locale), FontUtils.getDejavuBold11Dark())); List<String> simpleMaterialBalanceTableHeader = new ArrayList<String>(); simpleMaterialBalanceTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.number", locale)); simpleMaterialBalanceTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.name", locale)); simpleMaterialBalanceTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.needed", locale)); simpleMaterialBalanceTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.inLocation", locale)); simpleMaterialBalanceTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.balance", locale)); simpleMaterialBalanceTableHeader.add(translationService.translate("basic.product.unit.label", locale)); Map<String, HeaderAlignment> alignments = Maps.newHashMap(); alignments.put(/* w w w. jav a 2s . c o m*/ translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.number", locale), HeaderAlignment.LEFT); alignments.put(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.name", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.needed", locale), HeaderAlignment.RIGHT); alignments.put( translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.inLocation", locale), HeaderAlignment.RIGHT); alignments.put( translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.balance", locale), HeaderAlignment.RIGHT); alignments.put(translationService.translate("basic.product.unit.label", locale), HeaderAlignment.LEFT); PdfPTable table = pdfHelper.createTableWithHeader(6, simpleMaterialBalanceTableHeader, false, alignments); List<Entity> simpleMaterialBalanceOrdersComponents = simpleMaterialBalance .getHasManyField(L_SIMPLE_MATERIAL_BALANCE_ORDERS_COMPONENTS); MrpAlgorithm mrpAlgorithm = MrpAlgorithm.parseString(simpleMaterialBalance.getStringField("mrpAlgorithm")); Map<Long, BigDecimal> neededProductQuantities = productQuantitiesService .getNeededProductQuantitiesForComponents(simpleMaterialBalanceOrdersComponents, mrpAlgorithm); List<Entity> simpleMaterialBalanceLocationComponents = simpleMaterialBalance .getHasManyField(L_SIMPLE_MATERIAL_BALANCE_LOCATIONS_COMPONENTS); // TODO LUPO fix comparator // products = SortUtil.sortMapUsingComparator(products, new EntityNumberComparator()); for (Entry<Long, BigDecimal> neededProductQuantity : neededProductQuantities.entrySet()) { Entity product = productQuantitiesService.getProduct(neededProductQuantity.getKey()); table.addCell(new Phrase(product.getField(L_NUMBER).toString(), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(product.getField(L_NAME).toString(), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(new Phrase(numberService.format(neededProductQuantity.getValue()), FontUtils.getDejavuRegular7Dark())); BigDecimal available = BigDecimal.ZERO; for (Entity simpleMaterialBalanceLocationComponent : simpleMaterialBalanceLocationComponents) { available = available.add(materialFlowService.calculateShouldBeInLocation( simpleMaterialBalanceLocationComponent.getBelongsToField(L_LOCATION).getId(), product.getId(), (Date) simpleMaterialBalance.getField(L_DATE))); } table.addCell(new Phrase(numberService.format(available), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase( numberService.format( available.subtract(neededProductQuantity.getValue(), numberService.getMathContext())), FontUtils.getDejavuBold7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(new Phrase(product.getField(L_UNIT).toString(), FontUtils.getDejavuRegular7Dark())); } document.add(table); }
From source file:com.qcadoo.mes.simpleMaterialBalance.internal.print.SimpleMaterialBalancePdfService.java
License:Open Source License
private void addOrders(final Document document, final Entity simpleMaterialBalance, final Locale locale) throws DocumentException { document.add(Chunk.NEWLINE); document.add(new Paragraph(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.paragrah2", locale), FontUtils.getDejavuBold11Dark())); List<String> simpleMaterialBalanceOrdersTableHeader = new ArrayList<String>(); simpleMaterialBalanceOrdersTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.number", locale)); simpleMaterialBalanceOrdersTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.name", locale)); PdfPTable table = pdfHelper.createTableWithHeader(2, simpleMaterialBalanceOrdersTableHeader, false); List<Entity> orders = new ArrayList<Entity>( simpleMaterialBalance.getHasManyField(L_SIMPLE_MATERIAL_BALANCE_ORDERS_COMPONENTS)); Collections.sort(orders, new EntityOrderNumberComparator()); for (Entity e : orders) { table.addCell(new Phrase(e.getBelongsToField(L_ORDER).getStringField(L_NUMBER), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(e.getBelongsToField(L_ORDER).getStringField(L_NAME), FontUtils.getDejavuRegular7Dark())); }/*from w w w . j av a 2 s .c om*/ document.add(table); }
From source file:com.qcadoo.mes.simpleMaterialBalance.internal.print.SimpleMaterialBalancePdfService.java
License:Open Source License
private void addLocations(final Document document, final Entity simpleMaterialBalance, final Locale locale) throws DocumentException { document.add(Chunk.NEWLINE); document.add(new Paragraph(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.paragrah3", locale), FontUtils.getDejavuBold11Dark())); List<String> simpleMaterialBalanceLocationTableHeader = new ArrayList<String>(); simpleMaterialBalanceLocationTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.number", locale)); simpleMaterialBalanceLocationTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.name", locale)); PdfPTable table = pdfHelper.createTableWithHeader(2, simpleMaterialBalanceLocationTableHeader, false); List<Entity> simpleMaterialBalanceLocationComponents = new ArrayList<Entity>( simpleMaterialBalance.getHasManyField(L_SIMPLE_MATERIAL_BALANCE_LOCATIONS_COMPONENTS)); Collections.sort(simpleMaterialBalanceLocationComponents, new EntityLocationNumberComparator()); for (Entity simpleMaterialBalanceLocationComponent : simpleMaterialBalanceLocationComponents) { table.addCell(new Phrase( simpleMaterialBalanceLocationComponent.getBelongsToField(L_LOCATION).getStringField(L_NUMBER), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase( simpleMaterialBalanceLocationComponent.getBelongsToField(L_LOCATION).getStringField(L_NAME), FontUtils.getDejavuRegular7Dark())); }//from w w w . j av a 2 s . c om document.add(table); }
From source file:com.qcadoo.mes.technologies.print.TechnologiesTechnologyDetailsPdfView.java
License:Open Source License
@Override protected final String addContent(final Document document, final Map<String, Object> model, final Locale locale, final PdfWriter writer) throws DocumentException, IOException { checkState(model.get("id") != null, "Unable to generate report for unsaved technology! (missing id)"); String documentTitle = translationService .translate("technologies.technologiesTechnologyDetails.report.title", locale); String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale); pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, new Date()); DataDefinition technologyDD = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_TECHNOLOGY); Entity technology = technologyDD.get(valueOf(model.get("id").toString())); Map<String, String> panelTableValues = newLinkedHashMap(); panelTableValues.put(TechnologyFields.NAME, technology.getStringField(TechnologyFields.NAME)); panelTableValues.put(TechnologyFields.NUMBER, technology.getStringField(TechnologyFields.NUMBER)); panelTableValues.put(TechnologyFields.PRODUCT, technology.getBelongsToField(TechnologyFields.PRODUCT).getStringField(ProductFields.NAME)); panelTableValues.put("default", technology.getBooleanField(TechnologyFields.MASTER) ? translationService.translate("qcadooView.true", locale) : translationService.translate("qcadooView.false", locale)); panelTableValues.put(TechnologyFields.DESCRIPTION, technology.getStringField(TechnologyFields.DESCRIPTION)); PdfPTable panelTable = pdfHelper.createPanelTable(2); for (Map.Entry<String, String> panelEntry : panelTableValues.entrySet()) { pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate( "technologies.technologiesTechnologyDetails.report.panel.technology." + panelEntry.getKey(), locale), panelEntry.getValue()); }//from www . ja v a2 s. c o m panelTable.setSpacingAfter(20); panelTable.setSpacingBefore(20); document.add(panelTable); List<String> technologyDetailsTableHeader = new ArrayList<String>(); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.level", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.name", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.direction", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.productNumber", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.productName", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.quantity", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.unit", locale)); Map<String, HeaderAlignment> alignments = Maps.newHashMap(); alignments.put(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.level", locale), HeaderAlignment.LEFT); alignments.put(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.name", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "technologies.technologiesTechnologyDetails.report.columnHeader.direction", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "technologies.technologiesTechnologyDetails.report.columnHeader.productNumber", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "technologies.technologiesTechnologyDetails.report.columnHeader.productName", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "technologies.technologiesTechnologyDetails.report.columnHeader.quantity", locale), HeaderAlignment.RIGHT); alignments.put(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.unit", locale), HeaderAlignment.LEFT); PdfPTable table = pdfHelper.createTableWithHeader(7, technologyDetailsTableHeader, false, alignments); EntityTree technologyTree = technology.getTreeField(TechnologyFields.OPERATION_COMPONENTS); treeNumberingService.generateTreeNumbers(technologyTree); List<Entity> technologyOperationComponents = entityTreeUtilsService.getSortedEntities(technologyTree); for (Entity technologyOperationComponent : technologyOperationComponents) { String nodeNumber = technologyOperationComponent .getStringField(TechnologyOperationComponentFields.NODE_NUMBER); String operationName = technologyOperationComponent .getBelongsToField(TechnologyOperationComponentFields.OPERATION) .getStringField(OperationFields.NAME); List<Entity> operationProductComponents = newArrayList(); operationProductComponents.addAll(technologyOperationComponent .getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_IN_COMPONENTS)); operationProductComponents.addAll(technologyOperationComponent .getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS)); for (Entity operationProductComponent : operationProductComponents) { Entity product = operationProductComponent.getBelongsToField(L_PRODUCT); String productType = "technologies.technologiesTechnologyDetails.report.direction.out"; if (operationProductComponent.getDataDefinition().getName().equals("operationProductInComponent")) { productType = "technologies.technologiesTechnologyDetails.report.direction.in"; } table.addCell(new Phrase(nodeNumber, FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(operationName, FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(translationService.translate(productType, locale), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(product.getStringField(ProductFields.NUMBER), FontUtils.getDejavuRegular7Dark())); table.addCell( new Phrase(product.getStringField(ProductFields.NAME), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(new Phrase(numberService.format(operationProductComponent.getField(L_QUANTITY)), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell( new Phrase(product.getStringField(ProductFields.UNIT), FontUtils.getDejavuRegular7Dark())); } } document.add(table); return translationService.translate("technologies.technologiesTechnologyDetails.report.fileName", locale); }