Example usage for com.itextpdf.text.pdf PdfPTable setSpacingBefore

List of usage examples for com.itextpdf.text.pdf PdfPTable setSpacingBefore

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfPTable setSpacingBefore.

Prototype

public void setSpacingBefore(final float spacing) 

Source Link

Document

Sets the spacing before this table.

Usage

From source file:com.athena.chameleon.engine.utils.PDFWriterUtil.java

License:Apache License

/**
 * /*  w  w  w . jav  a2 s . c  o m*/
 *  box 
 *
 * @param section box  section ?
 * @param e box   element
 * @throws Exception
 */
public static void setBox(Section section, Element e) throws Exception {

    PdfPTable t = new PdfPTable(1);
    t.setSpacingBefore(1);
    t.setSpacingAfter(12);

    if (e.getAttributeValue("width") != null)
        t.setTotalWidth(Float.parseFloat(e.getAttributeValue("width")));

    PdfPCell cell = new PdfPCell();
    if (e.getAttributeValue("option") != null) {

        ColumnText col = new ColumnText(null);
        for (Element e1 : e.getChildren()) {
            if (e1.getAttributeValue("type").equals("red"))
                col.addText(new Phrase(e1.getText(), fnBoxRed));
            else
                col.addText(new Phrase(e1.getText(), fnBox));
        }
        cell.setColumn(col);

    } else {
        cell.setPhrase(new Phrase(e.getText(), fnBox));
    }

    cell.setPaddingLeft(10);
    cell.setLeading(0.0F, 1.8F);
    cell.setVerticalAlignment(com.itextpdf.text.Element.ALIGN_MIDDLE);
    cell.setBackgroundColor(new BaseColor(238, 236, 225));

    t.addCell(cell);

    section.add(t);

}

From source file:com.athena.chameleon.engine.utils.PDFWriterUtil.java

License:Apache License

/**
 * //from   w w  w . ja v  a2s .  co  m
 * box (Backgroud : Black)
 *
 * @param section box  section ?
 * @param e box   element
 * @throws Exception
 */
public static void setBoxB(Section section, Element e) throws Exception {

    PdfPTable t = new PdfPTable(1);
    t.setSpacingBefore(1);
    t.setSpacingAfter(12);

    if (e.getAttributeValue("width") != null)
        t.setTotalWidth(Float.parseFloat(e.getAttributeValue("width")));

    PdfPCell cell = new PdfPCell();
    if (e.getAttributeValue("option") != null) {

        ColumnText col = new ColumnText(null);
        for (Element e1 : e.getChildren()) {
            if (e1.getAttributeValue("type").equals("red"))
                col.addText(new Phrase(e1.getText(), fnBoxRed));
            else
                col.addText(new Phrase(e1.getText(), fnBoxWhite));
        }
        cell.setColumn(col);

    } else {
        cell.setPhrase(new Phrase(e.getText(), fnBoxWhite));
    }

    cell.setPaddingLeft(10);
    cell.setLeading(0.0F, 1.8F);
    cell.setVerticalAlignment(com.itextpdf.text.Element.ALIGN_MIDDLE);
    cell.setBackgroundColor(new BaseColor(0, 0, 0));

    t.addCell(cell);

    section.add(t);

}

From source file:com.athena.chameleon.engine.utils.PDFWriterUtil.java

License:Apache License

/**
 * //  w w  w .  j a  va  2s  .  co  m
 * box (Backgroud : White)
 *
 * @param section box  section ?
 * @param e box   element
 * @throws Exception
 */
public static void setBoxW(Section section, Element e) throws Exception {

    PdfPTable t = new PdfPTable(1);
    t.setSpacingBefore(1);
    t.setSpacingAfter(12);

    if (e.getAttributeValue("width") != null)
        t.setTotalWidth(Float.parseFloat(e.getAttributeValue("width")));

    PdfPCell cell = new PdfPCell();
    if (e.getAttributeValue("option") != null) {

        ColumnText col = new ColumnText(null);
        for (Element e1 : e.getChildren()) {
            if (e1.getAttributeValue("type").equals("red"))
                col.addText(new Phrase(e1.getText(), fnBoxRed));
            else
                col.addText(new Phrase(e1.getText(), fnBoxBlack));
        }
        cell.setColumn(col);

    } else {
        cell.setPhrase(new Phrase(e.getText(), fnBoxBlack));
    }

    cell.setPaddingLeft(10);
    cell.setLeading(0.0F, 1.8F);
    cell.setVerticalAlignment(com.itextpdf.text.Element.ALIGN_MIDDLE);
    cell.setBackgroundColor(new BaseColor(255, 255, 255));

    t.addCell(cell);

    section.add(t);

}

From source file:com.cs.sis.controller.gerador.GeradorPDF.java

private PdfPTable getTableDeItens(List<ItemDeVenda> itens) throws DocumentException {

    PdfPTable table = new PdfPTable(4);
    table.setWidths(new int[] { 5, 1, 1, 1 });
    table.setWidthPercentage(100f);// w w w .ja va 2s .  c o  m
    table.setSpacingBefore(10f);
    table.setSpacingAfter(10f);

    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

    table.getDefaultCell().setBackgroundColor(new BaseColor(60, 171, 198));
    table.addCell("Produto");
    table.addCell("Quantidade");
    table.addCell("Valor UN");
    table.addCell("Total");
    table.getDefaultCell().setBackgroundColor(null);

    for (ItemDeVenda it : itens) {
        table.addCell(it.getDescricaoProduto());

        table.addCell(new DecimalFormat("0.000").format(it.getQuantidade()));
        table.addCell(new DecimalFormat("0.00").format(it.getValorProduto()));
        table.addCell(new DecimalFormat("0.00").format(it.getTotal()));
    }

    return table;

}

From source file:com.cs.sis.controller.gerador.GeradorPDF.java

private PdfPTable getTableEstoqueProdutos(boolean valoresNegativos) throws DocumentException {
    double total_requisitado = 381624.18;

    Map<String, Double[]> saida = GeradorRelatorio.getRelatorioEstoqueProdutos(valoresNegativos);

    PdfPTable table = new PdfPTable(4);
    table.setWidths(new int[] { 5, 2, 1, 1 });
    table.setWidthPercentage(100f);//  ww  w  .ja va 2s .c  om
    table.setSpacingBefore(10f);
    table.setSpacingAfter(10f);

    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

    table.getDefaultCell().setBackgroundColor(new BaseColor(60, 171, 198));
    table.addCell("Produto");
    table.addCell("Quantidade em Estoque");
    table.addCell("Valor de Compra");
    table.addCell("SubTotal");
    table.getDefaultCell().setBackgroundColor(null);
    double quantidade = 0, total = 0;
    List<String> c = new ArrayList<String>();
    c.addAll(saida.keySet());
    Collections.sort(c);
    for (String produto : c) {

        Double[] val = saida.get(produto);

        double qt, vc, sub;
        qt = val[0];
        vc = val[1];
        sub = val[0] * val[1];

        if (qt > 0 && qt < 10000) {
            quantidade += qt;
            total += (qt * vc);
            table.addCell(produto);
            table.addCell(new DecimalFormat("0.000").format(qt));
            table.addCell(new DecimalFormat("0.00").format(vc));
            table.addCell(new DecimalFormat("0.00").format(qt * vc));
        } else {
            continue;
            //table.addCell(new DecimalFormat("0.00").format(val[1]));
            //table.addCell(new DecimalFormat("0.000").format(0));
            //table.addCell(new DecimalFormat("0.00").format(vc));
            //table.addCell(new DecimalFormat("0.00").format(0));
        }
        if (total_requisitado - 10 <= total && total <= total_requisitado + 10) {
            break;
        }

    }

    table.getDefaultCell().setBackgroundColor(new BaseColor(60, 171, 198));

    PdfPCell cell = new PdfPCell(new Paragraph("Total"));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(new BaseColor(60, 171, 198));
    table.addCell(cell);

    //table.addCell(OperacaoStringUtil.formatarStringValorIntegerEPonto(
    //       saida.size()) + " Produtos");

    //table.addCell(OperacaoStringUtil.formatarStringQuantidadeEPonto(quantidade)
    //        + " Itens");

    String tot = OperacaoStringUtil.formatarStringValorMoedaComDescricaoEPonto(381624.18);
    PdfPCell cel2 = new PdfPCell(new Paragraph(tot));
    cel2.setColspan(2);
    cel2.setHorizontalAlignment(Element.ALIGN_CENTER);
    cel2.setBackgroundColor(new BaseColor(60, 171, 198));
    table.addCell(cel2);

    //table.addCell(OperacaoStringUtil.formatarStringValorMoedaComDescricaoEPonto(total));
    //System.out.println(total);
    return table;
}

From source file:com.cs.sis.controller.gerador.GeradorPDF.java

private PdfPTable getTableEstoqueProdutos(boolean valoresNegativos, boolean paraLista,
        List<String> codigos_retirados, double total_requisitado) throws DocumentException {
    //double total_requisitado = 381624.18;

    Map<String, Double[]> saida = GeradorRelatorio.getRelatorioEstoqueProdutos(valoresNegativos,
            codigos_retirados);//from   www  . j a v  a 2s  .  c om

    PdfPTable table = new PdfPTable(4);
    table.setWidths(new int[] { 5, 2, 1, 1 });
    table.setWidthPercentage(100f);
    table.setSpacingBefore(10f);
    table.setSpacingAfter(10f);

    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

    table.getDefaultCell().setBackgroundColor(new BaseColor(60, 171, 198));
    table.addCell("Produto");
    table.addCell("Quantidade em Estoque");
    table.addCell("Valor de Compra");
    table.addCell("SubTotal");
    table.getDefaultCell().setBackgroundColor(null);
    double quantidade = 0, total = 0;
    List<String> c = new ArrayList<String>();
    c.addAll(saida.keySet());
    Collections.sort(c);
    for (String produto : c) {
        if (paraLista && total_requisitado <= total) {
            break;
        }

        Double[] val = saida.get(produto);

        double qt, vc, sub;
        qt = val[0];
        vc = val[1];
        sub = val[0] * val[1];

        if (qt > 0 && qt < 10000) {
            quantidade += qt;
            total += (qt * vc);
            table.addCell(produto);
            table.addCell(new DecimalFormat("0.000").format(qt));
            table.addCell(new DecimalFormat("0.00").format(vc));
            table.addCell(new DecimalFormat("0.00").format(qt * vc));
        } else {
            continue;
            //table.addCell(new DecimalFormat("0.00").format(val[1]));
            //table.addCell(new DecimalFormat("0.000").format(0));
            //table.addCell(new DecimalFormat("0.00").format(vc));
            //table.addCell(new DecimalFormat("0.00").format(0));
        }

    }

    table.getDefaultCell().setBackgroundColor(new BaseColor(60, 171, 198));

    PdfPCell cell = new PdfPCell(new Paragraph("Total"));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(new BaseColor(60, 171, 198));
    table.addCell(cell);

    //table.addCell(OperacaoStringUtil.formatarStringValorIntegerEPonto(
    //       saida.size()) + " Produtos");

    //table.addCell(OperacaoStringUtil.formatarStringQuantidadeEPonto(quantidade)
    //        + " Itens");

    String tot = OperacaoStringUtil.formatarStringValorMoedaComDescricaoEPonto(total_requisitado);
    PdfPCell cel2 = new PdfPCell(new Paragraph(tot));
    cel2.setColspan(2);
    cel2.setHorizontalAlignment(Element.ALIGN_CENTER);
    cel2.setBackgroundColor(new BaseColor(60, 171, 198));
    table.addCell(cel2);

    //table.addCell(OperacaoStringUtil.formatarStringValorMoedaComDescricaoEPonto(total));
    //System.out.println(total);
    return table;
}

From source file:com.cs.sis.controller.gerador.GeradorPDF.java

private PdfPTable getTableBalancoProdutos(Date inicio, Date fim) throws DocumentException {
    Map<String, Double[]> saida = GeradorRelatorio.getRelatorioDetalhadoSaidaProduto(inicio, fim);

    PdfPTable table = new PdfPTable(5);
    table.setWidths(new int[] { 5, 1, 1, 1, 1 });
    table.setWidthPercentage(100f);//from  w  w  w.j  a v a2 s .co m
    table.setSpacingBefore(10f);
    table.setSpacingAfter(10f);

    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

    table.getDefaultCell().setBackgroundColor(new BaseColor(60, 171, 198));
    table.addCell("Produto");
    table.addCell("Estoque");
    table.addCell("Compra");
    table.addCell("Venda");
    table.addCell("Lucro");
    table.getDefaultCell().setBackgroundColor(null);
    double compra = 0, venda = 0, lucro = 0, qt = 0;
    List<String> c = new ArrayList<String>();
    c.addAll(saida.keySet());
    Collections.sort(c);
    for (String produto : c) {
        table.addCell(produto);
        Double[] val = saida.get(produto);
        compra += val[0];
        venda += val[1];
        lucro += val[3];
        qt += val[2];
        table.addCell(new DecimalFormat("0.000").format(val[2]));
        table.addCell(new DecimalFormat("0.00").format(val[0]));
        table.addCell(new DecimalFormat("0.00").format(val[1]));
        table.addCell(new DecimalFormat("0.00").format(val[3]));
    }

    table.getDefaultCell().setBackgroundColor(new BaseColor(60, 171, 198));

    PdfPCell cell = new PdfPCell(new Paragraph("Total"));
    cell.setColspan(5);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(new BaseColor(60, 171, 198));
    table.addCell(cell);

    table.addCell(saida.size() + " Produtos");

    table.addCell(new DecimalFormat("0.000").format(qt));
    table.addCell(new DecimalFormat("0.00").format(compra));
    table.addCell(new DecimalFormat("0.00").format(venda));
    table.addCell(new DecimalFormat("0.00").format(lucro));

    return table;
}

From source file:com.cs.sis.controller.gerador.GeradorPDF.java

private PdfPTable getTableDebitoClientes(double maiorQue) throws DocumentException {
    List<Object[]> debitos = GeradorRelatorio.getRelatorioClientesComDebitoMaiorQue(maiorQue);

    PdfPTable table = new PdfPTable(2);
    table.setWidths(new int[] { 5, 2 });
    table.setWidthPercentage(100f);/*from   www.  j  av  a2  s .com*/
    table.setSpacingBefore(10f);
    table.setSpacingAfter(10f);

    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

    table.getDefaultCell().setBackgroundColor(new BaseColor(60, 171, 198));
    table.addCell("Cliente");
    table.addCell("Dbito");
    table.getDefaultCell().setBackgroundColor(null);
    double total = 0;
    for (Object[] d : debitos) {
        table.addCell((String) d[0]);
        double val = (double) d[1];
        table.addCell(OperacaoStringUtil.formatarStringValorMoedaEPonto(val));
        total += val;
    }

    table.getDefaultCell().setBackgroundColor(new BaseColor(60, 171, 198));

    PdfPCell cell = new PdfPCell(new Paragraph("Total"));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(new BaseColor(60, 171, 198));
    table.addCell(cell);

    table.addCell(OperacaoStringUtil.formatarStringValorMoedaComDescricaoEPonto(total));

    table.addCell("Quantidade de Clientes");
    table.addCell(OperacaoStringUtil.formatarStringValorInteger(debitos.size()));

    return table;
}

From source file:com.etest.pdfgenerator.InventoryCasesReportPDF.java

public InventoryCasesReportPDF() {
    Document document = null;/*from   ww  w. j  av a 2  s . co m*/
    Date date = new Date();

    try {
        document = new Document(PageSize.LETTER, 50, 50, 50, 50);
        PdfWriter.getInstance(document, outputStream);
        document.open();

        Font header = FontFactory.getFont("Times-Roman", 12, Font.BOLD);
        Font content = FontFactory.getFont("Times-Roman", 10);
        Font dateFont = FontFactory.getFont("Times-Roman", 8);

        Image img = null;
        try {
            img = Image.getInstance("C:\\eTest-images\\SUCN_seal.png");
            img.scaleToFit(60, 60);
            img.setAbsolutePosition(500, 700);
        } catch (BadElementException | IOException ex) {
            Logger.getLogger(TQCoveragePDF.class.getName()).log(Level.SEVERE, null, ex);
        }
        document.add(img);

        Paragraph reportTitle = new Paragraph();
        reportTitle.setAlignment(Element.ALIGN_CENTER);
        reportTitle.add(new Phrase("Inventory of Cases Report", header));
        document.add(reportTitle);

        Paragraph datePrinted = new Paragraph();
        datePrinted.setSpacingAfter(20f);
        datePrinted.setAlignment(Element.ALIGN_CENTER);
        datePrinted.add(
                new Phrase("Date printed: " + new SimpleDateFormat("dd MMMM yyyy").format(date), dateFont));
        document.add(datePrinted);

        PdfPTable table = new PdfPTable(4);
        table.setWidthPercentage(100);
        table.setWidths(new int[] { 100, 300, 100, 100 });
        table.setSpacingAfter(5f);

        PdfPCell cellOne = new PdfPCell(new Phrase("Subject"));
        cellOne.setBorder(Rectangle.NO_BORDER);
        cellOne.setPaddingLeft(10);
        cellOne.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        cellOne.setVerticalAlignment(Element.ALIGN_MIDDLE);

        PdfPCell cellTwo = new PdfPCell(new Phrase("Descriptive Title"));
        cellTwo.setBorder(Rectangle.NO_BORDER);
        cellTwo.setPaddingLeft(10);
        cellTwo.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        cellTwo.setVerticalAlignment(Element.ALIGN_MIDDLE);

        PdfPCell cellThree = new PdfPCell(new Phrase("No. of Cases"));
        cellThree.setBorder(Rectangle.NO_BORDER);
        cellThree.setPaddingLeft(10);
        cellThree.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellThree.setVerticalAlignment(Element.ALIGN_MIDDLE);

        PdfPCell cellFour = new PdfPCell(new Phrase("No. of Items"));
        cellFour.setBorder(Rectangle.NO_BORDER);
        cellFour.setPaddingLeft(10);
        cellFour.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellFour.setVerticalAlignment(Element.ALIGN_MIDDLE);

        table.addCell(cellOne);
        table.addCell(cellTwo);
        table.addCell(cellThree);
        table.addCell(cellFour);

        table.getDefaultCell().setBorderWidth(0f);
        document.add(table);

        for (InventoryOfCasesReport report : service.getInventoryOfCases()) {
            PdfPTable table2 = new PdfPTable(4);
            table2.setWidthPercentage(100);
            table2.setWidths(new int[] { 100, 300, 100, 100 });
            table2.setSpacingBefore(3f);
            table2.setSpacingAfter(3f);

            if (!service.getListOfSyllabusIdByCurriculumId(report.getCurriculumId()).isEmpty()) {
                if (!service
                        .getListOfCellCaseIdBySyllabusId(
                                service.getListOfSyllabusIdByCurriculumId(report.getCurriculumId()))
                        .isEmpty()) {
                    PdfPCell cell1 = new PdfPCell(new Paragraph(report.getSubject(), content));
                    cell1.setBorder(0);
                    cell1.setPaddingLeft(10);
                    cell1.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
                    cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    PdfPCell cell2 = new PdfPCell(new Paragraph(report.getDescriptiveTitle(), content));
                    cell2.setBorder(0);
                    cell2.setPaddingLeft(10);
                    cell2.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
                    cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    PdfPCell cell3 = new PdfPCell(new Paragraph(
                            String.valueOf(service.getTotalCellCasesBySyllabus(
                                    service.getListOfSyllabusIdByCurriculumId(report.getCurriculumId()))),
                            content));
                    cell3.setBorder(0);
                    cell3.setPaddingLeft(10);
                    cell3.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell3.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    PdfPCell cell4 = new PdfPCell(new Paragraph(
                            String.valueOf(service.getTotalCellItemsByCellCaseId(
                                    service.getListOfCellCaseIdBySyllabusId(service
                                            .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())))),
                            content));
                    cell4.setBorder(0);
                    cell4.setPaddingLeft(10);
                    cell4.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell4.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    table2.addCell(cell1);
                    table2.addCell(cell2);
                    table2.addCell(cell3);
                    table2.addCell(cell4);
                    document.add(table2);
                }
            }
        }
    } catch (DocumentException ex) {
        Logger.getLogger(InventoryItemsReportPDF.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        document.close();
    }
}

From source file:com.etest.pdfgenerator.InventoryItemsReportPDF.java

public InventoryItemsReportPDF() {
    Document document = null;/*from  w w  w. j av  a2s  . com*/
    Date date = new Date();

    try {
        document = new Document(PageSize.LETTER.rotate(), 50, 50, 50, 50);
        PdfWriter.getInstance(document, outputStream);
        document.open();

        Font header = FontFactory.getFont("Times-Roman", 12, Font.BOLD);
        Font content = FontFactory.getFont("Times-Roman", 10);
        Font dateFont = FontFactory.getFont("Times-Roman", 8);

        Image img = null;
        try {
            img = Image.getInstance("C:\\eTest-images\\SUCN_seal.png");
            img.scaleToFit(60, 60);
            img.setAbsolutePosition(650, 500);
        } catch (BadElementException | IOException ex) {
            Logger.getLogger(TQCoveragePDF.class.getName()).log(Level.SEVERE, null, ex);
        }
        document.add(img);

        Paragraph title1 = new Paragraph();
        title1.setAlignment(Element.ALIGN_CENTER);
        title1.add(new Phrase("Inventory of Items Report"));
        document.add(title1);

        Paragraph title2 = new Paragraph();
        title2.setAlignment(Element.ALIGN_CENTER);
        title2.add(new Phrase("Grouped According to the Revised Bloom's Taxonomy"));
        document.add(title2);

        Paragraph datePrinted = new Paragraph();
        datePrinted.setSpacingAfter(20f);
        datePrinted.setAlignment(Element.ALIGN_CENTER);
        datePrinted
                .add(new Phrase("Date printed: " + new SimpleDateFormat("dd MMMM yyyy").format(date), content));
        document.add(datePrinted);

        PdfPTable table = new PdfPTable(8);
        table.setWidthPercentage(100);
        table.setSpacingAfter(5f);

        for (int i = 0; i < tableHeader.length; i++) {
            PdfPCell cell = new PdfPCell(new Phrase(tableHeader[i], header));
            cell.setBorder(Rectangle.NO_BORDER);
            cell.setPaddingLeft(10);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            if (tableHeader[i].equals("Subject")) {
                cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
            } else {
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            }
            table.addCell(cell);
        }

        document.add(table);

        for (InventoryOfCasesReport report : service.getInventoryOfCases()) {
            PdfPTable table2 = new PdfPTable(8);
            table2.setWidthPercentage(100);
            table2.setSpacingBefore(3f);
            table2.setSpacingAfter(3f);

            if (!service.getListOfSyllabusIdByCurriculumId(report.getCurriculumId()).isEmpty()) {
                if (!service
                        .getListOfCellCaseIdBySyllabusId(
                                service.getListOfSyllabusIdByCurriculumId(report.getCurriculumId()))
                        .isEmpty()) {
                    PdfPCell cell1 = new PdfPCell(new Paragraph(report.getSubject(), content));
                    cell1.setBorder(0);
                    cell1.setPaddingLeft(10);
                    cell1.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
                    cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    PdfPCell cell2 = new PdfPCell(
                            new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy(
                                    service.getListOfCellCaseIdBySyllabusId(service
                                            .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())),
                                    tq.getBloomsClassId(BloomsClass.Remember.toString()))), content));
                    cell2.setBorder(0);
                    cell2.setPaddingLeft(10);
                    cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    PdfPCell cell3 = new PdfPCell(
                            new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy(
                                    service.getListOfCellCaseIdBySyllabusId(service
                                            .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())),
                                    tq.getBloomsClassId(BloomsClass.Understand.toString()))), content));
                    cell3.setBorder(0);
                    cell3.setPaddingLeft(10);
                    cell3.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell3.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    PdfPCell cell4 = new PdfPCell(
                            new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy(
                                    service.getListOfCellCaseIdBySyllabusId(service
                                            .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())),
                                    tq.getBloomsClassId(BloomsClass.Apply.toString()))), content));
                    cell4.setBorder(0);
                    cell4.setPaddingLeft(10);
                    cell4.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell4.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    PdfPCell cell5 = new PdfPCell(
                            new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy(
                                    service.getListOfCellCaseIdBySyllabusId(service
                                            .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())),
                                    tq.getBloomsClassId(BloomsClass.Analyze.toString()))), content));
                    cell5.setBorder(0);
                    cell5.setPaddingLeft(10);
                    cell5.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell5.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    PdfPCell cell6 = new PdfPCell(
                            new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy(
                                    service.getListOfCellCaseIdBySyllabusId(service
                                            .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())),
                                    tq.getBloomsClassId(BloomsClass.Evaluate.toString()))), content));
                    cell6.setBorder(0);
                    cell6.setPaddingLeft(10);
                    cell6.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell6.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    PdfPCell cell7 = new PdfPCell(
                            new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy(
                                    service.getListOfCellCaseIdBySyllabusId(service
                                            .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())),
                                    tq.getBloomsClassId(BloomsClass.Create.toString()))), content));
                    cell7.setBorder(0);
                    cell7.setPaddingLeft(10);
                    cell7.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell7.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    PdfPCell cell8 = new PdfPCell(new Paragraph(
                            String.valueOf(service.getTotalCellItemsByCellCaseId(
                                    service.getListOfCellCaseIdBySyllabusId(service
                                            .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())))),
                            content));
                    cell8.setBorder(0);
                    cell8.setPaddingLeft(10);
                    cell8.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell8.setVerticalAlignment(Element.ALIGN_MIDDLE);

                    table2.addCell(cell1);
                    table2.addCell(cell2);
                    table2.addCell(cell3);
                    table2.addCell(cell4);
                    table2.addCell(cell5);
                    table2.addCell(cell6);
                    table2.addCell(cell7);
                    table2.addCell(cell8);
                    document.add(table2);
                }
            }
        }
    } catch (DocumentException ex) {
        Logger.getLogger(InventoryItemsReportPDF.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        document.close();
    }
}