Example usage for com.lowagie.text Document add

List of usage examples for com.lowagie.text Document add

Introduction

In this page you can find the example usage for com.lowagie.text Document add.

Prototype


public boolean add(Element element) throws DocumentException 

Source Link

Document

Adds an Element to the Document.

Usage

From source file:com.qcadoo.mes.materialFlow.print.pdf.MaterialFlowPdfService.java

License:Open Source License

@Override
protected void buildPdfContent(final Document document, final Entity materialsInLocation, final Locale locale)
        throws DocumentException {
    Map<Entity, BigDecimal> reportData = materialFlowService
            .calculateMaterialQuantitiesInLocation(materialsInLocation);

    String documenTitle = translationService.translate("materialFlow.materialFlow.report.title", locale);
    String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale);
    pdfHelper.addDocumentHeader(document, "", documenTitle, documentAuthor,
            (Date) materialsInLocation.getField(TIME), materialsInLocation.getStringField(WORKER));

    PdfPTable panelTable = pdfHelper.createPanelTable(2);
    pdfHelper.addTableCellAsOneColumnTable(panelTable,
            translationService.translate("materialFlow.materialFlow.report.panel.materialFlowForDate", locale),
            ((Date) materialsInLocation.getField(MATERIAL_FLOW_FOR_DATE)).toString());
    pdfHelper.addTableCellAsOneColumnTable(panelTable,
            translationService.translate("materialFlow.materialFlow.report.panel.time", locale),
            ((Date) materialsInLocation.getField(TIME)).toString());

    List<Entity> materialsInLocationComponents = materialsInLocation
            .getHasManyField(MATERIALS_IN_LOCATION_COMPONENTS);
    List<String> names = new ArrayList<String>();
    for (Entity materialsInLocationComponent : materialsInLocationComponents) {
        Entity location = (Entity) materialsInLocationComponent.getField(LOCATION);
        names.add(location.getField(NUMBER).toString());
    }//  w ww . j a  v  a2s  .  c  o m
    pdfHelper.addTableCellAsOneColumnTable(panelTable,
            translationService.translate("materialFlow.materialFlow.report.panel.locations", locale), names);
    pdfHelper.addTableCellAsOneColumnTable(panelTable, "", "");

    panelTable.setSpacingBefore(20);
    panelTable.setSpacingAfter(20);
    document.add(panelTable);

    List<String> tableHeader = new ArrayList<String>();
    Map<String, HeaderAlignment> alignments = Maps.newHashMap();

    tableHeader
            .add(translationService.translate("materialFlow.materialFlow.report.columnHeader.number", locale));
    tableHeader.add(translationService.translate("materialFlow.materialFlow.report.columnHeader.name", locale));
    tableHeader.add(
            translationService.translate("materialFlow.materialFlow.report.columnHeader.quantity", locale));
    tableHeader.add(translationService.translate("materialFlow.materialFlow.report.columnHeader.unit", locale));

    alignments.put(translationService.translate("materialFlow.materialFlow.report.columnHeader.number", locale),
            HeaderAlignment.LEFT);
    alignments.put(translationService.translate("materialFlow.materialFlow.report.columnHeader.name", locale),
            HeaderAlignment.LEFT);
    alignments.put(
            translationService.translate("materialFlow.materialFlow.report.columnHeader.quantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(translationService.translate("materialFlow.materialFlow.report.columnHeader.unit", locale),
            HeaderAlignment.LEFT);

    PdfPTable table = pdfHelper.createTableWithHeader(4, tableHeader, false, alignments);

    for (Map.Entry<Entity, BigDecimal> data : reportData.entrySet()) {
        table.addCell(new Phrase(data.getKey().getStringField(NUMBER), FontUtils.getDejavuRegular7Dark()));
        table.addCell(new Phrase(data.getKey().getStringField(NAME), FontUtils.getDejavuRegular7Dark()));
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(new Phrase(numberService.format(data.getValue()), FontUtils.getDejavuRegular7Dark()));
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(new Phrase(data.getKey().getStringField(UNIT), FontUtils.getDejavuRegular7Dark()));
    }
    document.add(table);
}

From source file:com.qcadoo.mes.materialRequirements.print.pdf.MaterialRequirementPdfService.java

License:Open Source License

@Override
protected void buildPdfContent(final Document document, final Entity materialRequirement, final Locale locale)
        throws DocumentException {
    String documenTitle = translationService.translate("materialRequirements.materialRequirement.report.title",
            locale);/* w  w  w  . j  a v a 2 s  .com*/
    String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale);

    pdfHelper.addDocumentHeader(document, "", documenTitle, documentAuthor,
            materialRequirement.getDateField(MaterialRequirementFields.DATE));

    addPanel(document, materialRequirement, locale);

    document.add(new Paragraph(
            translationService.translate("materialRequirements.materialRequirement.report.paragrah", locale),
            FontUtils.getDejavuBold11Dark()));

    Map<String, HeaderAlignment> orderHeadersWithAlignments = Maps.newLinkedHashMap();
    orderHeadersWithAlignments.put(translationService.translate("orders.order.number.label", locale),
            HeaderAlignment.LEFT);
    orderHeadersWithAlignments.put(translationService.translate("orders.order.name.label", locale),
            HeaderAlignment.LEFT);
    orderHeadersWithAlignments.put(translationService.translate("orders.order.product.label", locale),
            HeaderAlignment.LEFT);
    orderHeadersWithAlignments.put(
            translationService
                    .translate("materialRequirements.materialRequirement.report.order.plannedQuantity", locale),
            HeaderAlignment.RIGHT);
    orderHeadersWithAlignments.put(translationService.translate(
            "materialRequirements.materialRequirement.report.product.unit", locale), HeaderAlignment.LEFT);

    addOrderSeries(document, materialRequirement, orderHeadersWithAlignments);

    document.add(new Paragraph(
            translationService.translate("materialRequirements.materialRequirement.report.paragrah2", locale),
            FontUtils.getDejavuBold11Dark()));

    Map<String, HeaderAlignment> productHeadersWithAlignments = Maps.newLinkedHashMap();
    productHeadersWithAlignments.put(translationService.translate("basic.product.number.label", locale),
            HeaderAlignment.LEFT);
    productHeadersWithAlignments.put(translationService.translate("basic.product.name.label", locale),
            HeaderAlignment.LEFT);
    productHeadersWithAlignments.put(
            translationService.translate("technologies.technologyOperationComponent.quantity.label", locale),
            HeaderAlignment.RIGHT);
    productHeadersWithAlignments.put(translationService.translate(
            "materialRequirements.materialRequirement.report.product.unit", locale), HeaderAlignment.LEFT);

    addTechnologySeries(document, materialRequirement, productHeadersWithAlignments);
}

From source file:com.qcadoo.mes.materialRequirements.print.pdf.MaterialRequirementPdfService.java

License:Open Source License

private void addPanel(final Document document, final Entity materialRequirement, final Locale locale)
        throws DocumentException {
    PdfPTable panelTable = pdfHelper.createPanelTable(2);
    pdfHelper.addTableCellAsOneColumnTable(
            panelTable, translationService
                    .translate("materialRequirements.materialRequirement.report.panel.number", locale),
            materialRequirement.getStringField(MaterialRequirementFields.NUMBER));
    pdfHelper.addTableCellAsOneColumnTable(panelTable,
            translationService.translate("materialRequirements.materialRequirement.report.panel.name", locale),
            StringUtils.isEmpty(materialRequirement.getStringField(MaterialRequirementFields.NAME)) ? ""
                    : materialRequirement.getStringField(MaterialRequirementFields.NAME));
    pdfHelper.addTableCellAsOneColumnTable(panelTable,
            translationService.translate("materialRequirements.materialRequirement.report.panel.mrpAlgorithm",
                    locale),/*  www . j  a  v a2 s . c  om*/
            translationService.translate(
                    "materialRequirements.materialRequirement.mrpAlgorithm.value."
                            + materialRequirement.getStringField(MaterialRequirementFields.MRP_ALGORITHM),
                    locale));
    pdfHelper.addTableCellAsOneColumnTable(panelTable, "", "");
    panelTable.setSpacingAfter(20);
    panelTable.setSpacingBefore(20);
    document.add(panelTable);
}

From source file:com.qcadoo.mes.materialRequirements.print.pdf.MaterialRequirementPdfService.java

License:Open Source License

private void addTechnologySeries(final Document document, final Entity materialRequirement,
        final Map<String, HeaderAlignment> headersWithAlignments) throws DocumentException {
    List<Entity> orders = materialRequirement.getManyToManyField(MaterialRequirementFields.ORDERS);
    MrpAlgorithm algorithm = MrpAlgorithm
            .parseString(materialRequirement.getStringField(MaterialRequirementFields.MRP_ALGORITHM));

    Map<Long, BigDecimal> neededProductQuantities = productQuantitiesService.getNeededProductQuantities(orders,
            algorithm, true);//from  w  w  w. j  a v a  2 s. co  m

    // TODO LUPO fix comparator
    // neededProductQuantities = SortUtil.sortMapUsingComparator(neededProductQuantities, new EntityNumberComparator());

    List<String> headers = Lists.newLinkedList(headersWithAlignments.keySet());
    PdfPTable table = pdfHelper.createTableWithHeader(headersWithAlignments.size(), headers, true,
            defaultOrderHeaderColumnWidth, headersWithAlignments);

    for (Entry<Long, BigDecimal> neededProductQuantity : neededProductQuantities.entrySet()) {
        Entity product = productQuantitiesService.getProduct(neededProductQuantity.getKey());
        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(neededProductQuantity.getValue()),
                FontUtils.getDejavuBold7Dark()));
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
        String unit = product.getStringField(ProductFields.UNIT);
        if (unit == null) {
            table.addCell(new Phrase("", FontUtils.getDejavuRegular7Dark()));
        } else {
            table.addCell(new Phrase(unit, FontUtils.getDejavuRegular7Dark()));
        }
    }
    document.add(table);
}

From source file:com.qcadoo.mes.materialRequirements.print.pdf.MaterialRequirementPdfService.java

License:Open Source License

private void addOrderSeries(final Document document, final Entity materialRequirement,
        final Map<String, HeaderAlignment> headersWithAlignments) throws DocumentException {
    List<Entity> orders = materialRequirement.getManyToManyField(MaterialRequirementFields.ORDERS);
    Collections.sort(orders, new EntityOrderNumberComparator());

    List<String> headers = Lists.newLinkedList(headersWithAlignments.keySet());
    PdfPTable table = pdfHelper.createTableWithHeader(headersWithAlignments.size(), headers, true,
            defaultMatReqHeaderColumnWidth, headersWithAlignments);

    for (Entity order : orders) {
        table.addCell(new Phrase(order.getStringField(OrderFields.NUMBER), FontUtils.getDejavuRegular7Dark()));
        table.addCell(new Phrase(order.getStringField(OrderFields.NAME), FontUtils.getDejavuRegular7Dark()));
        Entity product = (Entity) order.getField(OrderFields.PRODUCT);
        if (product == null) {
            table.addCell(new Phrase("", FontUtils.getDejavuRegular7Dark()));
            BigDecimal plannedQuantity = order.getDecimalField(OrderFields.PLANNED_QUANTITY);
            plannedQuantity = (plannedQuantity == null) ? BigDecimal.ZERO : plannedQuantity;
            table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            table.addCell(new Phrase(numberService.format(plannedQuantity), FontUtils.getDejavuRegular7Dark()));
            table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            table.addCell(new Phrase("", FontUtils.getDejavuRegular7Dark()));
        } else {/*  w  w  w  .  j  ava 2  s  .c om*/
            table.addCell(
                    new Phrase(product.getStringField(ProductFields.NAME), FontUtils.getDejavuRegular7Dark()));
            BigDecimal plannedQuantity = order.getDecimalField(OrderFields.PLANNED_QUANTITY);
            plannedQuantity = (plannedQuantity == null) ? BigDecimal.ZERO : plannedQuantity;
            table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            table.addCell(new Phrase(numberService.format(plannedQuantity), FontUtils.getDejavuRegular7Dark()));
            table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            String unit = product.getStringField(ProductFields.UNIT);
            if (unit == null) {
                table.addCell(new Phrase("", FontUtils.getDejavuRegular7Dark()));
            } else {
                table.addCell(new Phrase(unit, FontUtils.getDejavuRegular7Dark()));
            }
        }

    }
    document.add(table);
}

From source file:com.qcadoo.mes.orders.print.OrderReportPdf.java

License:Open Source License

private void addHeaderTable(Document document, Entity orderEntity, Locale locale) throws DocumentException {
    PdfPTable table = pdfHelper.createPanelTable(3);

    List<HeaderPair> headerValues = getDocumentHeaderTableContent(orderEntity, locale);
    for (HeaderPair pair : headerValues) {
        if (pair.getValue() != null && !pair.getValue().isEmpty()) {
            pdfHelper.addTableCellAsOneColumnTable(table, pair.getLabel(), pair.getValue());
        } else {/* w w w  .j  av  a  2  s  .  c om*/
            pdfHelper.addTableCellAsOneColumnTable(table, StringUtils.EMPTY, StringUtils.EMPTY);
        }
    }

    table.setSpacingAfter(20);

    document.add(table);
}

From source file:com.qcadoo.mes.orders.print.OrderReportPdf.java

License:Open Source License

private void addTableToDocument(Document document, Entity orderEntity, Locale locale, String headerKey,
        Map<String, String> values) throws DocumentException {
    document.add(
            new Paragraph(translationService.translate(headerKey, locale), FontUtils.getDejavuBold10Dark()));

    Map<String, HeaderAlignment> headerValues = Maps.newLinkedHashMap();
    for (String key : values.keySet()) {
        headerValues.put(translationService.translate(String.format(L_TRANSLATION_PATH, key), locale),
                HeaderAlignment.LEFT);//from   w w w.  ja va2s.c  o  m
    }

    PdfPTable table = pdfHelper.createTableWithHeader(values.size(), Lists.newArrayList(headerValues.keySet()),
            false, headerValues);
    table.getDefaultCell().disableBorderSide(PdfPCell.RIGHT);
    table.getDefaultCell().disableBorderSide(PdfPCell.LEFT);
    table.setHeaderRows(1);

    for (String value : values.values()) {
        table.addCell(createCell(value, Element.ALIGN_LEFT));
    }

    table.setSpacingAfter(20);

    document.add(table);
}

From source file:com.qcadoo.mes.productionCounting.print.ProductionBalancePdfService.java

License:Open Source License

@Override
protected void buildPdfContent(final Document document, final Entity productionBalance, final Locale locale)
        throws DocumentException {
    String documentTitle = translationService.translate("productionCounting.productionBalance.report.title",
            locale);//  w ww  . ja v a2 s  .c  o m
    String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale);

    pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor,
            productionBalance.getDateField(ProductionBalanceFields.DATE));

    PdfPTable leftPanel = createLeftPanel(productionBalance, locale);
    PdfPTable rightPanel = createRightPanel(productionBalance, locale);

    PdfPTable panelTable = pdfHelper.createPanelTable(2);
    panelTable.addCell(leftPanel);
    panelTable.addCell(rightPanel);
    panelTable.setSpacingAfter(20);
    panelTable.setSpacingBefore(20);
    document.add(panelTable);

    Entity order = productionBalance.getBelongsToField(ProductionBalanceFields.ORDER);

    if (order.getBooleanField(OrderFieldsPC.REGISTER_QUANTITY_IN_PRODUCT)) {
        addInputProductsBalance(document, productionBalance, locale);
    }
    if (order.getBooleanField(OrderFieldsPC.REGISTER_QUANTITY_OUT_PRODUCT)) {
        addOutputProductsBalance(document, productionBalance, locale);
    }

    String calculateOperationCostMode = productionBalance
            .getStringField(ProductionBalanceFields.CALCULATE_OPERATION_COST_MODE);

    if (productionCountingService.isCalculateOperationCostModeHourly(calculateOperationCostMode)) {
        if (productionCountingService.isTypeOfProductionRecordingForEach(
                order.getStringField(OrderFieldsPC.TYPE_OF_PRODUCTION_RECORDING))) {
            addMachineTimeBalance(document, productionBalance, locale);
            addLaborTimeBalance(document, productionBalance, locale);
        } else {
            addTimeBalanceAsPanel(document, productionBalance, locale);
        }
    } else if (productionCountingService.isCalculateOperationCostModePiecework(calculateOperationCostMode)) {
        addPieceworkBalance(document, productionBalance, locale);
    }
}

From source file:com.qcadoo.mes.productionCounting.print.ProductionBalancePdfService.java

License:Open Source License

public void addInputProductsBalance(final Document document, final Entity productionBalance,
        final Locale locale) throws DocumentException {
    List<String> inputProductsTableHeader = Lists.newArrayList();

    inputProductsTableHeader.add(translationService
            .translate("productionCounting.productionBalance.report.columnHeader.number", locale));
    inputProductsTableHeader.add(translationService
            .translate("productionCounting.productionBalance.report.columnHeader.productionName", locale));
    inputProductsTableHeader.add(translationService
            .translate("productionCounting.productionBalance.report.columnHeader.plannedQuantity", locale));
    inputProductsTableHeader.add(translationService
            .translate("productionCounting.productionBalance.report.columnHeader.usedQuantity", locale));
    inputProductsTableHeader// ww w .  ja va  2  s  .  co  m
            .add(translationService.translate(L_PRODUCTION_BALANCE_REPORT_COLUMN_HEADER_BALANCE, locale));
    inputProductsTableHeader.add(translationService.translate("basic.product.unit.label", locale));

    Map<String, HeaderAlignment> alignments = Maps.newHashMap();
    alignments.put(translationService.translate(
            "productionCounting.productionBalance.report.columnHeader.number", locale), HeaderAlignment.LEFT);
    alignments.put(
            translationService.translate(
                    "productionCounting.productionBalance.report.columnHeader.productionName", locale),
            HeaderAlignment.LEFT);
    alignments.put(
            translationService.translate(
                    "productionCounting.productionBalance.report.columnHeader.plannedQuantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(
            translationService
                    .translate("productionCounting.productionBalance.report.columnHeader.usedQuantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(translationService.translate(PCPBRCHB_LITERAL, locale), HeaderAlignment.RIGHT);
    alignments.put(translationService.translate("basic.product.unit.label", locale), HeaderAlignment.LEFT);

    List<Entity> inputProductsList = productionBalance
            .getHasManyField(ProductionBalanceFields.BALANCE_OPERATION_PRODUCT_IN_COMPONENTS);

    if (!inputProductsList.isEmpty()) {
        document.add(new Paragraph(
                translationService.translate("productionCounting.productionBalance.report.paragraph", locale),
                FontUtils.getDejavuBold11Dark()));

        inputProductsList = Lists.newLinkedList(inputProductsList);

        PdfPTable inputProductsTable = pdfHelper.createTableWithHeader(6, inputProductsTableHeader, false,
                alignments);

        for (Entity inputProduct : inputProductsList) {
            inputProductsTable.addCell(
                    new Phrase(inputProduct.getBelongsToField(BalanceOperationProductInComponentFields.PRODUCT)
                            .getStringField(ProductFields.NUMBER), FontUtils.getDejavuRegular9Dark()));
            inputProductsTable.addCell(
                    new Phrase(inputProduct.getBelongsToField(BalanceOperationProductInComponentFields.PRODUCT)
                            .getStringField(ProductFields.NAME), FontUtils.getDejavuRegular9Dark()));

            inputProductsTable.getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
            inputProductsTable.addCell(new Phrase(
                    numberService.format(
                            inputProduct.getField(BalanceOperationProductInComponentFields.PLANNED_QUANTITY)),
                    FontUtils.getDejavuRegular9Dark()));
            if (inputProduct.getField(BalanceOperationProductInComponentFields.USED_QUANTITY) == null) {
                inputProductsTable.addCell(new Phrase(L_N_A, FontUtils.getDejavuRegular9Dark()));
                inputProductsTable.addCell(new Phrase(L_N_A, FontUtils.getDejavuRegular9Dark()));
            } else {
                inputProductsTable.addCell(new Phrase(
                        numberService.format(
                                inputProduct.getField(BalanceOperationProductInComponentFields.USED_QUANTITY)),
                        FontUtils.getDejavuRegular9Dark()));
                inputProductsTable.addCell(new Phrase(
                        numberService.format(
                                inputProduct.getField(BalanceOperationProductInComponentFields.BALANCE)),
                        FontUtils.getDejavuRegular9Dark()));
            }
            inputProductsTable.getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
            inputProductsTable.addCell(
                    new Phrase(inputProduct.getBelongsToField(BalanceOperationProductInComponentFields.PRODUCT)
                            .getStringField(ProductFields.UNIT), FontUtils.getDejavuRegular9Dark()));
        }

        document.add(inputProductsTable);
    }
}

From source file:com.qcadoo.mes.productionCounting.print.ProductionBalancePdfService.java

License:Open Source License

public void addOutputProductsBalance(final Document document, final Entity productionBalance,
        final Locale locale) throws DocumentException {

    List<String> outputProductsTableHeader = Lists.newArrayList();

    outputProductsTableHeader.add(translationService
            .translate("productionCounting.productionBalance.report.columnHeader.number", locale));
    outputProductsTableHeader.add(translationService
            .translate("productionCounting.productionBalance.report.columnHeader.productionName", locale));
    outputProductsTableHeader.add(translationService
            .translate("productionCounting.productionBalance.report.columnHeader.plannedQuantity", locale));
    outputProductsTableHeader.add(translationService
            .translate("productionCounting.productionBalance.report.columnHeader.producedQuantity", locale));
    outputProductsTableHeader//  ww  w. ja v  a2  s  . com
            .add(translationService.translate(L_PRODUCTION_BALANCE_REPORT_COLUMN_HEADER_BALANCE, locale));
    outputProductsTableHeader.add(translationService.translate("basic.product.unit.label", locale));

    Map<String, HeaderAlignment> alignments = Maps.newHashMap();
    alignments.put(translationService.translate(
            "productionCounting.productionBalance.report.columnHeader.number", locale), HeaderAlignment.LEFT);

    alignments.put(
            translationService.translate(
                    "productionCounting.productionBalance.report.columnHeader.productionName", locale),
            HeaderAlignment.LEFT);

    alignments.put(
            translationService.translate(
                    "productionCounting.productionBalance.report.columnHeader.plannedQuantity", locale),
            HeaderAlignment.RIGHT);

    alignments.put(
            translationService.translate(
                    "productionCounting.productionBalance.report.columnHeader.producedQuantity", locale),
            HeaderAlignment.RIGHT);

    alignments.put(translationService.translate(PCPBRCHB_LITERAL, locale), HeaderAlignment.RIGHT);

    alignments.put(translationService.translate("basic.product.unit.label", locale), HeaderAlignment.LEFT);

    List<Entity> outputProductsList = productionBalance
            .getHasManyField(ProductionBalanceFields.BALANCE_OPERATION_PRODUCT_OUT_COMPONENTS);

    if (!outputProductsList.isEmpty()) {
        document.add(Chunk.NEWLINE);
        document.add(new Paragraph(
                translationService.translate("productionCounting.productionBalance.report.paragraph2", locale),
                FontUtils.getDejavuBold11Dark()));

        outputProductsList = Lists.newLinkedList(outputProductsList);

        PdfPTable outputProductsTable = pdfHelper.createTableWithHeader(6, outputProductsTableHeader, false,
                alignments);

        for (Entity outputProduct : outputProductsList) {
            outputProductsTable
                    .addCell(
                            new Phrase(
                                    outputProduct
                                            .getBelongsToField(
                                                    BalanceOperationProductOutComponentFields.PRODUCT)
                                            .getStringField(ProductFields.NUMBER),
                                    FontUtils.getDejavuRegular9Dark()));
            outputProductsTable
                    .addCell(
                            new Phrase(
                                    outputProduct
                                            .getBelongsToField(
                                                    BalanceOperationProductOutComponentFields.PRODUCT)
                                            .getStringField(ProductFields.NAME),
                                    FontUtils.getDejavuRegular9Dark()));

            outputProductsTable.getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
            outputProductsTable.addCell(new Phrase(
                    numberService.format(
                            outputProduct.getField(BalanceOperationProductOutComponentFields.PLANNED_QUANTITY)),
                    FontUtils.getDejavuRegular9Dark()));
            if (outputProduct.getField(BalanceOperationProductOutComponentFields.USED_QUANTITY) == null) {
                outputProductsTable.addCell(new Phrase(L_N_A, FontUtils.getDejavuRegular9Dark()));
                outputProductsTable.addCell(new Phrase(L_N_A, FontUtils.getDejavuRegular9Dark()));
            } else {
                outputProductsTable.addCell(new Phrase(
                        numberService.format(outputProduct
                                .getField(BalanceOperationProductOutComponentFields.USED_QUANTITY)),
                        FontUtils.getDejavuRegular9Dark()));
                outputProductsTable.addCell(new Phrase(
                        numberService.format(
                                outputProduct.getField(BalanceOperationProductOutComponentFields.BALANCE)),
                        FontUtils.getDejavuRegular9Dark()));
            }
            outputProductsTable.getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
            outputProductsTable
                    .addCell(
                            new Phrase(
                                    outputProduct
                                            .getBelongsToField(
                                                    BalanceOperationProductOutComponentFields.PRODUCT)
                                            .getStringField(ProductFields.UNIT),
                                    FontUtils.getDejavuRegular9Dark()));
        }

        document.add(outputProductsTable);
    }
}