Example usage for com.itextpdf.text Document addCreator

List of usage examples for com.itextpdf.text Document addCreator

Introduction

In this page you can find the example usage for com.itextpdf.text Document addCreator.

Prototype


public boolean addCreator(String creator) 

Source Link

Document

Adds the creator to a Document.

Usage

From source file:report.pdfs.Rented_PDF_Report.java

private void addMetaData(Document document) {
    document.addTitle("Rented Overview Report");
    document.addSubject("Rented");
    document.addKeywords("Basics, Rented, Report");
    document.addAuthor("admin");
    document.addCreator(System.getProperty("user.name"));
}

From source file:report.pdfs.Slurry_PDF_Report.java

private void addMetaData(Document document) {
    document.addTitle("Slurry Overview Report");
    document.addSubject("Slurry");
    document.addKeywords("Basics, Slurry, Report");
    document.addAuthor("admin");
    document.addCreator(System.getProperty("user.name"));
}

From source file:report.pdfs.Vet_Visit_PDF_Report.java

private void addMetaData(Document document) {
    document.addTitle("Vet Visit Overview Report");
    document.addSubject("Vet Visit");
    document.addKeywords("Beef, Vet Visit, Report");
    document.addAuthor("admin");
    document.addCreator(System.getProperty("user.name"));
}

From source file:report.pdfs.Water_PDF_Report.java

private void addMetaData(Document document) {
    document.addTitle("Water Overview Report");
    document.addSubject("Water");
    document.addKeywords("Basics, Water, Report");
    document.addAuthor("admin");
    document.addCreator(System.getProperty("user.name"));
}

From source file:Report.RelatorioAluno.java

/**
 * funcao para gerar o stream do relatorio
 *
 * @return ByteArrayOutputStream//from w w w  . jav a2  s  .  c  om
 */
public ByteArrayOutputStream relatorioAlunosMatriculados() {

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    FacesContext faces = FacesContext.getCurrentInstance();
    // pega o contexto da aplicacao
    realPath = faces.getExternalContext().getRealPath("/");
    //realPath = "C:/Users/Alessandro/Desktop/TCC2/SisGES/build/web";

    try {
        BaseFont fHelvetica = BaseFont.createFont(BaseFont.HELVETICA, "Cp1252", false);

        //----------------------------------------------------------------------
        // creation of the document with a certain size and certain margins
        // may want to use PageSize.LETTER instead
        Document document = new Document(PageSize.A4, 40, 40, 20, 50);
        document.addAuthor("SisGES"); // optional
        document.addSubject("Relatrio"); // opcional
        document.addKeywords("SisGES");
        document.addCreator("iText");
        //----------------------------------------------------------------------
        // creation of the different writers
        //PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("web/resources/report/alunosMatriculados.pdf"));
        PdfWriter writer = PdfWriter.getInstance(document, baos);
        writer.setBoxSize("header", new Rectangle(36, 54, 559, 788));
        //----------------------------------------------------------------------
        // ADICIONA HEADER E FOOTER
        //----------------------------------------------------------------------
        HeaderFooter headerFooter = new HeaderFooter();
        writer.setPageEvent(headerFooter);
        //----------------------------------------------------------------------
        // ABRE DOCUMENTO PARA ESCRITA
        //----------------------------------------------------------------------
        document.open();
        //----------------------------------------------------------------------
        //ADICIONAR LOGO NO DOCUMENTO
        //----------------------------------------------------------------------
        Image logoUfu = Image.getInstance(realPath + "/resources/images/logoUFU.png");
        logoUfu.scaleAbsolute(57, 56);//(largura,altura)
        logoUfu.isImgTemplate(); //add no template
        //logoUfu.setAbsolutePosition(30, 745); //x ,y por referencia do rodape
        document.add(logoUfu);

        Image logoFacom = Image.getInstance(realPath + "/resources/images/logoFacom.png");
        logoFacom.scaleAbsolute(62, 55);//(largura,altura)
        logoFacom.setAbsolutePosition(92, 767); //x ,y por referencia do rodape
        //logoFacom.isImgTemplate(); //add no template            
        document.add(logoFacom);

        //----------------------------------------------------------------------
        //ADICIONAR CABEALHO
        //----------------------------------------------------------------------
        PdfContentByte univ = writer.getDirectContentUnder();
        univ.beginText();
        univ.setFontAndSize(fHelvetica, 10);
        univ.setTextMatrix(349, 805); // x e y
        univ.showText("UNIVERSIDADE FEDERAL DE UBERLNDIA");
        univ.setTextMatrix(405, 790); // x e y
        univ.showText("FACULDADE DE COMPUTAO");
        univ.setTextMatrix(403, 775); // x e y
        univ.showText("COORDENADORIA DE ESTGIO ");
        univ.endText();

        PdfContentByte univEnd = writer.getDirectContentUnder();
        univEnd.beginText();
        univEnd.setFontAndSize(fHelvetica, 7);
        univEnd.setTextMatrix(326, 761); // x e y
        univEnd.showText("Campus Universitrio - Santa Mnica - CEP 38408-100 - Uberlndia - MG");
        univEnd.setTextMatrix(432, 750); // x e y
        univEnd.showText("Telefone: (34) 3239-4144 ou 3239-4393");
        univEnd.endText();

        //----------------------------------------------------------------------
        //ADICIONAR TITULO
        //----------------------------------------------------------------------
        PdfContentByte titulo = writer.getDirectContentUnder();
        titulo.beginText();
        titulo.setFontAndSize(fHelvetica, 16);
        titulo.setTextMatrix(210, 700); // x e y
        titulo.showText("Alunos Matrculados");
        titulo.endText();
        //----------------------------------------------------------------------

        //----------------------------------------------------------------------
        AlunoDAO aDAO = new AlunoDAO();
        List<Aluno> allAlunos = aDAO.getAllAlunos();
        aDAO.closeSession();

        PdfPTable table = new PdfPTable(5);

        table.setTotalWidth(100f);
        table.setWidthPercentage(100);
        float[] widths = { 10, 30, 30, 13, 17 };//largura das colunas
        table.setWidths(widths);
        table.setHeaderRows(1);

        Paragraph cabecalho = new Paragraph("Matricula");
        PdfPCell cellMatricula = new PdfPCell(cabecalho); // celula
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        cellMatricula.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cellMatricula.setBorderColor(BaseColor.LIGHT_GRAY);
        cellMatricula.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cellMatricula);

        cabecalho = new Paragraph("Nome");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cellNome = new PdfPCell(cabecalho); // celula
        cellNome.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cellNome.setBorderColor(BaseColor.LIGHT_GRAY);
        cellNome.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cellNome);

        cabecalho = new Paragraph("Email");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cellEmail = new PdfPCell(cabecalho); // celula
        cellEmail.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cellEmail.setBorderColor(BaseColor.LIGHT_GRAY);
        cellEmail.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cellEmail);

        cabecalho = new Paragraph("Telefone");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cellTelefone = new PdfPCell(cabecalho); // celula
        cellTelefone.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cellTelefone.setBorderColor(BaseColor.LIGHT_GRAY);
        cellTelefone.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cellTelefone);

        cabecalho = new Paragraph("Curso");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cellCurso = new PdfPCell(cabecalho); // celula
        cellCurso.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cellCurso.setBorderColor(BaseColor.LIGHT_GRAY);
        cellCurso.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cellCurso);

        for (int i = 0; i < allAlunos.size(); i++) {
            Aluno aluno = allAlunos.get(i);
            Paragraph texto = new Paragraph(aluno.getMatricula());
            cellMatricula = new PdfPCell(texto); // celula
            cellMatricula.setBorderColor(BaseColor.LIGHT_GRAY);
            texto.getFont().setSize(8);
            table.addCell(cellMatricula);
            texto = new Paragraph(aluno.getNome());
            texto.getFont().setSize(8);
            cellNome = new PdfPCell(texto); // celula
            cellNome.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cellNome);
            texto = new Paragraph(aluno.getEmail());
            texto.getFont().setSize(8);
            cellEmail = new PdfPCell(texto); // celula
            cellEmail.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cellEmail);
            texto = new Paragraph(aluno.getTelefone());
            texto.getFont().setSize(8);
            cellTelefone = new PdfPCell(texto); // celula
            cellTelefone.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cellTelefone);
            texto = new Paragraph(aluno.getCursoidcurso().getNomecurso());
            texto.getFont().setSize(8);
            cellCurso = new PdfPCell(texto); // celula
            cellCurso.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cellCurso);

        }
        table.setSpacingBefore(100);
        table.setSpacingAfter(10);
        table.completeRow();

        document.add(table);
        //add nova pagina
        document.newPage();
        //close document
        document.close();
    } catch (DocumentException | IOException ex) {
        Logger.getLogger(RelatorioAluno.class.getName()).log(Level.SEVERE, null, ex);
    } catch (Exception ex) {
        Logger.getLogger(RelatorioAluno.class.getName()).log(Level.SEVERE, null, ex);
    }
    //return stream
    return baos;
}

From source file:Report.RelatorioBanca.java

/**
 * funcao para gerar o stream do relatorio
 *
 * @param banca/*from w  ww.  j a va 2 s . c o  m*/
 * @param listaConvidados
 * @param coordenador
 * @param campus
 * @return ByteArrayOutputStream
 */
public ByteArrayOutputStream relatorioAtaDeDefesa(Banca banca, List<Convidado> listaConvidados,
        Professor coordenador, Campus campus) {

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    FacesContext faces = FacesContext.getCurrentInstance();
    //pega o contexto da aplicacao
    String realPath = faces.getExternalContext().getRealPath("/");

    try {
        BaseFont fHelvetica = BaseFont.createFont(BaseFont.HELVETICA, "Cp1252", false);
        //----------------------------------------------------------------------
        // creation of the document with a certain size and certain margins
        // may want to use PageSize.LETTER instead
        Document document = new Document(PageSize.A4, 40, 40, 20, 50);
        document.addAuthor("SisGES"); // optional
        document.addSubject("Relatrio"); // opcional
        document.addKeywords("SisGES");
        document.addCreator("iText");
        //----------------------------------------------------------------------
        // creation of the different writers
        //PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("web/resources/report/alunosMatriculados.pdf"));
        PdfWriter writer = PdfWriter.getInstance(document, baos);
        writer.setBoxSize("header", new Rectangle(36, 54, 559, 788));
        //----------------------------------------------------------------------
        // ADICIONA HEADER E FOOTER
        //----------------------------------------------------------------------
        HeaderFooter headerFooter = new HeaderFooter();
        headerFooter.setY(760f);
        writer.setPageEvent(headerFooter);
        //----------------------------------------------------------------------
        // ABRE DOCUMENTO PARA ESCRITA
        //----------------------------------------------------------------------
        document.open();
        //----------------------------------------------------------------------
        //ADICIONAR LOGO NO DOCUMENTO
        //----------------------------------------------------------------------
        Image logoUfu = Image.getInstance(realPath + "/resources/images/logoUFUAta.png");
        logoUfu.scaleAbsolute(155, 39);//(largura,altura)
        logoUfu.isImgTemplate(); //add no template
        document.add(logoUfu);

        //----------------------------------------------------------------------
        //ADICIONAR CABEALHO
        //----------------------------------------------------------------------
        PdfContentByte univ = writer.getDirectContentUnder();
        univ.beginText();
        univ.setFontAndSize(fHelvetica, 10);
        univ.setTextMatrix(349, 816); // x e y
        univ.showText("UNIVERSIDADE FEDERAL DE UBERLNDIA");
        univ.setTextMatrix(405, 802); // x e y
        univ.showText("FACULDADE DE COMPUTAO");
        univ.setTextMatrix(403, 788); // x e y
        univ.showText("COORDENADORIA DE ESTGIO ");
        univ.endText();

        String info = "Campus Universitrio - " + campus.getNomecampus() + " - CEP " + campus.getCep() + " - "
                + campus.getCidade() + " - " + campus.getEstadosigla().toUpperCase();

        Chunk txtCampus = new Chunk(info);
        Paragraph paragraph0 = new Paragraph();
        paragraph0.setSpacingBefore(-10);
        paragraph0.setFont(new Font(fHelvetica, 7));
        paragraph0.add(txtCampus);
        paragraph0.setAlignment(Element.ALIGN_RIGHT);
        document.add(paragraph0);

        info = "Telefone: " + coordenador.getTelefone() + "   Email: " + coordenador.getEmail();
        Chunk txtCoordenador = new Chunk(info);
        Paragraph paragraph1 = new Paragraph();
        paragraph1.setSpacingBefore(-5);
        paragraph1.setSpacingAfter(10);
        paragraph1.setFont(new Font(fHelvetica, 7));
        paragraph1.add(txtCoordenador);
        paragraph1.setAlignment(Element.ALIGN_RIGHT);
        document.add(paragraph1);
        //            PdfContentByte univ = writer.getDirectContentUnder();
        //            univ.beginText();
        //            univ.setFontAndSize(fHelvetica, 12);
        //            univ.setTextMatrix(200, 815); // x e y
        //            univ.showText("UNIVERSIDADE FEDERAL DE UBERLNDIA");
        //            univ.setTextMatrix(235, 800); // x e y
        //            univ.showText("FACULDADE DE COMPUTAO");
        //            univ.endText();
        //
        //            PdfContentByte univEnd = writer.getDirectContentUnder();
        //            univEnd.beginText();
        //            univEnd.setFontAndSize(fHelvetica, 7);
        //            univEnd.setTextMatrix(210, 785); // x e y
        //            univEnd.showText("Campus Universitrio - Santa Mnica - CEP 38408-100 - Uberlndia - MG");
        //            univEnd.setTextMatrix(260, 775); // x e y
        //            univEnd.showText("Telefone: (34) 3239-4144 ou 3239-4393");
        //            univEnd.endText();

        //----------------------------------------------------------------------
        //ADICIONAR TITULO
        //----------------------------------------------------------------------
        PdfContentByte curso = writer.getDirectContentUnder();
        curso.beginText();
        curso.setFontAndSize(fHelvetica, 14);
        curso.setTextMatrix(140, 720); // x e y
        String cursoAluno;
        //curso.showText("Curso de Bacharelado em Cincia da Computao");
        cursoAluno = banca.getTrabalhoidtrabalho().getAlunomatricula().getCursoidcurso().getNomecurso();
        if (cursoAluno.contains("sistema")) {
            cursoAluno = "Bacharelado em Sistemas de Informao";
        } else {
            cursoAluno = "Bacharelado em Cincia da Computao";
        }

        curso.showText("Curso de " + cursoAluno);
        curso.endText();

        PdfContentByte titulo = writer.getDirectContentUnder();
        titulo.beginText();
        titulo.setFontAndSize(fHelvetica, 12);
        titulo.setTextMatrix(160, 660); // x e y
        titulo.showText("Ata de Defesa de Trabalho de Estgio Supervisionado");
        titulo.endText();
        //----------------------------------------------------------------------]
        String texto = "Ata da ___________ de defesa de Trabalho de Estgio Supervisionado, do Curso de Bacharelado "
                + "em Cincia da Computao, realizada em "
                + CalendarFormat.getDataBRtoDate(banca.getDatabanca()) + ", na " + banca.getLocalbanca()
                + ", s " + CalendarFormat.parseDateToTimeString(banca.getHorario()) + " horas, pelo aluno "
                + banca.getTrabalhoidtrabalho().getAlunomatricula().getNome() + " ("
                + banca.getTrabalhoidtrabalho().getAlunomatricula().getMatricula() + "). O trabalho "
                + "intitulado \"" + banca.getTrabalhoidtrabalho().getTitulo()
                + "\" foi apresentado pelo aluno em sesso pblica "
                + "com cerca de 1 hora de durao. Na ocasio, o aluno foi arguido oralmente pelos membros "
                + "da banca, sendo considerado ________________________ (aprovado/reprovado).";

        Chunk chunk1 = new Chunk(texto);
        Paragraph paragraph = new Paragraph();
        paragraph.setFont(new Font(fHelvetica, 12));
        paragraph.setSpacingBefore(170);
        paragraph.add(chunk1);
        paragraph.setAlignment(Element.ALIGN_JUSTIFIED);
        document.add(paragraph);

        document.add(Chunk.NEWLINE);
        texto = "Carga horria total do estgio: ____________ horas (preenchido pela coordenao de estgios)";
        Paragraph paragraph2 = new Paragraph();
        paragraph2.setSpacingBefore(15);
        paragraph2.setFont(new Font(fHelvetica, 10));
        paragraph2.add(texto);
        paragraph2.setAlignment(Element.ALIGN_JUSTIFIED);
        document.add(paragraph2);
        document.add(Chunk.NEWLINE);

        Paragraph paragraph3 = new Paragraph();
        paragraph3.setSpacingBefore(25);
        paragraph3.add("Uberlndia, " + CalendarFormat.getDataPorExtenso(banca.getDatabanca()) + ".");
        paragraph3.setAlignment(Element.ALIGN_JUSTIFIED);
        document.add(paragraph3);
        document.add(Chunk.NEWLINE);
        //----------------------------------------------------------------------
        PdfContentByte tituloMembros = writer.getDirectContentUnder();
        tituloMembros.beginText();
        tituloMembros.setFontAndSize(fHelvetica, 12);
        tituloMembros.setTextMatrix(220, 350); // x e y
        tituloMembros.showText("Membros da Banca Examinadora");
        tituloMembros.endText();
        //----------------------------------------------------------------------
        float x = 160f;
        float y = 300f; // distancia do fim da pagina
        //retorna orientador
        //-----------------------------------------------------
        //linha
        PdfContentByte linhaOrientador = writer.getDirectContentUnder();
        linhaOrientador.setLineWidth(1f); // mostrar linha
        linhaOrientador.setGrayStroke(0.5f); // 0 = preto, 1 = branco
        linhaOrientador.moveTo(x, y);
        linhaOrientador.lineTo(450f, y); // ate onde a linha vai
        linhaOrientador.stroke();
        //------------------------------------------------------
        //nome orientador
        PdfContentByte orientador = writer.getDirectContentUnder();
        orientador.beginText();
        orientador.setFontAndSize(fHelvetica, 12);
        orientador.setTextMatrix(x, y - 20); // x e y
        orientador.showText("Prof.Orientador - " + banca.getTrabalhoidtrabalho().getProfessorsiape().getNome());
        orientador.setTextMatrix(x, y - 35); // x e y
        orientador.showText("Presidente da banca");
        orientador.endText();

        y = y - 100;
        //retorna convidados
        for (int i = 0; i < listaConvidados.size(); i++) {
            Convidado convidado = listaConvidados.get(i);
            if (convidado.getConfirmado() == true) {
                //-----------------------------------------------------
                //linha
                PdfContentByte linha = writer.getDirectContentUnder();
                linha.setLineWidth(1f); // mostrar linha
                linha.setGrayStroke(0.5f); // 0 = preto, 1 = branco
                linha.moveTo(x, y);
                linha.lineTo(450f, y); // ate onde a linha vai
                linha.stroke();
                //------------------------------------------------------
                //nome convidado

                PdfContentByte conv = writer.getDirectContentUnder();
                conv.beginText();
                conv.setFontAndSize(fHelvetica, 12);
                conv.setTextMatrix(x, y - 20); // x e y
                conv.showText("Prof.Convidado - " + convidado.getProfessorsiape().getNome());
                conv.endText();
                //------------------------------------------------------
                y = y - 80;
            }
        }
        //add nova pagina
        document.newPage();
        //close document
        document.close();
    } catch (DocumentException | IOException ex) {
        Logger.getLogger(RelatorioBanca.class.getName()).log(Level.SEVERE, null, ex);
    }
    //return stream
    return baos;
}

From source file:Report.RelatorioBanca.java

/**
 * funcao para gerar o stream do relatorio de participaes em banca
 *
 * @param prof/*from  ww  w.ja  v  a 2  s .  c o m*/
 * @param listaOrientador
 * @param listaConvidado
 * @param dtinicial
 * @param dtfinal
 * @param coordenador
 * @param campus
 * @return ByteArrayOutputStream
 */
public ByteArrayOutputStream relatorioParticipacaoEmBanca(Professor prof, List<Banca> listaOrientador,
        List<Convidado> listaConvidado, Date dtinicial, Date dtfinal, Professor coordenador, Campus campus) {

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    FacesContext faces = FacesContext.getCurrentInstance();
    //pega o contexto da aplicacao
    String realPath = faces.getExternalContext().getRealPath("/");

    try {
        BaseFont fHelvetica = BaseFont.createFont(BaseFont.HELVETICA, "Cp1252", false);
        //----------------------------------------------------------------------
        //creation of the document with a certain size and certain margins
        //may want to use PageSize.LETTER instead
        Document document = new Document(PageSize.A4, 40, 40, 20, 50);
        document.addAuthor("SisGES"); // optional
        document.addSubject("Relatrio"); // opcional
        document.addKeywords("SisGES");
        document.addCreator("iText");
        //----------------------------------------------------------------------
        // creation of the different writers
        //PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("web/resources/report/alunosMatriculados.pdf"));
        PdfWriter writer = PdfWriter.getInstance(document, baos);
        writer.setBoxSize("header", new Rectangle(36, 54, 559, 788));
        //----------------------------------------------------------------------
        // ADICIONA HEADER E FOOTER
        //----------------------------------------------------------------------
        HeaderFooter headerFooter = new HeaderFooter();
        headerFooter.setY(760f);
        writer.setPageEvent(headerFooter);
        //----------------------------------------------------------------------
        //ABRE DOCUMENTO PARA ESCRITA
        //----------------------------------------------------------------------
        document.open();
        //----------------------------------------------------------------------
        //ADICIONAR LOGO NO DOCUMENTO
        //----------------------------------------------------------------------
        Image logoUfu = Image.getInstance(realPath + "/resources/images/logoUFUAta.png");
        logoUfu.scaleAbsolute(155, 39);//(largura,altura)
        logoUfu.isImgTemplate(); //add no template
        document.add(logoUfu);

        //----------------------------------------------------------------------
        //ADICIONAR CABEALHO
        //----------------------------------------------------------------------
        PdfContentByte univ = writer.getDirectContentUnder();
        univ.beginText();
        univ.setFontAndSize(fHelvetica, 10);
        univ.setTextMatrix(349, 816); // x e y
        univ.showText("UNIVERSIDADE FEDERAL DE UBERLNDIA");
        univ.setTextMatrix(405, 802); // x e y
        univ.showText("FACULDADE DE COMPUTAO");
        univ.setTextMatrix(403, 788); // x e y
        univ.showText("COORDENADORIA DE ESTGIO ");
        univ.endText();

        String info = "Campus Universitrio - " + campus.getNomecampus() + " - CEP " + campus.getCep() + " - "
                + campus.getCidade() + " - " + campus.getEstadosigla().toUpperCase();

        Chunk txtCampus = new Chunk(info);
        Paragraph paragraph0 = new Paragraph();
        paragraph0.setSpacingBefore(-10);
        paragraph0.setFont(new Font(fHelvetica, 7));
        paragraph0.add(txtCampus);
        paragraph0.setAlignment(Element.ALIGN_RIGHT);
        document.add(paragraph0);

        info = "Telefone: " + coordenador.getTelefone() + "   Email: " + coordenador.getEmail();
        Chunk txtCoordenador = new Chunk(info);
        Paragraph paragraph1 = new Paragraph();
        paragraph1.setSpacingBefore(-5);
        paragraph1.setSpacingAfter(10);
        paragraph1.setFont(new Font(fHelvetica, 7));
        paragraph1.add(txtCoordenador);
        paragraph1.setAlignment(Element.ALIGN_RIGHT);
        document.add(paragraph1);

        //            PdfContentByte univ = writer.getDirectContentUnder();
        //            univ.beginText();
        //            univ.setFontAndSize(fHelvetica, 12);
        //            univ.setTextMatrix(200, 815); // x e y
        //            univ.showText("UNIVERSIDADE FEDERAL DE UBERLNDIA");
        //            univ.setTextMatrix(235, 800); // x e y
        //            univ.showText("FACULDADE DE COMPUTAO");
        //            univ.endText();
        //
        //            PdfContentByte univEnd = writer.getDirectContentUnder();
        //            univEnd.beginText();
        //            univEnd.setFontAndSize(fHelvetica, 7);
        //            univEnd.setTextMatrix(210, 785); // x e y
        //            univEnd.showText("Campus Universitrio - Santa Mnica - CEP 38408-100 - Uberlndia - MG");
        //            univEnd.setTextMatrix(260, 775); // x e y
        //            univEnd.showText("Telefone: (34) 3239-4144 ou 3239-4393");
        //            univEnd.endText();
        //----------------------------------------------------------------------
        //ADICIONAR TITULO
        //----------------------------------------------------------------------
        PdfContentByte t1 = writer.getDirectContentUnder();
        t1.beginText();
        t1.setFontAndSize(fHelvetica, 14);
        t1.setTextMatrix(210, 735); // x e y
        t1.showText("Participao em Bancas");
        t1.endText();

        PdfContentByte t2 = writer.getDirectContentUnder();
        t2.beginText();
        t2.setFontAndSize(fHelvetica, 12);
        t2.setTextMatrix(190, 710); // x e y
        String periodo = CalendarFormat.getDataBRtoDate(dtinicial) + " at "
                + CalendarFormat.getDataBRtoDate(dtfinal);
        t2.showText("Perodo: " + periodo);
        t2.endText();

        PdfContentByte t3 = writer.getDirectContentUnder();
        t3.beginText();
        t3.setFontAndSize(fHelvetica, 12);
        t3.setTextMatrix(40, 675); // x e y
        t3.showText("Professor: " + prof.getNome());
        t3.endText();
        //----------------------------------------------------------------------
        //TABELA
        PdfPTable table = new PdfPTable(6);
        //espao do inicio da pagina
        table.setSpacingBefore(100f);
        table.setTotalWidth(110f);
        table.setWidthPercentage(100);
        float[] widths = { 13, 25, 22, 18, 12, 10 };//largura das 2 colunas
        table.setWidths(widths);
        table.setHeaderRows(1);

        //CABEALHO DA TABELA
        Paragraph cabecalho = new Paragraph("Matricula do Aluno");
        PdfPCell cell1 = new PdfPCell(cabecalho); // celula
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell1);

        cabecalho = new Paragraph("Nome do Aluno");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cell2 = new PdfPCell(cabecalho); // celula
        cell2.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell2.setBorderColor(BaseColor.LIGHT_GRAY);
        cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell2);

        cabecalho = new Paragraph("Ttulo do Trabalho");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cell3 = new PdfPCell(cabecalho); // celula
        cell3.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell3.setBorderColor(BaseColor.LIGHT_GRAY);
        cell3.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell3);

        cabecalho = new Paragraph("Nome do Orientador");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cell4 = new PdfPCell(cabecalho); // celula
        cell4.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell4.setBorderColor(BaseColor.LIGHT_GRAY);
        cell4.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell4);

        cabecalho = new Paragraph("Papel do Professor");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cell5 = new PdfPCell(cabecalho); // celula
        cell5.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell5.setBorderColor(BaseColor.LIGHT_GRAY);
        cell5.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell5);

        cabecalho = new Paragraph("Data Defesa");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cell6 = new PdfPCell(cabecalho); // celula
        cell6.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell6.setBorderColor(BaseColor.LIGHT_GRAY);
        cell6.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell6);

        for (int i = 0; i < listaOrientador.size(); i++) {
            Banca b = listaOrientador.get(i);

            Paragraph texto = new Paragraph(b.getTrabalhoidtrabalho().getAlunomatricula().getMatricula());
            texto.getFont().setSize(8);
            cell1 = new PdfPCell(texto); // celula
            cell1.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell1);

            texto = new Paragraph(b.getTrabalhoidtrabalho().getAlunomatricula().getNome());
            texto.getFont().setSize(8);
            cell2 = new PdfPCell(texto); // celula
            cell2.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell2);

            texto = new Paragraph(b.getTrabalhoidtrabalho().getTitulo());
            texto.getFont().setSize(8);
            cell3 = new PdfPCell(texto); // celula
            cell3.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell3);

            texto = new Paragraph(b.getTrabalhoidtrabalho().getProfessorsiape().getNome());
            texto.getFont().setSize(8);
            cell4 = new PdfPCell(texto); // celula
            cell4.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell4);

            texto = new Paragraph("Orientador");
            texto.getFont().setSize(8);
            cell5 = new PdfPCell(texto); // celula
            cell5.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell5);

            texto = new Paragraph(CalendarFormat.getDataBRtoDate(b.getDatabanca()));
            texto.getFont().setSize(8);
            cell6 = new PdfPCell(texto); // celula
            cell6.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell6);

            switch (i % 2) {
            case 0:
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
                break;
            case 1:

                break;
            }

        }

        for (int i = 0; i < listaConvidado.size(); i++) {
            Convidado c = listaConvidado.get(i);

            Paragraph texto = new Paragraph(
                    c.getBancaidbanca().getTrabalhoidtrabalho().getAlunomatricula().getMatricula());
            texto.getFont().setSize(8);
            cell1 = new PdfPCell(texto); // celula
            cell1.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell1);

            texto = new Paragraph(c.getBancaidbanca().getTrabalhoidtrabalho().getAlunomatricula().getNome());
            texto.getFont().setSize(8);
            cell2 = new PdfPCell(texto); // celula
            cell2.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell2);

            texto = new Paragraph(c.getBancaidbanca().getTrabalhoidtrabalho().getTitulo());
            texto.getFont().setSize(8);
            cell3 = new PdfPCell(texto); // celula
            cell3.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell3);

            texto = new Paragraph(c.getBancaidbanca().getTrabalhoidtrabalho().getProfessorsiape().getNome());
            texto.getFont().setSize(8);
            cell4 = new PdfPCell(texto); // celula
            cell4.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell4);

            texto = new Paragraph("Convidado");
            texto.getFont().setSize(8);
            cell5 = new PdfPCell(texto); // celula
            cell5.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell5);

            texto = new Paragraph(CalendarFormat.getDataBRtoDate(c.getBancaidbanca().getDatabanca()));
            texto.getFont().setSize(8);
            cell6 = new PdfPCell(texto); // celula
            cell6.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell6);

        }
        //add a tabela
        document.add(table);
        //-----------------------------------------------------
        // distancia do fim da pagina
        float y = 70f;
        float x = 160f;
        //-----------------------------------------------------
        //linha
        PdfContentByte linha = writer.getDirectContentUnder();
        linha.setLineWidth(1f); // mostrar linha
        linha.setGrayStroke(0.5f); // 0 = preto, 1 = branco
        linha.moveTo(x, y);
        linha.lineTo(450f, y); // ate onde a linha vai
        linha.stroke();
        //------------------------------------------------------
        //assinatura
        PdfContentByte a1 = writer.getDirectContentUnder();
        a1.beginText();
        a1.setFontAndSize(fHelvetica, 10);
        a1.setTextMatrix(x + 50, y - 15); // x e y
        a1.showText("Coordenao de Estgio Supervisionado");
        a1.endText();
        //------------------------------------------------------
        //assinatura
        PdfContentByte a2 = writer.getDirectContentUnder();
        a2.beginText();
        a2.setFontAndSize(fHelvetica, 10);
        a2.setTextMatrix(x + 50, y - 27); // x e y
        a2.showText("FACOM/UFU");
        a2.endText();

        //----------------------------------------------------------------------
        /*String texto = "Ata da defesa de Trabalho de Estgio Supervisionado, do Curso de Bacharelado"
         + "em Cincia da Computao, realizada em " + CalendarFormat.getDataBRtoDate(banca.getDatabanca()) + ", na " + banca.getLocalbanca()
         + ", s " + CalendarFormat.parseDateToTimeString(banca.getHorario()) + " horas, pelo aluno " + banca.getTrabalhoidtrabalho().getAlunomatricula().getNome()
         + " (" + banca.getTrabalhoidtrabalho().getAlunomatricula().getMatricula() + "). O trabalho "
         + "intitulado \"" + banca.getTrabalhoidtrabalho().getTitulo() + "\" foi apresentado pelo aluno em sesso pblica "
         + "com cerca de 1 hora de durao. Na ocasio, o aluno foi arguido oralmente pelos membros "
         + "da banca, sendo considerado ________________________ (aprovado/reprovado).";
         */
        //Chunk chunk1 = new Chunk(texto);
        //Paragraph paragraph = new Paragraph();
        // paragraph.setSpacingBefore(180);
        //paragraph.add(chunk1);
        //paragraph.setAlignment(Element.ALIGN_JUSTIFIED);
        //document.add(paragraph);
        //document.add(Chunk.NEWLINE);
        //Paragraph paragraph2 = new Paragraph();
        //paragraph2.setSpacingBefore(25);
        //paragraph2.add("Uberlndia, " + CalendarFormat.getDataPorExtenso(banca.getDatabanca()) + ".");
        //paragraph2.setAlignment(Element.ALIGN_JUSTIFIED);
        ///document.add(paragraph2);
        //document.add(Chunk.NEWLINE);
        //----------------------------------------------------------------------
        //----------------------------------------------------------------------
        //float x = 160f;
        //float y = 340f; // distancia do fim da pagina
        //retorna orientador
        //-----------------------------------------------------
        //linha
        //PdfContentByte linhaOrientador = writer.getDirectContentUnder();
        //linhaOrientador.setLineWidth(1f); // mostrar linha
        //linhaOrientador.setGrayStroke(0.5f); // 0 = preto, 1 = branco
        //linhaOrientador.moveTo(x, y);
        //linhaOrientador.lineTo(450f, y); // ate onde a linha vai
        //linhaOrientador.stroke();
        //------------------------------------------------------
        //nome orientador
        //PdfContentByte orientador = writer.getDirectContentUnder();
        //orientador.beginText();
        //orientador.setFontAndSize(fHelvetica, 12);
        //orientador.setTextMatrix(x, y - 20); // x e y
        //orientador.showText("Prof.Orientador - " + banca.getTrabalhoidtrabalho().getProfessorsiape().getNome());
        //orientador.setTextMatrix(x, y - 35); // x e y
        //orientador.showText("Presidente da banca");
        //orientador.endText();
        /*
         y = y - 100;
         //retorna convidados
         for (int i = 0; i < listaConvidados.size(); i++) {
         Convidado convidado = listaConvidados.get(i);
         if (convidado.getConfirmado() == true) {
         //-----------------------------------------------------
         //linha
         PdfContentByte linha = writer.getDirectContentUnder();
         linha.setLineWidth(1f); // mostrar linha
         linha.setGrayStroke(0.5f); // 0 = preto, 1 = branco
         linha.moveTo(x, y);
         linha.lineTo(450f, y); // ate onde a linha vai
         linha.stroke();
         //------------------------------------------------------
         //nome convidado
                
         PdfContentByte conv = writer.getDirectContentUnder();
         conv.beginText();
         conv.setFontAndSize(fHelvetica, 12);
         conv.setTextMatrix(x, y - 20); // x e y
         conv.showText("Prof.Convidado - " + convidado.getProfessorsiape().getNome());
         conv.endText();
         //------------------------------------------------------
         y = y - 80;
         }
         }
         */
        //----------------------------------------------------------------------
        //AlunoDAO aDAO = new AlunoDAO();
        //List<Aluno> allAlunos = aDAO.getAllAlunos();
        //aDAO.closeSession();
        //            PdfPTable table = new PdfPTable(5);
        //            table.setSpacingBefore(35f);
        //            table.setTotalWidth(100f);
        //            table.setWidthPercentage(100);
        //            float[] widths = {10, 30, 30, 13, 17};//largura das 2 colunas
        //            table.setWidths(widths);
        //            table.setHeaderRows(1);
        //
        //            Paragraph cabecalho = new Paragraph("Matricula");
        //            PdfPCell cellMatricula = new PdfPCell(cabecalho); // celula
        //            cabecalho.getFont().setStyle(Font.BOLD);
        //            cabecalho.getFont().setSize(8);
        //            cellMatricula.setBackgroundColor(BaseColor.LIGHT_GRAY);
        //            cellMatricula.setBorderColor(BaseColor.LIGHT_GRAY);
        //            cellMatricula.setHorizontalAlignment(Element.ALIGN_CENTER);
        //            table.addCell(cellMatricula);
        //
        //            cabecalho = new Paragraph("Nome");
        //            cabecalho.getFont().setStyle(Font.BOLD);
        //            cabecalho.getFont().setSize(8);
        //            PdfPCell cellNome = new PdfPCell(cabecalho); // celula
        //            cellNome.setBackgroundColor(BaseColor.LIGHT_GRAY);
        //            cellNome.setBorderColor(BaseColor.LIGHT_GRAY);
        //            cellNome.setHorizontalAlignment(Element.ALIGN_CENTER);
        //            table.addCell(cellNome);
        //
        //            cabecalho = new Paragraph("Email");
        //            cabecalho.getFont().setStyle(Font.BOLD);
        //            cabecalho.getFont().setSize(8);
        //            PdfPCell cellEmail = new PdfPCell(cabecalho); // celula
        //            cellEmail.setBackgroundColor(BaseColor.LIGHT_GRAY);
        //            cellEmail.setBorderColor(BaseColor.LIGHT_GRAY);
        //            cellEmail.setHorizontalAlignment(Element.ALIGN_CENTER);
        //            table.addCell(cellEmail);
        //
        //            cabecalho = new Paragraph("Telefone");
        //            cabecalho.getFont().setStyle(Font.BOLD);
        //            cabecalho.getFont().setSize(8);
        //            PdfPCell cellTelefone = new PdfPCell(cabecalho); // celula
        //            cellTelefone.setBackgroundColor(BaseColor.LIGHT_GRAY);
        //            cellTelefone.setBorderColor(BaseColor.LIGHT_GRAY);
        //            cellTelefone.setHorizontalAlignment(Element.ALIGN_CENTER);
        //            table.addCell(cellTelefone);
        //
        //            cabecalho = new Paragraph("Curso");
        //            cabecalho.getFont().setStyle(Font.BOLD);
        //            cabecalho.getFont().setSize(8);
        //            PdfPCell cellCurso = new PdfPCell(cabecalho); // celula
        //            cellCurso.setBackgroundColor(BaseColor.LIGHT_GRAY);
        //            cellCurso.setBorderColor(BaseColor.LIGHT_GRAY);
        //            cellCurso.setHorizontalAlignment(Element.ALIGN_CENTER);
        //            table.addCell(cellCurso);
        //            for (int i = 0; i < allAlunos.size(); i++) {
        //                Aluno aluno = allAlunos.get(i);
        //                Paragraph texto = new Paragraph(aluno.getMatricula());
        //                cellMatricula = new PdfPCell(texto); // celula
        //                cellMatricula.setBorderColor(BaseColor.LIGHT_GRAY);
        //                texto.getFont().setSize(8);
        //                table.addCell(cellMatricula);
        //                texto = new Paragraph(aluno.getNome());
        //                texto.getFont().setSize(8);
        //                cellNome = new PdfPCell(texto); // celula
        //                cellNome.setBorderColor(BaseColor.LIGHT_GRAY);
        //                table.addCell(cellNome);
        //                texto = new Paragraph(aluno.getEmail());
        //                texto.getFont().setSize(8);
        //                cellEmail = new PdfPCell(texto); // celula
        //                cellEmail.setBorderColor(BaseColor.LIGHT_GRAY);
        //                table.addCell(cellEmail);
        //                texto = new Paragraph(aluno.getTelefone());
        //                texto.getFont().setSize(8);
        //                cellTelefone = new PdfPCell(texto); // celula
        //                cellTelefone.setBorderColor(BaseColor.LIGHT_GRAY);
        //                table.addCell(cellTelefone);
        //                texto = new Paragraph(aluno.getCursoidcurso().getNomecurso());
        //                texto.getFont().setSize(8);
        //                cellCurso = new PdfPCell(texto); // celula
        //                cellCurso.setBorderColor(BaseColor.LIGHT_GRAY);
        //                table.addCell(cellCurso);
        //
        //                switch (i % 2) {
        //                    case 0:
        //                        cellMatricula.setBorderColor(BaseColor.LIGHT_GRAY);
        //                        cellMatricula.setBackgroundColor(BaseColor.LIGHT_GRAY);
        //                        break;
        //                    case 1:
        //
        //                        break;
        //                }
        //
        //            }
        //add nova pagina
        document.newPage();
        //close document
        document.close();
    } catch (DocumentException | IOException ex) {
        Logger.getLogger(RelatorioBanca.class.getName()).log(Level.SEVERE, null, ex);
    }
    //return stream com dados
    return baos;
}

From source file:Report.RelatorioCurso.java

/**
 * Funo para gerar o stream do relatrio anual de atividades
 *
 * @param proforiseparada/*  ww w.  java2 s  .  co m*/
 * @param sm
 * @param sa
 * @param am
 * @param aa
 * @param dtinicial
 * @param dtfinal
 * @param ano
 * @param cursoNome
 * @param coordenador
 * @param campus
 * @return ByteArrayOutputStream
 */
public ByteArrayOutputStream relatorioAnualDeAtividades(ArrayList<Professororientacaoseparada> proforiseparada,
        ArrayList<Sumariomatricula> sm, ArrayList<Sumarioaprovado> sa, ArrayList<Alunomatriculado> am,
        ArrayList<Alunoaprovado> aa, Date dtinicial, Date dtfinal, String ano, String cursoNome,
        Professor coordenador, Campus campus) {

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    FacesContext faces = FacesContext.getCurrentInstance();
    // pega o contexto da aplicacao
    realPath = faces.getExternalContext().getRealPath("/");
    //realPath = "C:/Users/Alessandro/Desktop/TCC2/SisGES/build/web";

    try {
        BaseFont fHelvetica = BaseFont.createFont(BaseFont.HELVETICA, "Cp1252", false);
        BaseFont fHelveticaBOLD = BaseFont.createFont(BaseFont.HELVETICA_BOLD, "Cp1252", false);

        //----------------------------------------------------------------------
        // creation of the document with a certain size and certain margins
        // may want to use PageSize.LETTER instead
        Document document = new Document(PageSize.A4, 40, 40, 20, 50);
        document.addAuthor("SisGES"); // optional
        document.addSubject("Relatrio"); // opcional
        document.addKeywords("SisGES");
        document.addCreator("iText");
        //----------------------------------------------------------------------
        // creation of the different writers
        //PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("web/resources/report/alunosMatriculados.pdf"));
        PdfWriter writer = PdfWriter.getInstance(document, baos);
        writer.setBoxSize("header", new Rectangle(36, 54, 559, 788));
        //----------------------------------------------------------------------
        // ADICIONA HEADER E FOOTER
        //----------------------------------------------------------------------
        HeaderFooter headerFooter = new HeaderFooter();
        writer.setPageEvent(headerFooter);
        //----------------------------------------------------------------------
        // ABRE DOCUMENTO PARA ESCRITA
        //----------------------------------------------------------------------
        document.open();
        //----------------------------------------------------------------------
        //ADICIONAR LOGO NO DOCUMENTO
        //----------------------------------------------------------------------
        Image logoUfu = Image.getInstance(realPath + "/resources/images/logoUFU.png");
        logoUfu.scaleAbsolute(57, 56);//(largura,altura)
        logoUfu.isImgTemplate(); //add no template
        //logoUfu.setAbsolutePosition(30, 745); //x ,y por referencia do rodape
        document.add(logoUfu);

        Image logoFacom = Image.getInstance(realPath + "/resources/images/logoFacom.png");
        logoFacom.scaleAbsolute(62, 55);//(largura,altura)
        logoFacom.setAbsolutePosition(92, 767); //x ,y por referencia do rodape
        //logoFacom.isImgTemplate(); //add no template
        document.add(logoFacom);

        //----------------------------------------------------------------------
        //ADICIONAR CABEALHO
        //----------------------------------------------------------------------
        PdfContentByte univ = writer.getDirectContentUnder();
        univ.beginText();
        univ.setFontAndSize(fHelvetica, 10);
        univ.setTextMatrix(349, 805); // x e y
        univ.showText("UNIVERSIDADE FEDERAL DE UBERLNDIA");
        univ.setTextMatrix(405, 790); // x e y
        univ.showText("FACULDADE DE COMPUTAO");
        univ.setTextMatrix(403, 775); // x e y
        univ.showText("COORDENADORIA DE ESTGIO ");
        univ.endText();

        String info = "Campus Universitrio - " + campus.getNomecampus() + " - CEP " + campus.getCep() + " - "
                + campus.getCidade() + " - " + campus.getEstadosigla().toUpperCase();

        Chunk txtCampus = new Chunk(info);
        Paragraph paragraph0 = new Paragraph();
        paragraph0.setSpacingBefore(-10);
        paragraph0.setFont(new Font(fHelvetica, 7));
        paragraph0.add(txtCampus);
        paragraph0.setAlignment(Element.ALIGN_RIGHT);
        document.add(paragraph0);

        info = "Telefone: " + coordenador.getTelefone() + "   Email: " + coordenador.getEmail();
        Chunk txtCoordenador = new Chunk(info);
        Paragraph paragraph1 = new Paragraph();
        paragraph1.setSpacingBefore(-5);
        paragraph1.setSpacingAfter(10);
        paragraph1.setFont(new Font(fHelvetica, 7));
        paragraph1.add(txtCoordenador);
        paragraph1.setAlignment(Element.ALIGN_RIGHT);
        document.add(paragraph1);

        //----------------------------------------------------------------------
        //ADICIONAR TITULO
        //----------------------------------------------------------------------
        PdfContentByte t1 = writer.getDirectContentUnder();
        t1.beginText();
        t1.setFontAndSize(fHelveticaBOLD, 12);
        t1.setTextMatrix(175, 700); // x e y
        t1.showText("RELATRIO ANUAL DE ATIVIDADES - " + ano);
        t1.endText();

        PdfContentByte t2 = writer.getDirectContentUnder();
        t2.beginText();
        t2.setFontAndSize(fHelveticaBOLD, 12);
        t2.setTextMatrix(160, 680); // x e y
        if (cursoNome.contains("sistema") || cursoNome.contains("Sistemas") || cursoNome.contains("Sistema")) {
            t2.showText("BACHARELADO EM SISTEMAS DE INFORMAO");
            cursoNome = "Sistemas de Informao";
        } else if (cursoNome.contains("cincia") || cursoNome.contains("Cincias")
                || cursoNome.contains("Cincia")) {
            t2.showText("BACHARELADO EM CINCIA DA COMPUTAO");
            cursoNome = "Cincia da Computao";
        } else {
            t2.showText("BACHARELADO EM " + cursoNome.toUpperCase());
        }
        t2.endText();

        Paragraph p0 = new Paragraph("1. Introduo");
        p0.setSpacingBefore(95);
        p0.getFont().setStyle(Font.BOLD);
        p0.getFont().setSize(12);
        document.add(p0);

        //----------------------------------------------------------------------
        String textoIntro = "Este documento tem o objetivo de apresentar as atividades da coordenao de estgio "
                + "supervisionado da Faculdade de Computao da Universidade Federal de Uberlndia. As principais "
                + "atividades desenvolvidas foram:";

        Chunk chunk1 = new Chunk(textoIntro);
        Paragraph paragraph = new Paragraph();
        paragraph.setSpacingBefore(20);
        paragraph.setSpacingAfter(10);
        paragraph.setFont(new Font(fHelvetica, 12));
        paragraph.add(chunk1);
        paragraph.setAlignment(Element.ALIGN_JUSTIFIED);
        document.add(paragraph);

        //lista
        List overview = new List(false, 10);
        overview.setAutoindent(true);
        overview.add("Aprovao dos documentos de matricula do estgio supervisionado;");
        overview.add("Alocao de professores orientadores de estgio;");
        overview.add(
                "Matrcula de alunos do curso de " + cursoNome + " na disciplina de estgio supervisionado;");
        overview.add("Acompanhamento das atividades do estagirio na empresa;");
        overview.add("Aprovao do Relatrio parcial/final do estagirio.");
        document.add(overview);

        String textoIntro2 = "Os resultados das atividades listadas so apresentados nas prximas sees.";

        Chunk chunk2 = new Chunk(textoIntro2);
        Paragraph paragraph2 = new Paragraph();
        paragraph2.setSpacingBefore(10);
        paragraph2.setSpacingAfter(10);
        paragraph2.setFont(new Font(fHelvetica, 12));
        paragraph2.add(chunk2);
        paragraph2.setAlignment(Element.ALIGN_JUSTIFIED);
        document.add(paragraph2);

        Paragraph p01 = new Paragraph("2. Sumrio das Atividades");
        p01.setSpacingBefore(5);
        p01.getFont().setStyle(Font.BOLD);
        p01.getFont().setSize(12);
        document.add(p01);

        //----------------------------------------------------------------------
        //FAZER SUMARIO
        //----------------------------------------------------------------------
        PdfPTable tabelaSumario = new PdfPTable(4);
        tabelaSumario.setTotalWidth(100f);
        tabelaSumario.setWidthPercentage(100);
        float[] widths = { 40, 20, 20, 20 };//largura das colunas
        tabelaSumario.setWidths(widths);
        tabelaSumario.setHeaderRows(1);

        Paragraph l1 = new Paragraph(" ");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        PdfPCell cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.WHITE);
        cell1.setBorderColor(BaseColor.WHITE);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaSumario.addCell(cell1);

        l1 = new Paragraph("Matrculas");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        PdfPCell cell2 = new PdfPCell(l1); // celula
        cell2.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell2.setBorderColor(BaseColor.LIGHT_GRAY);
        cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaSumario.addCell(cell2);

        l1 = new Paragraph("Aprovaes");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        PdfPCell cell3 = new PdfPCell(l1); // celula
        cell3.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell3.setBorderColor(BaseColor.LIGHT_GRAY);
        cell3.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaSumario.addCell(cell3);

        l1 = new Paragraph("Reprovaes");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        PdfPCell cell4 = new PdfPCell(l1); // celula
        cell4.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell4.setBorderColor(BaseColor.LIGHT_GRAY);
        cell4.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaSumario.addCell(cell4);

        int i = 0;
        for (Sumariomatricula m : sm) {
            Sumarioaprovado a = sa.get(i);

            Paragraph texto = new Paragraph(m.getTipoestagio());
            cell1 = new PdfPCell(texto); // celula
            cell1.setBorderColor(BaseColor.LIGHT_GRAY);
            cell1.setHorizontalAlignment(Element.ALIGN_LEFT);
            texto.getFont().setSize(8);
            tabelaSumario.addCell(cell1);

            if (m.getMatriculas() != null) {
                texto = new Paragraph(String.valueOf(m.getMatriculas()));
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaSumario.addCell(cell1);
            } else {
                texto = new Paragraph(String.valueOf(0));
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaSumario.addCell(cell1);
            }

            if (m.getTipoestagio().equalsIgnoreCase("Estgio Obrigatrio")
                    && a.getTipoestagio().equalsIgnoreCase("Estgio Obrigatrio")) {
                if (a.getAprovados() != null) {
                    //aprovados
                    texto = new Paragraph(String.valueOf(a.getAprovados()));
                    cell1 = new PdfPCell(texto); // celula
                    cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                    cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                    texto.getFont().setSize(8);
                    tabelaSumario.addCell(cell1);
                } else {
                    texto = new Paragraph(String.valueOf(0));
                    cell1 = new PdfPCell(texto); // celula
                    cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                    cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                    texto.getFont().setSize(8);
                    tabelaSumario.addCell(cell1);
                }

                //reprovados
                texto = new Paragraph(String.valueOf(0));
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaSumario.addCell(cell1);

            } else if (m.getTipoestagio().equalsIgnoreCase("Estgio No Obrigatrio")
                    && a.getTipoestagio().equalsIgnoreCase("Estgio No Obrigatrio")) {

                if (a.getAprovados() != null) {
                    //aprovados
                    texto = new Paragraph(String.valueOf(a.getAprovados()));
                    cell1 = new PdfPCell(texto); // celula
                    cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                    cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                    texto.getFont().setSize(8);
                    tabelaSumario.addCell(cell1);
                } else {
                    texto = new Paragraph(String.valueOf(0));
                    cell1 = new PdfPCell(texto); // celula
                    cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                    cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                    texto.getFont().setSize(8);
                    tabelaSumario.addCell(cell1);
                }

                //reprovados
                texto = new Paragraph(String.valueOf(0));
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaSumario.addCell(cell1);
            }
            i++;
        }
        tabelaSumario.setSpacingBefore(20);
        tabelaSumario.setSpacingAfter(20);
        tabelaSumario.completeRow();

        document.add(tabelaSumario);

        //----------------------------------------------------------------------
        //ALUNOS MATRICULADOS
        //----------------------------------------------------------------------
        Paragraph p1 = new Paragraph("3. Alunos Matriculados");
        p1.setSpacingBefore(5);
        p1.getFont().setStyle(Font.BOLD);
        p1.getFont().setSize(12);
        document.add(p1);

        p01 = new Paragraph("Estgio Obrigatrio");
        p01.setSpacingBefore(5);
        p01.getFont().setStyle(Font.BOLD);
        p01.getFont().setSize(10);
        document.add(p01);

        //----------------------------------------------------------------------
        //FAZER TABELA ALUNOS MATRICULADOS ESTAGIO OBRIGATORIO
        //----------------------------------------------------------------------
        PdfPTable tabelaAlunoMatriculadoEO = new PdfPTable(4);
        tabelaAlunoMatriculadoEO.setTotalWidth(100f);
        tabelaAlunoMatriculadoEO.setWidthPercentage(100);
        float[] widthsEO = { 20, 30, 30, 20 };//largura das colunas
        tabelaAlunoMatriculadoEO.setWidths(widthsEO);
        tabelaAlunoMatriculadoEO.setHeaderRows(1);

        l1 = new Paragraph("Matrculas");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoMatriculadoEO.addCell(cell1);

        l1 = new Paragraph("Nome");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoMatriculadoEO.addCell(cell1);

        l1 = new Paragraph("Orientador");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoMatriculadoEO.addCell(cell1);

        l1 = new Paragraph("Data de Matrcula");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoMatriculadoEO.addCell(cell1);

        for (int j = 0; j < am.size(); j++) {
            Alunomatriculado amat = am.get(j);
            if (amat.getTipoestagio().equalsIgnoreCase("Estgio Obrigatrio")
                    || amat.getTipoestagio().equalsIgnoreCase("Estgio Obrigatorio")
                    || amat.getTipoestagio().equalsIgnoreCase("Estagio Obrigatorio")) {

                Paragraph texto = new Paragraph(amat.getMatricula());
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoMatriculadoEO.addCell(cell1);

                texto = new Paragraph(amat.getNome());
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoMatriculadoEO.addCell(cell1);

                texto = new Paragraph(amat.getOrientador());
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoMatriculadoEO.addCell(cell1);

                texto = new Paragraph(CalendarFormat.getDataBRtoDate(amat.getDatamatricula()));
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoMatriculadoEO.addCell(cell1);
            }
        }

        tabelaAlunoMatriculadoEO.setSpacingBefore(20);
        tabelaAlunoMatriculadoEO.setSpacingAfter(20);
        tabelaAlunoMatriculadoEO.completeRow();

        document.add(tabelaAlunoMatriculadoEO);

        //----------------------------------------------------------------------
        //FAZER TABELA ALUNOS MATRICULADOS ESTAGIO NO OBRIGATORIO
        //----------------------------------------------------------------------
        p01 = new Paragraph("Estgio No Obrigatrio");
        p01.setSpacingBefore(5);
        p01.getFont().setStyle(Font.BOLD);
        p01.getFont().setSize(10);
        document.add(p01);

        PdfPTable tabelaAlunoMatriculadoENO = new PdfPTable(4);
        tabelaAlunoMatriculadoENO.setTotalWidth(100f);
        tabelaAlunoMatriculadoENO.setWidthPercentage(100);
        float[] widthsENO = { 20, 30, 30, 20 };//largura das colunas
        tabelaAlunoMatriculadoENO.setWidths(widthsENO);
        tabelaAlunoMatriculadoENO.setHeaderRows(1);

        l1 = new Paragraph("Matrculas");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoMatriculadoENO.addCell(cell1);

        l1 = new Paragraph("Nome");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoMatriculadoENO.addCell(cell1);

        l1 = new Paragraph("Orientador");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoMatriculadoENO.addCell(cell1);

        l1 = new Paragraph("Data de Matrcula");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoMatriculadoENO.addCell(cell1);

        for (int k = 0; k < am.size(); k++) {
            Alunomatriculado amat = am.get(k);

            if (amat.getTipoestagio().equalsIgnoreCase("Estgio No Obrigatrio")
                    || amat.getTipoestagio().equalsIgnoreCase("Estgio No Obrigatorio")
                    || amat.getTipoestagio().equalsIgnoreCase("Estagio No Obrigatorio")) {

                Paragraph texto = new Paragraph(amat.getMatricula());
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoMatriculadoENO.addCell(cell1);

                texto = new Paragraph(amat.getNome());
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoMatriculadoENO.addCell(cell1);

                texto = new Paragraph(amat.getOrientador());
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoMatriculadoENO.addCell(cell1);

                texto = new Paragraph(CalendarFormat.getDataBRtoDate(amat.getDatamatricula()));
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoMatriculadoENO.addCell(cell1);
            }

        }

        tabelaAlunoMatriculadoENO.setSpacingBefore(20);
        tabelaAlunoMatriculadoENO.setSpacingAfter(20);
        tabelaAlunoMatriculadoENO.completeRow();

        document.add(tabelaAlunoMatriculadoENO);

        //add nova pagina
        //document.newPage();
        //----------------------------------------------------------------------
        //ALUNOS APROVADOS EM ESTAGIO OBRIGATORIO
        //----------------------------------------------------------------------
        p1 = new Paragraph("4. Alunos Aprovados em Estgio Obrigatrio");
        p1.setSpacingBefore(20);
        p1.getFont().setStyle(Font.BOLD);
        p1.getFont().setSize(12);
        document.add(p1);

        PdfPTable tabelaAlunoAprovadoEO = new PdfPTable(5);
        tabelaAlunoAprovadoEO.setTotalWidth(100f);
        tabelaAlunoAprovadoEO.setWidthPercentage(100);
        float[] widthsAprovadoEO = { 20, 30, 30, 10, 10 };//largura das colunas
        tabelaAlunoAprovadoEO.setWidths(widthsAprovadoEO);
        tabelaAlunoAprovadoEO.setHeaderRows(1);

        l1 = new Paragraph("Matrculas");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoAprovadoEO.addCell(cell1);

        l1 = new Paragraph("Nome");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoAprovadoEO.addCell(cell1);

        l1 = new Paragraph("Orientador");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoAprovadoEO.addCell(cell1);

        l1 = new Paragraph("Data de Matrcula");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoAprovadoEO.addCell(cell1);

        l1 = new Paragraph("Data de Finalizao");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaAlunoAprovadoEO.addCell(cell1);

        for (int t = 0; t < aa.size(); t++) {
            Alunoaprovado aprov = aa.get(t);

            if (aprov.getTipoestagio().equalsIgnoreCase("Estgio Obrigatrio")
                    || aprov.getTipoestagio().equalsIgnoreCase("Estgio Obrigatorio")
                    || aprov.getTipoestagio().equalsIgnoreCase("Estagio Obrigatorio")) {

                Paragraph texto = new Paragraph(aprov.getMatricula());
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoAprovadoEO.addCell(cell1);

                texto = new Paragraph(aprov.getNome());
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoAprovadoEO.addCell(cell1);

                texto = new Paragraph(aprov.getOrientador());
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoAprovadoEO.addCell(cell1);

                texto = new Paragraph(CalendarFormat.getDataBRtoDate(aprov.getDatamatricula()));
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoAprovadoEO.addCell(cell1);

                texto = new Paragraph(CalendarFormat.getDataBRtoDate(aprov.getDatafinalizacao()));
                cell1 = new PdfPCell(texto); // celula
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
                texto.getFont().setSize(8);
                tabelaAlunoAprovadoEO.addCell(cell1);
            }
        }

        tabelaAlunoAprovadoEO.setSpacingBefore(20);
        tabelaAlunoAprovadoEO.setSpacingAfter(20);
        tabelaAlunoAprovadoEO.completeRow();

        document.add(tabelaAlunoAprovadoEO);

        //----------------------------------------------------------------------
        //ALUNOS APROVADOS EM ESTAGIO OBRIGATORIO
        //----------------------------------------------------------------------
        p1 = new Paragraph("5. Participao dos professores FACOM");
        p1.setSpacingBefore(20);
        p1.getFont().setStyle(Font.BOLD);
        p1.getFont().setSize(12);
        document.add(p1);

        //
        PdfPTable tabelaProfOriSeparada = new PdfPTable(3);
        tabelaProfOriSeparada.setTotalWidth(100f);
        tabelaProfOriSeparada.setWidthPercentage(100);
        float[] widths0 = { 60, 20, 20 };//largura das colunas
        tabelaProfOriSeparada.setWidths(widths0);
        tabelaProfOriSeparada.setHeaderRows(1);

        l1 = new Paragraph("Professor");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaProfOriSeparada.addCell(cell1);

        l1 = new Paragraph("Orientaes Estgio Obrigatrio");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaProfOriSeparada.addCell(cell1);

        l1 = new Paragraph("Orientaes Estgio No Obrigatrio");
        l1.getFont().setStyle(Font.BOLD);
        l1.getFont().setSize(8);
        cell1 = new PdfPCell(l1); // celula
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabelaProfOriSeparada.addCell(cell1);

        for (int ii = 0; ii < proforiseparada.size(); ii++) {

            Professororientacaoseparada profoe = proforiseparada.get(ii);

            Paragraph texto = new Paragraph(profoe.getNome());
            cell1 = new PdfPCell(texto); // celula
            cell1.setBorderColor(BaseColor.LIGHT_GRAY);
            cell1.setHorizontalAlignment(Element.ALIGN_LEFT);
            texto.getFont().setSize(8);
            tabelaProfOriSeparada.addCell(cell1);

            texto = new Paragraph(profoe.getOrientacoesestobrigatorio().toString());
            cell1 = new PdfPCell(texto); // celula
            cell1.setBorderColor(BaseColor.LIGHT_GRAY);
            cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
            texto.getFont().setSize(8);
            tabelaProfOriSeparada.addCell(cell1);

            texto = new Paragraph(profoe.getOrientacoesestnaoobrigatorio().toString());
            cell1 = new PdfPCell(texto); // celula
            cell1.setBorderColor(BaseColor.LIGHT_GRAY);
            cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
            texto.getFont().setSize(8);
            tabelaProfOriSeparada.addCell(cell1);

        }

        tabelaProfOriSeparada.setSpacingBefore(20);
        tabelaProfOriSeparada.setSpacingAfter(20);
        tabelaProfOriSeparada.completeRow();
        document.add(tabelaProfOriSeparada);

        //----------------------------------------------------------------------
        p1 = new Paragraph("6. Observaes e Consideraes Finais");
        p1.setSpacingBefore(20);
        p1.getFont().setStyle(Font.BOLD);
        p1.getFont().setSize(12);
        document.add(p1);

        String text6 = "O processo de matrcula, acompanhamento, composio de bancas e "
                + "defesas ocorreu sem nenhum problema ou acontecimento excepcional.";

        chunk1 = new Chunk(text6);
        paragraph = new Paragraph();
        paragraph.setSpacingBefore(20);
        paragraph.setSpacingAfter(10);
        paragraph.setFont(new Font(fHelvetica, 12));
        paragraph.add(chunk1);
        paragraph.setAlignment(Element.ALIGN_JUSTIFIED);
        document.add(paragraph);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        //-----------------------------------------------------
        Paragraph paragraphCab = new Paragraph();
        paragraphCab.setSpacingBefore(25);
        paragraphCab.add("Uberlndia, " + CalendarFormat.getDataPorExtenso(CalendarFormat.getDataSO()) + ".");
        paragraphCab.setAlignment(Element.ALIGN_JUSTIFIED);
        document.add(paragraphCab);
        document.add(Chunk.NEWLINE);
        //-----------------------------------------------------
        // distancia do fim da pagina
        float y = 120f;
        float x = 160f;
        //-----------------------------------------------------
        //linha
        PdfContentByte linha = writer.getDirectContentUnder();
        linha.setLineWidth(1f); // mostrar linha
        linha.setGrayStroke(0.5f); // 0 = preto, 1 = branco
        linha.moveTo(x, y);
        linha.lineTo(450f, y); // ate onde a linha vai
        linha.stroke();
        //assinatura
        PdfContentByte a0 = writer.getDirectContentUnder();
        a0.beginText();
        a0.setFontAndSize(fHelvetica, 10);
        a0.setTextMatrix(x + 50, y - 15); // x e y
        a0.showText("Prof. " + coordenador.getNome());
        a0.endText();
        PdfContentByte a1 = writer.getDirectContentUnder();
        a1.beginText();
        a1.setFontAndSize(fHelvetica, 10);
        a1.setTextMatrix(x + 50, y - 30); // x e y
        a1.showText("Coordenao de Estgio Supervisionado");
        a1.endText();
        //assinatura
        PdfContentByte a2 = writer.getDirectContentUnder();
        a2.beginText();
        a2.setFontAndSize(fHelvetica, 10);
        a2.setTextMatrix(x + 50, y - 45); // x e y
        a2.showText("SIAPE: " + coordenador.getSiape());
        a2.endText();
        //----------------------------------------------------------------------
        //FIM DO DOCUMENTO
        //add nova pagina
        document.newPage();
        //close document
        document.close();
        //----------------------------------------------------------------------
    } catch (DocumentException | IOException ex) {
        Logger.getLogger(RelatorioAluno.class.getName()).log(Level.SEVERE, null, ex);
    }
    //return stream
    return baos;
}

From source file:Report.RelatorioProfessor.java

/**
 * Funo para gerar o stream do relatorio de orientaes por professor
 *
 * @param lOrientacao/* w  w w .  j  a va2  s. co m*/
 * @param dtinicial
 * @param dtfinal
 * @param coordenador
 * @param campus
 * @return ByteArrayOutputStream
 */
public ByteArrayOutputStream relatorioProfessorOrientacao(List<Professororientacao> lOrientacao, Date dtinicial,
        Date dtfinal, Professor coordenador, Campus campus) {

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    FacesContext faces = FacesContext.getCurrentInstance();
    //pega o contexto da aplicacao
    String realPath = faces.getExternalContext().getRealPath("/");

    try {
        BaseFont fHelvetica = BaseFont.createFont(BaseFont.HELVETICA, "Cp1252", false);
        //----------------------------------------------------------------------
        //creation of the document with a certain size and certain margins
        //may want to use PageSize.LETTER instead
        Document document = new Document(PageSize.A4, 40, 40, 20, 50);
        document.addAuthor("SisGES"); // optional
        document.addSubject("Relatrio"); // opcional
        document.addKeywords("SisGES");
        document.addCreator("iText");
        //----------------------------------------------------------------------
        // creation of the different writers
        //PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("web/resources/report/alunosMatriculados.pdf"));
        PdfWriter writer = PdfWriter.getInstance(document, baos);
        writer.setBoxSize("header", new Rectangle(36, 54, 559, 788));
        //----------------------------------------------------------------------
        // ADICIONA HEADER E FOOTER
        //----------------------------------------------------------------------
        HeaderFooter headerFooter = new HeaderFooter();
        headerFooter.setY(760f);
        writer.setPageEvent(headerFooter);
        //----------------------------------------------------------------------
        //ABRE DOCUMENTO PARA ESCRITA
        //----------------------------------------------------------------------
        document.open();
        //----------------------------------------------------------------------
        //ADICIONAR LOGO NO DOCUMENTO
        //----------------------------------------------------------------------
        Image logoUfu = Image.getInstance(realPath + "/resources/images/logoUFUAta.png");
        logoUfu.scaleAbsolute(155, 39);//(largura,altura)
        logoUfu.isImgTemplate(); //add no template
        document.add(logoUfu);

        //----------------------------------------------------------------------
        //ADICIONAR CABEALHO
        //----------------------------------------------------------------------
        PdfContentByte univ = writer.getDirectContentUnder();
        univ.beginText();
        univ.setFontAndSize(fHelvetica, 10);
        univ.setTextMatrix(349, 816); // x e y
        univ.showText("UNIVERSIDADE FEDERAL DE UBERLNDIA");
        univ.setTextMatrix(405, 802); // x e y
        univ.showText("FACULDADE DE COMPUTAO");
        univ.setTextMatrix(403, 788); // x e y
        univ.showText("COORDENADORIA DE ESTGIO ");
        univ.endText();

        String info = "Campus Universitrio - " + campus.getNomecampus() + " - CEP " + campus.getCep() + " - "
                + campus.getCidade() + " - " + campus.getEstadosigla().toUpperCase();

        Chunk txtCampus = new Chunk(info);
        Paragraph paragraph0 = new Paragraph();
        paragraph0.setSpacingBefore(-10);
        paragraph0.setFont(new Font(fHelvetica, 7));
        paragraph0.add(txtCampus);
        paragraph0.setAlignment(Element.ALIGN_RIGHT);
        document.add(paragraph0);

        info = "Telefone: " + coordenador.getTelefone() + "   Email: " + coordenador.getEmail();
        Chunk txtCoordenador = new Chunk(info);
        Paragraph paragraph1 = new Paragraph();
        paragraph1.setSpacingBefore(-5);
        paragraph1.setSpacingAfter(10);
        paragraph1.setFont(new Font(fHelvetica, 7));
        paragraph1.add(txtCoordenador);
        paragraph1.setAlignment(Element.ALIGN_RIGHT);
        document.add(paragraph1);

        //            PdfContentByte univ = writer.getDirectContentUnder();
        //            univ.beginText();
        //            univ.setFontAndSize(fHelvetica, 12);
        //            univ.setTextMatrix(200, 815); // x e y
        //            univ.showText("UNIVERSIDADE FEDERAL DE UBERLNDIA");
        //            univ.setTextMatrix(235, 800); // x e y
        //            univ.showText("FACULDADE DE COMPUTAO");
        //            univ.endText();
        //
        //            PdfContentByte univEnd = writer.getDirectContentUnder();
        //            univEnd.beginText();
        //            univEnd.setFontAndSize(fHelvetica, 7);
        //            univEnd.setTextMatrix(210, 785); // x e y
        //            univEnd.showText("Campus Universitrio - Santa Mnica - CEP 38408-100 - Uberlndia - MG");
        //            univEnd.setTextMatrix(260, 775); // x e y
        //            univEnd.showText("Telefone: (34)3239-4144 ou 3239-4393");
        //            univEnd.endText();
        //----------------------------------------------------------------------
        //ADICIONAR TITULO
        //----------------------------------------------------------------------
        PdfContentByte t1 = writer.getDirectContentUnder();
        t1.beginText();
        t1.setFontAndSize(fHelvetica, 14);
        t1.setTextMatrix(180, 730); // x e y
        t1.showText("Participao dos professores FACOM");
        t1.endText();

        PdfContentByte t2 = writer.getDirectContentUnder();
        t2.beginText();
        t2.setFontAndSize(fHelvetica, 12);
        t2.setTextMatrix(195, 705); // x e y
        String periodo = CalendarFormat.getDataBRtoDate(dtinicial) + " at "
                + CalendarFormat.getDataBRtoDate(dtfinal);
        t2.showText("Perodo: " + periodo);
        t2.endText();

        //----------------------------------------------------------------------
        //TABELA
        PdfPTable table = new PdfPTable(4);
        //espao do inicio da pagina
        table.setSpacingBefore(100f);
        table.setTotalWidth(100f);
        table.setWidthPercentage(100);
        float[] widths = { 20, 30, 35, 15 };//largura das colunas
        table.setWidths(widths);
        table.setHeaderRows(1);

        //CABEALHO DA TABELA
        Paragraph cabecalho = new Paragraph("Siape");
        PdfPCell cell1 = new PdfPCell(cabecalho); // celula
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell1.setBorderColor(BaseColor.LIGHT_GRAY);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell1);

        cabecalho = new Paragraph("Professor");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cell2 = new PdfPCell(cabecalho); // celula
        cell2.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell2.setBorderColor(BaseColor.LIGHT_GRAY);
        cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell2);

        cabecalho = new Paragraph("Email do Professor");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cell4 = new PdfPCell(cabecalho); // celula
        cell4.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell4.setBorderColor(BaseColor.LIGHT_GRAY);
        cell4.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell4);

        cabecalho = new Paragraph("Orientaes");
        cabecalho.getFont().setStyle(Font.BOLD);
        cabecalho.getFont().setSize(8);
        PdfPCell cell3 = new PdfPCell(cabecalho); // celula
        cell3.setBackgroundColor(BaseColor.LIGHT_GRAY);
        cell3.setBorderColor(BaseColor.LIGHT_GRAY);
        cell3.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell3);

        for (int i = 0; i < lOrientacao.size(); i++) {
            Professororientacao po = lOrientacao.get(i);

            Paragraph texto = new Paragraph(String.valueOf(po.getSiape()));
            texto.getFont().setSize(8);
            cell1 = new PdfPCell(texto); // celula
            cell1.setBorderColor(BaseColor.LIGHT_GRAY);
            cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.addCell(cell1);

            texto = new Paragraph(po.getNome());
            texto.getFont().setSize(8);
            cell2 = new PdfPCell(texto); // celula
            cell2.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell2);

            texto = new Paragraph(po.getEmail());
            texto.getFont().setSize(8);
            cell4 = new PdfPCell(texto); // celula
            cell4.setBorderColor(BaseColor.LIGHT_GRAY);
            table.addCell(cell4);

            texto = new Paragraph(String.valueOf(po.getOrientacoes()));
            texto.getFont().setSize(8);
            cell3 = new PdfPCell(texto); // celula
            cell3.setBorderColor(BaseColor.LIGHT_GRAY);
            cell3.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.addCell(cell3);

            switch (i % 2) {
            case 0:
                cell1.setBorderColor(BaseColor.LIGHT_GRAY);
                cell1.setBackgroundColor(BaseColor.LIGHT_GRAY);
                break;
            case 1:

                break;
            }
        }

        //add a tabela
        document.add(table);
        //-----------------------------------------------------
        // distancia do fim da pagina
        float y = 70f;
        float x = 160f;
        //-----------------------------------------------------
        //linha
        PdfContentByte linha = writer.getDirectContentUnder();
        linha.setLineWidth(1f); // mostrar linha
        linha.setGrayStroke(0.5f); // 0 = preto, 1 = branco
        linha.moveTo(x, y);
        linha.lineTo(450f, y); // ate onde a linha vai
        linha.stroke();
        //------------------------------------------------------
        //assinatura
        PdfContentByte a1 = writer.getDirectContentUnder();
        a1.beginText();
        a1.setFontAndSize(fHelvetica, 10);
        a1.setTextMatrix(x + 50, y - 15); // x e y
        a1.showText("Coordenao de Estgio Supervisionado");
        a1.endText();
        //------------------------------------------------------
        //assinatura
        PdfContentByte a2 = writer.getDirectContentUnder();
        a2.beginText();
        a2.setFontAndSize(fHelvetica, 10);
        a2.setTextMatrix(x + 50, y - 27); // x e y
        a2.showText("FACOM/UFU");
        a2.endText();
        //------------------------------------------------------

        //add nova pagina
        document.newPage();
        //close document
        document.close();
    } catch (DocumentException | IOException ex) {
        Logger.getLogger(RelatorioProfessor.class.getName()).log(Level.SEVERE, null, ex);
    }
    //return stream com dados
    return baos;
}

From source file:reports.moh731_district.java

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException, SQLException, DocumentException {
    session = request.getSession();//from  ww w.j a  v a2s .c  om
    dbConn conn = new dbConn();
    String validitychecker = "";
    session = request.getSession();
    String FP_TAB = "";
    String MCH_TAB = "";
    String MATERNITY_TAB = "";
    String VCT_TAB = "";
    String DTC_TAB = "";
    String enterdby = "";
    //           if(session.getAttribute("forms_holder")!=null && !(session.getAttribute("forms_holder").toString().equals(","))){
    data = "";
    //           if(session.getAttribute("year")!=null){        
    //   year=session.getAttribute("year").toString();
    year = "2015";
    //    }
    //      if(session.getAttribute("monthid")!=null){        
    //   month=session.getAttribute("monthid").toString();
    //    }
    month = "4";

    //        if(session.getAttribute("facilityid")!=null){        
    //   facilityId=session.getAttribute("facilityid").toString();
    //    }
    facilityId = "403";
    //        if(session.getAttribute("subcountyid")!=null){        
    //   subcountyid=session.getAttribute("subcountyid").toString();
    //    }

    subcountyid = "8";
    id = year + "_" + month + "_" + facilityId;
    System.out.println("id is  " + id);
    invalidFPTXT = invalidPMTCTTXT = invalidMATTXT = invalidHTCTXT = "";
    //          id="2015_1_14498";
    String fppane = "";
    String pmctpane = "";
    String matpane = "";
    String htcpane = "";
    String activeclass = "";
    activeclass = "active";
    int counter = 0;
    isValidated = "";
    validity = "";
    expectedFP = 0;
    expectedPMTCT = 0;
    expectedMAT = 0;
    expectedHTC = 0;
    validPMTCT = 0;
    invalidPMTCT = 0;
    totalPMTCT = 0;
    validFP = invalidFP = totalFP = validMAT = invalidMAT = totalMAT = validHTC = invalidHTC = totalHTC;
    String getExpectedForms = "SELECT SUM(FP),SUM(PMTCT),SUM(Maternity),SUM(HTC) FROM subpartnera WHERE subpartnera.DistrictID='"
            + subcountyid + "'";
    conn.rs1 = conn.st1.executeQuery(getExpectedForms);
    if (conn.rs1.next() == true) {
        //       System.out.println("pmtct : "+conn.rs1.getString(1)+"  care : "+conn.rs1.getInt(2)+" pep : "+conn.rs1.getInt(3));
        expectedFP = conn.rs1.getInt(1);
        expectedPMTCT = conn.rs1.getInt(2);
        expectedMAT = conn.rs1.getInt(3);
        expectedHTC = conn.rs1.getInt(4);
    }
    validPMTCT = invalidPMTCT = totalPMTCT = 0;
    validFP = invalidFP = totalFP = 0;
    validMAT = invalidMAT = totalMAT = 0;
    validHTC = invalidHTC = totalHTC = 0;

    String getEntered = "SELECT moh711.isValidated,SUM(subpartnera.FP),SUM(subpartnera.PMTCT),SUM(subpartnera.Maternity),SUM(subpartnera.HTC)"
            + " FROM subpartnera JOIN moh711 ON subpartnera.SubPartnerID=moh711.SubPartnerID WHERE "
            + "moh711.Mois='" + month + "' AND moh711.Annee='" + year + "' AND subpartnera.DistrictID='"
            + subcountyid + "' GROUP BY moh711.isValidated";
    conn.rs1 = conn.st1.executeQuery(getEntered);
    while (conn.rs1.next()) {
        System.out.println("isvalidated : " + conn.rs1.getInt(1) + "  num : " + conn.rs1.getInt(2));
        if (conn.rs1.getInt(1) == 1) {
            validFP = conn.rs1.getInt(2);
            validPMTCT = conn.rs1.getInt(3);
            validMAT = conn.rs1.getInt(4);
            validHTC = conn.rs1.getInt(5);
        }
        if (conn.rs1.getInt(1) == 0) {
            invalidFP = conn.rs1.getInt(2);
            invalidPMTCT = conn.rs1.getInt(3);
            invalidMAT = conn.rs1.getInt(4);
            invalidHTC = conn.rs1.getInt(5);

        }
    }
    totalFP = validFP + invalidFP;
    totalPMTCT = validPMTCT + invalidPMTCT;
    totalMAT = validMAT + invalidMAT;
    totalHTC = validHTC + invalidHTC;

    invalidFPTXT = " Unvalidated Form(s) : 0";
    invalidPMTCTTXT = " Unvalidated Form(s) : 0";
    invalidMATTXT = " Unvalidated Form(s) : 0";
    invalidHTCTXT = " Unvalidated Form(s) : 0";

    if (invalidFP > 0) {
        invalidFPTXT = "<button type=\"button\" class=\"btn btn-primary btn-lg\" data-toggle=\"modal\" style=\"width:auto; height:auto;\" data-target=\"#unvalidatedModal\"> Unvalidated Form(s) : <span class=\"badge badge-important\">"
                + invalidFP + "</span></button>";
    }
    if (invalidPMTCT > 0) {
        invalidPMTCTTXT = "<button type=\"button\" class=\"btn btn-primary btn-lg\" data-toggle=\"modal\" style=\"width:auto; height:auto;\" data-target=\"#unvalidatedModal\"> Unvalidated Form(s) : <span class=\"badge badge-important\">"
                + invalidPMTCT + "</span></button>";
    }

    if (invalidMAT > 0) {
        invalidMATTXT = "<button type=\"button\" class=\"btn btn-primary btn-lg\" data-toggle=\"modal\" style=\"width:auto; height:auto;\" data-target=\"#unvalidatedModal\"> Unvalidated Form(s) : <span class=\"badge badge-important\">"
                + invalidMAT + "</span></button>";
    }

    if (invalidHTC > 0) {
        invalidHTCTXT = "<button type=\"button\" class=\"btn btn-primary btn-lg\" data-toggle=\"modal\" style=\"width:auto; height:auto;\" data-target=\"#unvalidatedModal\"> Unvalidated Form(s) : <span class=\"badge badge-important\">"
                + invalidHTC + "</span></button>";
    }

    String ul = "  <ul class=\"nav nav-tabs\">\n";

    // INITIALIZING VARIABLES 

    // FAMILY PLANNING            
    FPMicrolutN = FPMicrolutR = FPMicrolutT = FPMicrogynonN = FPMicrogynonR = FPMicrogynonT = FPINJECTIONSN = FPINJECTIONSR = "";
    FPINJECTIONST = FPIUCDN = FPIUCDR = FPIUCDT = FPIMPLANTSN = FPIMPLANTSR = FPIMPLANTST = FPBTLN = FPBTLR = FPBTLT = FPVasectomyN = FPVasectomyR = "";
    FPVasectomyT = FPCONDOMSN = FPCONDOMSR = FPCONDOMST = FPOTHERN = FPOTHERR = FPOTHERT = FPCLIENTSN = FPCLIENTSR = FPCLIENTST = FPIUCDRemoval = FPIMPLANTSRemoval = "";
    //PMCT VARIABLES
    PMCTA_1stVisit_ANC = PMCTA_ReVisit_ANC = PMCTANCClientsT = PMCTHB7 = PMCTIPT1 = PMCTIPT2 = PMCTANCClients4 = PMCTITN = MATNormalDelivery = MATCSection = "";

    MATBreech = MATAssistedVag = MATDeliveryT = MATLiveBirth = MATStillBirth = MATWeight2500 = MATPreTerm = MATDischargealive = MATReferral = MATNeoNatalD = MATMaternalD = MATAPHAlive = MATAPHDead = MATPPHAlive = MATPPHDead = MATEclampAlive = MATEclampDead = MATRupUtAlive = MATRupUtDead = MATObstrLaborAlive = MATObstrLaborDead = MATSepsisAlive = MATSepsisDead = "";

    VCTClient_Couns_CM = VCTClient_Couns_CF = VCTClient_Couns_AM = VCTClient_Couns_AF = VCTClient_Couns_TOT = VCTClient_Tested_CM = VCTClient_Tested_CF = VCTClient_Tested_AM = VCTClient_Tested_AF = VCTClient_Tested_TOT = VCTClient_HIV_CM = VCTClient_HIV_CF = VCTClient_HIV_AM = VCTClient_HIV_AF = VCTClient_HIV_TOT = VCTPartner_Couns_TOT = VCTPartner_Tested_TOT = VCTPartner_HIV_TOT = VCTPartner_Disc_TOT = "";

    DTCA_Couns_In_CM = DTCA_Couns_In_CF = DTCA_Couns_In_AM = DTCA_Couns_In_AF = DTCA_Couns_In_Tot = DTCA_Couns_Out_CM = DTCA_Couns_Out_CF = DTCA_Couns_Out_AM = DTCA_Couns_Out_AF = DTCA_Couns_Out_Tot = DTCB_Test_In_CM = DTCB_Test_In_CF = DTCB_Test_In_AM = DTCB_Test_In_AF = DTCB_Test_In_Tot = DTCB_Test_Out_CM = DTCB_Test_Out_CF = DTCB_Test_Out_AM = DTCB_Test_Out_AF = DTCB_Test_Out_Tot = DTCC_HIV_In_CM = DTCC_HIV_In_CF = DTCC_HIV_In_AM = DTCC_HIV_In_AF = DTCC_HIV_In_Tot = DTCC_HIV_Out_CM = DTCC_HIV_Out_CF = DTCC_HIV_Out_AM = DTCC_HIV_Out_AF = DTCC_HIV_Out_Tot = Userid = "";

    String checker = "SELECT * FROM moh711 WHERE id=?";
    conn.pst = conn.conn.prepareStatement(checker);
    conn.pst.setString(1, id);
    conn.rs = conn.pst.executeQuery();

    if (conn.rs.next() == true) {

        System.out.println("Data already exist loading............................");

        if (conn.rs.getString("FPMicrolutN") != null) {
            FPMicrolutN = conn.rs.getString("FPMicrolutN");
        } else if (FPMicrolutN == null) {
            FPMicrolutN = "";
        }

        FPMicrolutR = conn.rs.getString("FPMicrolutR");
        if (FPMicrolutR == null) {
            FPMicrolutR = "";
        }

        if (conn.rs.getString("FPMicrolutT") != null) {
            FPMicrolutT = conn.rs.getString("FPMicrolutT");
        } else {
            FPMicrolutT = "";
        }
        if (conn.rs.getString("FPMicrogynonN") != null) {
            FPMicrogynonN = conn.rs.getString("FPMicrogynonN");
        } else {
            FPMicrogynonN = "";
        }
        if (conn.rs.getString("FPMicrogynonR") != null) {
            FPMicrogynonR = conn.rs.getString("FPMicrogynonR");
        } else {
            FPMicrogynonR = "";
        }
        if (conn.rs.getString("FPMicrogynonT") != null) {
            FPMicrogynonT = conn.rs.getString("FPMicrogynonT");
        } else {
            FPMicrogynonT = "";
        }
        if (conn.rs.getString("FPINJECTIONSN") != null) {
            FPINJECTIONSN = conn.rs.getString("FPINJECTIONSN");
        } else {
            FPINJECTIONSN = "";
        }
        if (conn.rs.getString("FPINJECTIONSR") != null) {
            FPINJECTIONSR = conn.rs.getString("FPINJECTIONSR");
        } else {
            FPINJECTIONSR = "";
        }
        if (conn.rs.getString("FPINJECTIONST") != null) {
            FPINJECTIONST = conn.rs.getString("FPINJECTIONST");
        } else {
            FPINJECTIONST = "";
        }
        if (conn.rs.getString("FPIUCDN") != null) {
            FPIUCDN = conn.rs.getString("FPIUCDN");
        } else {
            FPIUCDN = "";
        }
        if (conn.rs.getString("FPIUCDR") != null) {
            FPIUCDR = conn.rs.getString("FPIUCDR");
        } else {
            FPIUCDR = "";
        }
        if (conn.rs.getString("FPIUCDT") != null) {
            FPIUCDT = conn.rs.getString("FPIUCDT");
        } else {
            FPIUCDT = "";
        }
        if (conn.rs.getString("FPIMPLANTSN") != null) {
            FPIMPLANTSN = conn.rs.getString("FPIMPLANTSN");
        } else {
            FPIMPLANTSN = "";
        }
        if (conn.rs.getString("FPIMPLANTSR") != null) {
            FPIMPLANTSR = conn.rs.getString("FPIMPLANTSR");
        } else {
            FPIMPLANTSR = "";
        }
        if (conn.rs.getString("FPIMPLANTST") != null) {
            FPIMPLANTST = conn.rs.getString("FPIMPLANTST");
        } else {
            FPIMPLANTST = "";
        }
        if (conn.rs.getString("FPBTLN") != null) {
            FPBTLN = conn.rs.getString("FPBTLN");
        } else {
            FPBTLN = "";
        }
        if (conn.rs.getString("FPBTLR") != null) {
            FPBTLR = conn.rs.getString("FPBTLR");
        } else {
            FPBTLR = "";
        }
        if (conn.rs.getString("FPBTLT") != null) {
            FPBTLT = conn.rs.getString("FPBTLT");
        } else {
            FPBTLT = "";
        }
        if (conn.rs.getString("FPVasectomyN") != null) {
            FPVasectomyN = conn.rs.getString("FPVasectomyN");
        } else {
            FPVasectomyN = "";
        }
        if (conn.rs.getString("FPVasectomyR") != null) {
            FPVasectomyR = conn.rs.getString("FPVasectomyR");
        } else {
            FPVasectomyR = "";
        }
        if (conn.rs.getString("FPVasectomyT") != null) {
            FPVasectomyT = conn.rs.getString("FPVasectomyT");
        } else {
            FPVasectomyT = "";
        }
        if (conn.rs.getString("FPCONDOMSN") != null) {
            FPCONDOMSN = conn.rs.getString("FPCONDOMSN");
        } else {
            FPCONDOMSN = "";
        }
        if (conn.rs.getString("FPCONDOMSR") != null) {
            FPCONDOMSR = conn.rs.getString("FPCONDOMSR");
        } else {
            FPCONDOMSR = "";
        }
        if (conn.rs.getString("FPCONDOMST") != null) {
            FPCONDOMST = conn.rs.getString("FPCONDOMST");
        } else {
            FPCONDOMST = "";
        }

        if (conn.rs.getString("FPOTHERN") != null) {
            FPOTHERN = conn.rs.getString("FPOTHERN");
        } else {
            FPOTHERN = "";
        }
        if (conn.rs.getString("FPOTHERR") != null) {
            FPOTHERR = conn.rs.getString("FPOTHERR");
        } else {
            FPOTHERR = "";
        }
        if (conn.rs.getString("FPOTHERT") != null) {
            FPOTHERT = conn.rs.getString("FPOTHERT");
        } else {
            FPOTHERT = "";
        }

        if (conn.rs.getString("FPCLIENTSN") != null) {
            FPCLIENTSN = conn.rs.getString("FPCLIENTSN");
        } else {
            FPCLIENTSN = "";
        }
        if (conn.rs.getString("FPCLIENTSR") != null) {
            FPCLIENTSR = conn.rs.getString("FPCLIENTSR");
        } else {
            FPCLIENTSR = "";
        }
        if (conn.rs.getString("FPCLIENTST") != null) {
            FPCLIENTST = conn.rs.getString("FPCLIENTST");
        } else {
            FPCLIENTST = "";
        }
        if (conn.rs.getString("FPIUCDRemoval") != null) {
            FPIUCDRemoval = conn.rs.getString("FPIUCDRemoval");
        } else {
            FPIUCDRemoval = "";
        }
        if (conn.rs.getString("FPIMPLANTSRemoval") != null) {
            FPIMPLANTSRemoval = conn.rs.getString("FPIMPLANTSRemoval");
        } else {
            FPIMPLANTSRemoval = "";
        }

        // mch 

        if (conn.rs.getString("PMCTA_1stVisit_ANC") != null) {
            PMCTA_1stVisit_ANC = conn.rs.getString("PMCTA_1stVisit_ANC");
        } else {
            PMCTA_1stVisit_ANC = "";
        }
        if (conn.rs.getString("PMCTA_ReVisit_ANC") != null) {
            PMCTA_ReVisit_ANC = conn.rs.getString("PMCTA_ReVisit_ANC");
        } else {
            PMCTA_ReVisit_ANC = "";
        }
        if (conn.rs.getString("PMCTANCClientsT") != null) {
            PMCTANCClientsT = conn.rs.getString("PMCTANCClientsT");
        } else {
            PMCTANCClientsT = "";
        }
        if (conn.rs.getString("PMCTHB7") != null) {
            PMCTHB7 = conn.rs.getString("PMCTHB7");
        } else {
            PMCTHB7 = "";
        }
        if (conn.rs.getString("PMCTIPT1") != null) {
            PMCTIPT1 = conn.rs.getString("PMCTIPT1");
        } else {
            PMCTIPT1 = "";
        }
        if (conn.rs.getString("PMCTIPT2") != null) {
            PMCTIPT2 = conn.rs.getString("PMCTIPT2");
        } else {
            PMCTIPT2 = "";
        }
        if (conn.rs.getString("PMCTANCClients4") != null) {
            PMCTANCClients4 = conn.rs.getString("PMCTANCClients4");
        } else {
            PMCTANCClients4 = "";
        }
        if (conn.rs.getString("PMCTITN") != null) {
            PMCTITN = conn.rs.getString("PMCTITN");
        } else {
            PMCTITN = "";
        }

        if (conn.rs.getString("MATNormalDelivery") != null) {
            MATNormalDelivery = conn.rs.getString("MATNormalDelivery");
        } else {
            MATNormalDelivery = "";
        }
        if (conn.rs.getString("MATCSection") != null) {
            MATCSection = conn.rs.getString("MATCSection");
        } else {
            MATCSection = "";
        }
        if (conn.rs.getString("MATBreech") != null) {
            MATBreech = conn.rs.getString("MATBreech");
        } else {
            MATBreech = "";
        }
        if (conn.rs.getString("MATAssistedVag") != null) {
            MATAssistedVag = conn.rs.getString("MATAssistedVag");
        } else {
            MATAssistedVag = "";
        }
        if (conn.rs.getString("MATDeliveryT") != null) {
            MATDeliveryT = conn.rs.getString("MATDeliveryT");
        } else {
            MATDeliveryT = "";
        }
        if (conn.rs.getString("MATLiveBirth") != null) {
            MATLiveBirth = conn.rs.getString("MATLiveBirth");
        } else {
            MATLiveBirth = "";
        }
        if (conn.rs.getString("MATStillBirth") != null) {
            MATStillBirth = conn.rs.getString("MATStillBirth");
        } else {
            MATStillBirth = "";
        }
        if (conn.rs.getString("FPBTLT") != null) {
            FPBTLT = conn.rs.getString("FPBTLT");
        } else {
            FPBTLT = "";
        }
        if (conn.rs.getString("MATWeight2500") != null) {
            MATWeight2500 = conn.rs.getString("MATWeight2500");
        } else {
            MATWeight2500 = "";
        }
        if (conn.rs.getString("MATPreTerm") != null) {
            MATPreTerm = conn.rs.getString("MATPreTerm");
        } else {
            MATPreTerm = "";
        }
        if (conn.rs.getString("MATDischargealive") != null) {
            MATDischargealive = conn.rs.getString("MATDischargealive");
        } else {
            MATDischargealive = "";
        }
        if (conn.rs.getString("MATReferral") != null) {
            MATReferral = conn.rs.getString("MATReferral");
        } else {
            MATReferral = "";
        }
        if (conn.rs.getString("MATNeoNatalD") != null) {
            MATNeoNatalD = conn.rs.getString("MATNeoNatalD");
        } else {
            MATNeoNatalD = "";
        }
        if (conn.rs.getString("MATMaternalD") != null) {
            MATMaternalD = conn.rs.getString("MATMaternalD");
        } else {
            MATMaternalD = "";
        }
        if (conn.rs.getString("MATAPHAlive") != null) {
            MATAPHAlive = conn.rs.getString("MATAPHAlive");
        } else {
            MATAPHAlive = "";
        }
        if (conn.rs.getString("MATAPHDead") != null) {
            MATAPHDead = conn.rs.getString("MATAPHDead");
        } else {
            MATAPHDead = "";
        }
        if (conn.rs.getString("MATPPHAlive") != null) {
            MATPPHAlive = conn.rs.getString("MATPPHAlive");
        } else {
            MATPPHAlive = "";
        }
        if (conn.rs.getString("MATPPHDead") != null) {
            MATPPHDead = conn.rs.getString("MATPPHDead");
        } else {
            MATPPHDead = "";
        }
        if (conn.rs.getString("MATEclampAlive") != null) {
            MATEclampAlive = conn.rs.getString("MATEclampAlive");
        } else {
            MATEclampAlive = "";
        }
        if (conn.rs.getString("MATEclampDead") != null) {
            MATEclampDead = conn.rs.getString("MATEclampDead");
        } else {
            MATEclampDead = "";
        }
        if (conn.rs.getString("MATRupUtAlive") != null) {
            MATRupUtAlive = conn.rs.getString("MATRupUtAlive");
        } else {
            MATRupUtAlive = "";
        }
        if (conn.rs.getString("MATRupUtDead") != null) {
            MATRupUtDead = conn.rs.getString("MATRupUtDead");
        } else {
            MATRupUtDead = "";
        }
        if (conn.rs.getString("MATObstrLaborAlive") != null) {
            MATObstrLaborAlive = conn.rs.getString("MATObstrLaborAlive");
        } else {
            MATObstrLaborAlive = "";
        }
        if (conn.rs.getString("MATObstrLaborDead") != null) {
            MATObstrLaborDead = conn.rs.getString("MATObstrLaborDead");
        } else {
            MATObstrLaborDead = "";
        }
        if (conn.rs.getString("MATSepsisAlive") != null) {
            MATSepsisAlive = conn.rs.getString("MATSepsisAlive");
        } else {
            MATSepsisAlive = "";
        }
        if (conn.rs.getString("MATSepsisDead") != null) {
            MATSepsisDead = conn.rs.getString("MATSepsisDead");
        } else {
            MATSepsisDead = "";
        }
        if (conn.rs.getString("VCTClient_Couns_CM") != null) {
            VCTClient_Couns_CM = conn.rs.getString("VCTClient_Couns_CM");
        } else {
            VCTClient_Couns_CM = "";
        }
        if (conn.rs.getString("VCTClient_Couns_CF") != null) {
            VCTClient_Couns_CF = conn.rs.getString("VCTClient_Couns_CF");
        } else {
            VCTClient_Couns_CF = "";
        }
        if (conn.rs.getString("VCTClient_Couns_AM") != null) {
            VCTClient_Couns_AM = conn.rs.getString("VCTClient_Couns_AM");
        } else {
            VCTClient_Couns_AM = "";
        }
        if (conn.rs.getString("VCTClient_Couns_AF") != null) {
            VCTClient_Couns_AF = conn.rs.getString("VCTClient_Couns_AF");
        } else {
            VCTClient_Couns_AF = "";
        }
        if (conn.rs.getString("VCTClient_Couns_TOT") != null) {
            VCTClient_Couns_TOT = conn.rs.getString("VCTClient_Couns_TOT");
        } else {
            VCTClient_Couns_TOT = "";
        }
        if (conn.rs.getString("VCTClient_Tested_CM") != null) {
            VCTClient_Tested_CM = conn.rs.getString("VCTClient_Tested_CM");
        } else {
            VCTClient_Tested_CM = "";
        }
        if (conn.rs.getString("VCTClient_Tested_CF") != null) {
            VCTClient_Tested_CF = conn.rs.getString("VCTClient_Tested_CF");
        } else {
            VCTClient_Tested_CF = "";
        }
        if (conn.rs.getString("VCTClient_Tested_AM") != null) {
            VCTClient_Tested_AM = conn.rs.getString("VCTClient_Tested_AM");
        } else {
            VCTClient_Tested_AM = "";
        }
        if (conn.rs.getString("VCTClient_Tested_AF") != null) {
            VCTClient_Tested_AF = conn.rs.getString("VCTClient_Tested_AF");
        } else {
            VCTClient_Tested_AF = "";
        }
        if (conn.rs.getString("VCTClient_Tested_TOT") != null) {
            VCTClient_Tested_TOT = conn.rs.getString("VCTClient_Tested_TOT");
        } else {
            VCTClient_Tested_TOT = "";
        }
        if (conn.rs.getString("VCTClient_HIV_CM") != null) {
            VCTClient_HIV_CM = conn.rs.getString("VCTClient_HIV_CM");
        } else {
            VCTClient_HIV_CM = "";
        }
        if (conn.rs.getString("VCTClient_HIV_CF") != null) {
            VCTClient_HIV_CF = conn.rs.getString("VCTClient_HIV_CF");
        } else {
            VCTClient_HIV_CF = "";
        }
        if (conn.rs.getString("VCTClient_HIV_AM") != null) {
            VCTClient_HIV_AM = conn.rs.getString("VCTClient_HIV_AM");
        } else {
            VCTClient_HIV_AM = "";
        }
        if (conn.rs.getString("VCTClient_HIV_AF") != null) {
            VCTClient_HIV_AF = conn.rs.getString("VCTClient_HIV_AF");
        } else {
            VCTClient_HIV_AF = "";
        }
        if (conn.rs.getString("VCTClient_HIV_TOT") != null) {
            VCTClient_HIV_TOT = conn.rs.getString("VCTClient_HIV_TOT");
        } else {
            VCTClient_HIV_TOT = "";
        }
        if (conn.rs.getString("VCTPartner_Couns_TOT") != null) {
            VCTPartner_Couns_TOT = conn.rs.getString("VCTPartner_Couns_TOT");
        } else {
            VCTPartner_Couns_TOT = "";
        }
        if (conn.rs.getString("VCTPartner_Tested_TOT") != null) {
            VCTPartner_Tested_TOT = conn.rs.getString("VCTPartner_Tested_TOT");
        } else {
            VCTPartner_Tested_TOT = "";
        }
        if (conn.rs.getString("VCTPartner_HIV_TOT") != null) {
            VCTPartner_HIV_TOT = conn.rs.getString("VCTPartner_HIV_TOT");
        } else {
            VCTPartner_HIV_TOT = "";
        }
        if (conn.rs.getString("VCTPartner_Disc_TOT") != null) {
            VCTPartner_Disc_TOT = conn.rs.getString("VCTPartner_Disc_TOT");
        } else {
            VCTPartner_Disc_TOT = "";
        }

        //  DTCA_Couns_In_CM=DTCA_Couns_In_CF=DTCA_Couns_In_AM=DTCA_Couns_In_AF=DTCA_Couns_In_Tot=DTCA_Couns_Out_CM=DTCA_Couns_Out_CF=
        //DTCA_Couns_Out_AM=DTCA_Couns_Out_AF=DTCA_Couns_Out_Tot=DTCB_Test_In_CM=DTCB_Test_In_CF
        //=DTCB_Test_In_AM=DTCB_Test_In_AF=DTCB_Test_In_Tot=DTCB_Test_Out_CM=DTCB_Test_Out_CF=DTCB_Test_Out_AM=DTCB_Test_Out_AF=DTCB_Test_Out_Tot
        //=DTCC_HIV_In_CM=DTCC_HIV_In_CF=DTCC_HIV_In_AM
        //=DTCC_HIV_In_AF= DTCC_HIV_In_Tot=DTCC_HIV_Out_CM=DTCC_HIV_Out_CF=DTCC_HIV_Out_AM=DTCC_HIV_Out_AF=DTCC_HIV_Out_Tot=Userid="";

        //dtc
        if (conn.rs.getString("DTCA_Couns_In_CM") != null) {
            DTCA_Couns_In_CM = conn.rs.getString("DTCA_Couns_In_CM");
        } else {
            DTCA_Couns_In_CM = "";
        }
        if (conn.rs.getString("DTCA_Couns_In_CF") != null) {
            DTCA_Couns_In_CF = conn.rs.getString("DTCA_Couns_In_CF");
        } else {
            DTCA_Couns_In_CF = "";
        }
        if (conn.rs.getString("DTCA_Couns_In_AM") != null) {
            DTCA_Couns_In_AM = conn.rs.getString("DTCA_Couns_In_AM");
        } else {
            DTCA_Couns_In_AM = "";
        }
        if (conn.rs.getString("DTCA_Couns_In_AF") != null) {
            DTCA_Couns_In_AF = conn.rs.getString("DTCA_Couns_In_AF");
        } else {
            DTCA_Couns_In_AF = "";
        }
        if (conn.rs.getString("DTCA_Couns_In_Tot") != null) {
            DTCA_Couns_In_Tot = conn.rs.getString("DTCA_Couns_In_Tot");
        } else {
            DTCA_Couns_In_Tot = "";
        }
        if (conn.rs.getString("DTCA_Couns_Out_CM") != null) {
            DTCA_Couns_Out_CM = conn.rs.getString("DTCA_Couns_Out_CM");
        } else {
            DTCA_Couns_Out_CM = "";
        }
        if (conn.rs.getString("DTCA_Couns_Out_CF") != null) {
            DTCA_Couns_Out_CF = conn.rs.getString("DTCA_Couns_Out_CF");
        } else {
            DTCA_Couns_Out_CF = "";
        }
        if (conn.rs.getString("DTCA_Couns_Out_AM") != null) {
            DTCA_Couns_Out_AM = conn.rs.getString("DTCA_Couns_Out_AM");
        } else {
            DTCA_Couns_Out_AM = "";
        }
        if (conn.rs.getString("DTCA_Couns_Out_AF") != null) {
            DTCA_Couns_Out_AF = conn.rs.getString("DTCA_Couns_Out_AF");
        } else {
            DTCA_Couns_Out_AF = "";
        }
        if (conn.rs.getString("DTCA_Couns_Out_Tot") != null) {
            DTCA_Couns_Out_Tot = conn.rs.getString("DTCA_Couns_Out_Tot");
        } else {
            DTCA_Couns_Out_Tot = "";
        }
        if (conn.rs.getString("DTCB_Test_In_CM") != null) {
            DTCB_Test_In_CM = conn.rs.getString("DTCB_Test_In_CM");
        } else {
            DTCB_Test_In_CM = "";
        }
        if (conn.rs.getString("DTCB_Test_In_CF") != null) {
            DTCB_Test_In_CF = conn.rs.getString("DTCB_Test_In_CF");
        } else {
            DTCB_Test_In_CF = "";
        }
        if (conn.rs.getString("DTCB_Test_In_AM") != null) {
            DTCB_Test_In_AM = conn.rs.getString("DTCB_Test_In_AM");
        } else {
            DTCB_Test_In_AM = "";
        }
        if (conn.rs.getString("DTCB_Test_In_AF") != null) {
            DTCB_Test_In_AF = conn.rs.getString("DTCB_Test_In_AF");
        } else {
            DTCB_Test_In_AF = "";
        }
        if (conn.rs.getString("DTCB_Test_In_Tot") != null) {
            DTCB_Test_In_Tot = conn.rs.getString("DTCB_Test_In_Tot");
        } else {
            DTCB_Test_In_Tot = "";
        }
        if (conn.rs.getString("DTCB_Test_Out_CM") != null) {
            DTCB_Test_Out_CM = conn.rs.getString("DTCB_Test_Out_CM");
        } else {
            DTCB_Test_Out_CM = "";
        }
        if (conn.rs.getString("DTCB_Test_Out_CF") != null) {
            DTCB_Test_Out_CF = conn.rs.getString("DTCB_Test_Out_CF");
        } else {
            DTCB_Test_Out_CF = "";
        }
        if (conn.rs.getString("DTCB_Test_Out_AM") != null) {
            DTCB_Test_Out_AM = conn.rs.getString("DTCB_Test_Out_AM");
        } else {
            DTCB_Test_Out_AM = "";
        }
        if (conn.rs.getString("DTCB_Test_Out_AF") != null) {
            DTCB_Test_Out_AF = conn.rs.getString("DTCB_Test_Out_AF");
        } else {
            DTCB_Test_Out_AF = "";
        }
        if (conn.rs.getString("DTCB_Test_Out_Tot") != null) {
            DTCB_Test_Out_Tot = conn.rs.getString("DTCB_Test_Out_Tot");
        } else {
            DTCB_Test_Out_Tot = "";
        }
        if (conn.rs.getString("DTCC_HIV_In_CM") != null) {
            DTCC_HIV_In_CM = conn.rs.getString("DTCC_HIV_In_CM");
        } else {
            DTCC_HIV_In_CM = "";
        }
        if (conn.rs.getString("DTCC_HIV_In_CF") != null) {
            DTCC_HIV_In_CF = conn.rs.getString("DTCC_HIV_In_CF");
        } else {
            DTCC_HIV_In_CF = "";
        }
        if (conn.rs.getString("DTCC_HIV_In_AM") != null) {
            DTCC_HIV_In_AM = conn.rs.getString("DTCC_HIV_In_AM");
        } else {
            DTCC_HIV_In_AM = "";
        }
        if (conn.rs.getString("DTCC_HIV_In_AF") != null) {
            DTCC_HIV_In_AF = conn.rs.getString("DTCC_HIV_In_AF");
        } else {
            DTCC_HIV_In_AF = "";
        }
        if (conn.rs.getString("DTCC_HIV_In_Tot") != null) {
            DTCC_HIV_In_Tot = conn.rs.getString("DTCC_HIV_In_Tot");
        } else {
            DTCC_HIV_In_Tot = "";
        }
        if (conn.rs.getString("DTCC_HIV_Out_CM") != null) {
            DTCC_HIV_Out_CM = conn.rs.getString("DTCC_HIV_Out_CM");
        } else {
            DTCC_HIV_Out_CM = "";
        }
        if (conn.rs.getString("DTCC_HIV_Out_CF") != null) {
            DTCC_HIV_Out_CF = conn.rs.getString("DTCC_HIV_Out_CF");
        } else {
            DTCC_HIV_Out_CF = "";
        }
        if (conn.rs.getString("DTCC_HIV_Out_AM") != null) {
            DTCC_HIV_Out_AM = conn.rs.getString("DTCC_HIV_Out_AM");
        } else {
            DTCC_HIV_Out_AM = "";
        }
        if (conn.rs.getString("DTCC_HIV_Out_AF") != null) {
            DTCC_HIV_Out_AF = conn.rs.getString("DTCC_HIV_Out_AF");
        } else {
            DTCC_HIV_Out_AF = "";
        }
        if (conn.rs.getString("DTCC_HIV_Out_Tot") != null) {
            DTCC_HIV_Out_Tot = conn.rs.getString("DTCC_HIV_Out_Tot");
        } else {
            DTCC_HIV_Out_Tot = "";
        }

        if (conn.rs.getString("isValidated") != null) {
            isValidated = conn.rs.getString("isValidated");
        } else {
            isValidated = "";
        }
        //get the name of the person who entered the form 

        String enterer = "select * from user where userid='" + conn.rs.getString("userid") + "'";
        System.out.println(enterer);
        conn.rs1 = conn.st1.executeQuery(enterer);
        //add details of person who entered
        if (conn.rs1.next()) {
            enterdby = "<font color='green'>Data 1st entered by:   <b> " + conn.rs1.getString("fname") + " "
                    + conn.rs1.getString("mname") + " " + conn.rs1.getString("lname") + "</b>  on  <b>"
                    + conn.rs.getString("timestamp") + "</b></font>";
        }

        //now check if form was updated and if its one month after data entry

        if (conn.rs.getString("updatedOn") != null) {
            //get difference in months between entered date and updated date
            String compdate = "SELECT TIMESTAMPDIFF(MONTH,'" + conn.rs.getString("timestamp") + "','"
                    + conn.rs.getString("updatedOn") + "')";
            conn.rs2 = conn.st2.executeQuery(compdate);
            if (conn.rs2.next()) {
                //now get the details of the person who updated the form
                //if the difference is greater than or equal to one, 

                if (conn.rs2.getInt(1) >= 1) {
                    String updater = "select * from user where userid='" + conn.rs.getString("updatedBy") + "'";

                    conn.rs1 = conn.st1.executeQuery(updater);
                    //add details of person who entered
                    if (conn.rs1.next()) {
                        enterdby += "<span style='margin-left:30%;'><font color='red'>   Updated  by:   <b> "
                                + conn.rs1.getString("fname") + " " + conn.rs1.getString("mname") + " "
                                + conn.rs1.getString("lname") + "</b>  on  <b>" + conn.rs.getString("updatedOn")
                                + "</b></font></span>";
                    }
                } //end of if month >=1 
            } //end of date comparison if 

        } //end of if updated !=null
        System.out.println("entry by " + enterdby);

    }
    System.out.println("Validity checker : " + isValidated);
    if (isValidated.equals("0")) {
        validity = "<font color=\"red\"><b>Form Not Validated.<img style=\"margin-left:10px;\" src=\"images/notValidated.jpg\" width=\"20px\" height=\"20px\"></b></font>";
    } else if (isValidated.equals("1")) {
        validity = "<font color=\"green\"><b>Form Validated.<img style=\"margin-left:10px;\" src=\"images/validated.jpg\" width=\"20px\" height=\"20px\"></b></font>";
    } else {

        validity = "<font color=\"blue\"><b>New Entry</b></font>";
    }
    FamilyPlanninng = pmct = maternity = vct = dtc = "";
    FP_TAB += "";

    validitychecker += "<p id=\"checkValidity\" hidden=\"hidden\">" + validity + "</p>";
    //          FPMicrolutN=FPMicrolutR=FPMicrolutT=FPMicrogynonN=FPMicrogynonR=FPMicrogynonT=FPINJECTIONSN=FPINJECTIONSR=
    //FPINJECTIONST=FPIUCDN=FPIUCDR=FPIUCDT=FPIMPLANTSN=FPIMPLANTSR=FPIMPLANTST=FPBTLN=FPBTLR=FPBTLT=FPVasectomyN=FPVasectomyR="";
    //FPVasectomyT=FPCONDOMSN=FPCONDOMSR=FPCONDOMST=FPOTHERN=FPOTHERR=FPOTHERT=FPCLIENTSN=FPCLIENTSR=FPCLIENTST=FPIUCDRemoval=
    //FPIMPLANTSRemoval="";"
    FamilyPlanninng = ""
            + "<fieldset class=\"formatter\"><legend class=\"formatter\"><b style=\"text-align:center;\"> FAMILY PLANNING </b></legend>"
            + "<table frame=\"box\"  style=\"border-color: #e5e5e5;margin-bottom: 3px; margin-left:150px; width:800px;\"><tr>"
            + "<td colspan=\"2\" class=\"form-actions\"><b>A: Family Planning </b></td>"
            + "<td class=\"form-actions\"> <b>NEW CLIENTS </b></td>"
            + "<td class=\"form-actions\"> <b>RE-VISITS </b></td>"
            + "<td class=\"form-actions\"> <b>TOTAL </b></td>" + "</tr>" + "<tr>"
            + "<td rowspan=\"2\">1. PILLS</td><td  >MICROLUT</td>" + "<td >" + FPMicrolutN + "</td>" + "<td >"
            + FPMicrolutR + "</td>" + "<td >" + FPMicrolutT + "</td>"

            + "<tr>"
            //              + "<td>2</td>"
            //              + "<td >PILLS</td>"
            + "<td  >MICROGYNON</td>" + "<td >" + FPMicrogynonN + "</td>" + "<td >" + FPMicrogynonR + "</td>"
            + "<td >" + FPMicrogynonT + "</td>" + "</tr>"

            + "<tr>" + "<td >2. INJECTIONS</td>" + "<td  >INJECTIONS</td>" + "<td >" + FPINJECTIONSN + "</td>"
            + "<td >" + FPINJECTIONSR + "</td>" + "<td >" + FPINJECTIONST + "</td>" + "</tr>"

            + "<tr>" + "<td >3. I.U.C.D.</td>" + "<td  >Insertion</td>" + "<td >" + FPIUCDN + " </td>" + "<td >"
            + FPIUCDR + " </td>" + "<td >" + FPIUCDT + " </td>" + "</tr>"

            + "<tr>" + "<td >4. IMPLANTS</td><td  >Insertion</td>" + "<td >" + FPIMPLANTSN + "</td>" + "<td >"
            + FPIMPLANTSR + "</td>" + "<td >" + FPIMPLANTST + "</td>" + "</tr>"

            + "<tr>" + "<td  rowspan=\"2\">5. STERILIZATION</td><td  >B.T.L</td>" + "<td >" + FPBTLN + "</td>"
            + "<td >" + FPBTLR + "</td>" + "<td >" + FPBTLT + "</td>" + "</tr>" + "<tr>"
            + "<td  >Vasectomy</td>" + "<td >" + FPVasectomyN + "</td>" + "<td >" + FPVasectomyR + "</td>"
            + "<td >" + FPVasectomyT + "</td>" + "</tr>" + "<tr>"
            + "<td >6. CONDOMS</td><td  >No. of clients receiving</td>" + "<td >" + FPCONDOMSN + "</td>"
            + "<td >" + FPCONDOMSR + "</td>" + "<td >" + FPCONDOMST + "</td>" + "</tr>" + "<tr>"
            + "<td >7. ALL OTHERS:(Specify)</td>"

            + "<td >" + FPOTHERN + "</td>" + "<td >" + FPOTHERR + "</td>" + "<td >" + FPOTHERT + "</td>"
            + "</tr>"

            + "<tr>" + "<td >8. TOTAL NO. OF CLIENTS</td>" + "<td  ></td>" + "<td >" + FPCLIENTSN + "</td>"
            + "<td >" + FPCLIENTSR + "</td>" + "<td >" + FPCLIENTST + "</td>" + "</tr>" + "<tr>"
            + "<td >9. REMOVALS</td>" + "<td  > IUCD </td>" + "<td >" + FPIUCDRemoval + "</td>"
            + "<td >IMPLANTS</td>" + "<td >" + FPIMPLANTSRemoval + "</td>" + "</tr></table></fieldset>";
    FP_TAB += FamilyPlanninng;

    pmct += "";
    pmct += "<fieldset class=\"formatter\"><legend class=\"formatter\"><b style=\"text-align:center;\"> B: MCH-ANC/PMTCT </b></legend>"
            + "<table frame=\"box\"  style=\"border-color: #e5e5e5;margin-bottom: 3px; margin-left:150px; width:800px;\">"
            + "<tr>" + "<td  class=\"form-actions\"><b> </b></td>"
            + "<td class=\"form-actions\"> <b>NEW  </b></td>"
            + "<td class=\"form-actions\"> <b>RE-VISIT </b></td>"
            + "<td class=\"form-actions\"> <b>TOTAL </b></td>" + "</tr>" + "<tr>"
            + "<td>1.No of ANC Clients</td>" + "<td >" + PMCTA_1stVisit_ANC + "</td>" + "<td >"
            + PMCTA_ReVisit_ANC + "</td>" + "<td >" + PMCTANCClientsT + "</td>" + "</tr></table>"
            + "<table frame=\"box\"  style=\"border-color: #e5e5e5;margin-bottom: 3px; margin-left:150px; width:800px;\"><tr>"
            + " <td colspan=\"3\" >2. No of clients with Hb <7 g/dl </td>" + "<td >" + PMCTHB7 + "</td>"
            + "</tr>" + "<tr>" + "  <td colspan=\"3\" >3. No of clients given IPT (1st Dose) </td>" + "<td >"
            + PMCTIPT1 + " </td>" + "</tr>" + "<tr>"
            + "   <td colspan=\"3\" >4. No of clients given IPT (2nd Dose) </td>" + "<td >" + PMCTIPT2 + "</td>"
            + "</tr>" + "<tr>" + "<td colspan=\"3\" >5. No of clients completed 4th Antenatal Visit </td>"
            + "<td >" + PMCTANCClients4 + "</td>" + "</tr>" + "<tr>" + "<tr>"
            + "   <td colspan=\"3\" >6. No of ITNs distributed to ANC Clients </td>" + "<td >" + PMCTITN
            + "</td>" + "</tr></table></fieldset>"

            + "" + "";

    MCH_TAB += pmct;

    //MATERNITY DELIVERIES

    // maternity MATNormalDelivery=MATCSection=""MATBreech=MATAssistedVag=MATDeliveryT=MATLiveBirth=MATStillBirth=MATWeight2500=
    //MATPreTerm=
    //MATDischargealive=MATReferral=MATNeoNatalD=
    //MATMaternalD=MATAPHAlive=MATAPHDead=MATPPHAlive=MATPPHDead=MATEclampAlive=MATEclampDead=MATRupUtAlive
    //=MATRupUtDead=MATObstrLaborAlive=MATObstrLaborDead=MATSepsisAlive=MATSepsisDead="";
    maternity += "";
    maternity += "<fieldset class=\"formatter\"><legend class=\"formatter\"><b style=\"text-align:center;\"> C: MATERNITY / SAFE DELIVERIES </b></legend>"
            + "<table frame=\"box\"  style=\"border-color: #e5e5e5;margin-bottom: 3px; margin-left:150px; width:800px;\"><tr>"
            + "<td colspan=\"2\" class=\"form-actions\"><b></b></td>"
            + "<td  colspan=\"2\" class=\"form-actions\"> <b>NUMBER  </b></td>" + "</tr>" + "<tr>"
            + "<td>1.</td><td >Normal Deliveries </td>" + "<td  colspan=\"2\">" + MATNormalDelivery + "</td>"
            + "</tr>" + "<tr>" + " <td>2.</td>   <td > Caesarian Sections </td>" + "<td  colspan=\"2\">"
            + MATCSection + "</td>" + "</tr>" + "<tr>" + "  <td>3.</td>  <td > Breech Delivery </td>"
            + "<td  colspan=\"2\">" + MATBreech + "</td>" + "</tr>" + "<tr>"
            + "   <td>4.</td> <td > Assisted vaginal delivery </td>" + "<td  colspan=\"2\">" + MATAssistedVag
            + "</td>" + "</tr>" + "<tr>" + "<td>5.</td>    <td > TOTAL DELIVERIES</td>" + "<td  colspan=\"2\">"
            + MATDeliveryT + "</td>" + "</tr>"

            + "<tr>" + "   <td>6.</td> <td > Live Births </td>" + "<td  colspan=\"2\">" + MATLiveBirth + "</td>"
            + "</tr>" + "<tr>" + "   <td>7.</td> <td > Still Births </td>" + "<td  colspan=\"2\">"
            + MATStillBirth + "</td>" + "</tr>" + "<tr>"
            + "   <td>8.</td> <td > Under Weight Babies (Weight below 2500 grams) </td>" + "<td  colspan=\"2\">"
            + MATWeight2500 + "</td>" + "</tr>" + "<tr>" + "   <td>9.</td> <td > Pre-Term babies  </td>"
            + "<td  colspan=\"2\">" + MATPreTerm + "</td>" + "</tr>" + "<tr>"
            + "   <td>10.</td> <td > No of babies discharged alive </td>"
            + "<td style=\"padding-right:20px;\" colspan=\"2\" >" + MATDischargealive + "</td>" + "</tr>"
            + "<tr>" + "   <td>11.</td> <td > Referrals </td>" + "<td  colspan=\"2\">" + MATReferral + "</td>"
            + "</tr>" + "<tr>" + "   <td>12.</td> <td > Neonatal Deaths </td>" + "<td  colspan=\"2\">"
            + MATNeoNatalD + "</td>" + "</tr>" + "<tr>" + "   <td>13.</td> <td  > Maternal Deaths </td>"
            + "<td  colspan=\"2\">" + MATMaternalD + "</td>" + "</tr>" + "<tr>"
            + "    <td  colspan=\"2\" class=\"form-actions\"><b> Maternal Complications </b></td>"
            + "<td  class=\"form-actions\"><b>Alive </b></td>" + "<td class=\"form-actions\" ><b>Dead </b></td>"
            + "</tr>" + "<tr>" + "   <td>14.</td> <td > A.P.H. (Ante Partum Haemorrhage) </td>" + "<td >"
            + MATAPHAlive + "</td>" + "<td >" + MATAPHDead + "</td>" + "</tr>" + "" + "<tr>"
            + "   <td>15.</td> <td > P.P.H. (Post Partum Haemorrhage) </td>" + "<td >" + MATPPHAlive + "</td>"
            + "<td >" + MATPPHDead + "</td>" + "</tr>" + "<tr>" + "   <td>16.</td> <td > Eclampsia</td>"
            + "<td >" + MATEclampAlive + "</td>" + "<td >" + MATEclampDead + "</td>" + "</tr>" + "<tr>"
            + "   <td>17.</td> <td > Ruptured Uterus</td>" + "<td >" + MATRupUtAlive + "</td>" + "<td >"
            + MATRupUtDead + "</td>" + "</tr>" + "<tr>" + "   <td>18.</td> <td > Obstructed Labour</td>"
            + "<td >" + MATObstrLaborAlive + "</td>" + "<td >" + MATObstrLaborDead + "</td>" + "</tr>" + "<tr>"
            + "   <td>19.</td> <td > Sepsis</td>" + "<td >" + MATSepsisAlive + "</td>" + "<td >" + MATSepsisDead
            + "</td>" + "</tr>" + "" + "" + "</table></fieldset>"

            + "" + "";
    MATERNITY_TAB += maternity;
    //MATAPHAlive=MATAPHDead=MATPPHAlive=MATPPHDead=MATEclampAlive=MATEclampDead=MATRupUtAlive
    //=MATRupUtDead=MATObstrLaborAlive=MATObstrLaborDead=MATSepsisAlive=MATSepsisDead="";

    //vct
    vct += "";

    vct += "<fieldset class=\"formatter\"><legend class=\"formatter\"><b style=\"text-align:center;\"> H: VCT </b></legend>"
            + "<table frame=\"box\"  style=\"border-color: #e5e5e5;margin-bottom: 3px; margin-left:150px; width:800px;\">"
            + "<tr>" + "<td rowspan=\"2\" colspan=\"3\" class=\"form-actions\"><b></b></td>"
            + "<td  colspan=\"2\" class=\"form-actions\" style=\"text-align:center;\"> <b>15-24  </b></td>"
            + "<td colspan=\"2\" class=\"form-actions\" style=\"text-align:center;\"> <b> >=25 Years </b></td>"
            + "<td rowspan=\"2\" class=\"form-actions\" style=\"text-align:center;\"> <b>TOTAL </b></td>"
            + "</tr>" + "<tr>" + "<td  class=\"form-actions\" style=\"text-align:center;\"><b>F </b></td>"
            + "<td   class=\"form-actions\" style=\"text-align:center;\"> <b>M </b></td>"
            + "<td  class=\"form-actions\" style=\"text-align:center;\"> <b>F</b></td>"
            + "<td class=\"form-actions\" style=\"text-align:center;\"> <b>M </b></td>" + "</tr>"

            + "<tr>" + "<td rowspan=\"3\">1.</td><td rowspan=\"3\">VCT Clients</td>" + "<td>Counselled</td>"
            + "<td  style=\"text-align:center;\" >" + VCTClient_Couns_CF + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_Couns_CM + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_Couns_AF + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_Couns_AM + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_Couns_TOT + "</td>" + "</tr>" + "<tr>" + ""
            + "<td>Tested</td>" + "<td  style=\"text-align:center;\">" + VCTClient_Tested_CF + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_Tested_CM + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_Tested_AF + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_Tested_AM + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_Tested_TOT + "</td>" + "</tr>" + "<tr>" + ""
            + "<td>HIV+</td>" + "<td  style=\"text-align:center;\">" + VCTClient_HIV_CF + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_HIV_CM + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_HIV_AF + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_HIV_AM + "</td>"
            + "<td  style=\"text-align:center;\">" + VCTClient_HIV_TOT + "</td>" + "</tr>" + "<tr>"
            + "<td rowspan=\"4\">2.</td><td rowspan=\"4\">No of couples</td>" + "<td>Counselled</td>"
            + "<td colspan=\"4\">  </td>" + "<td  style=\"text-align:center;\">" + VCTPartner_Couns_TOT
            + "</td>"

            + "</tr>" + "<tr>" + "" + "<td>Tested</td>" + "<td colspan=\"4\">  </td>"
            + "<td  style=\"text-align:center;\" >" + VCTPartner_Tested_TOT + "</td>"

            + "</tr>" + "<tr>" + "" + "<td>Both HIV+</td>" + "<td colspan=\"4\">  </td>"
            + "<td  style=\"text-align:center;\">" + VCTPartner_HIV_TOT + "</td>"

            + "</tr>" + "<tr>" + "" + "<td>with discordant HIV+</td>" + "<td colspan=\"4\">  </td>"
            + "<td  style=\"text-align:center;\" >" + VCTPartner_Disc_TOT + "</td>"

            + "</tr>"

            + "</table></fieldset>"

            + "" + "";
    VCT_TAB += vct;
    //  VCTClient_Couns_CM=VCTClient_Couns_CF=VCTClient_Couns_AM=VCTClient_Couns_AF=VCTClient_Couns_TOT=
    // VCTClient_Tested_CM=VCTClient_Tested_CF=VCTClient_Tested_AM=VCTClient_Tested_AF
    //=VCTClient_Tested_TOT=VCTClient_HIV_CM=VCTClient_HIV_CF=VCTClient_HIV_AM=VCTClient_HIV_AF=VCTClient_HIV_TOT
    //=VCTPartner_Couns_TOT=VCTPartner_Tested_TOT=VCTPartner_HIV_TOT=VCTPartner_Disc_TOT="";

    // dtc 

    dtc += "";

    dtc += "<fieldset class=\"formatter\"><legend class=\"formatter\"><p id=\"demo\" hidden=\"true\"></p><b style=\"text-align:center;\"> I: DTC </b></legend>"
            + "<table frame=\"box\"  style=\"border-color: #e5e5e5;margin-bottom: 3px; margin-left:150px; width:800px;\">"
            + "<tr>"
            + "<td rowspan=\"2\" colspan=\"2\" class=\"form-actions\" style=\"text-align:center;\"><b>I: DTC </b></td>"
            + "<td colspan=\"2\"  class=\"form-actions\" style=\"text-align:center;\"> <b>Children  </b></td>"
            + "<td colspan=\"2\" class=\"form-actions\" style=\"text-align:center;\"> <b> Adults </b></td>"
            + "<td rowspan=\"2\" class=\"form-actions\" style=\"text-align:center;\"> <b>TOTAL </b></td>"
            + "</tr>" + "<tr>"

            + "<td  class=\"form-actions\" style=\"text-align:center;\"> <b>F  </b></td>"
            + "<td  class=\"form-actions\" style=\"text-align:center;\"> <b>M </b></td>"
            + "<td  class=\"form-actions\" style=\"text-align:center;\"> <b>F </b></td>"
            + "<td  class=\"form-actions\" style=\"text-align:center;\"> <b>M </b></td>" + "</tr>" + "<tr>"
            + "<td rowspan=\"2\">1. No. Counselled</td>" + "<td>Outpatient</td>"
            + "<td   style=\"text-align:center;\">" + DTCA_Couns_Out_CF + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCA_Couns_Out_CM + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCA_Couns_Out_AF + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCA_Couns_Out_AM + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCA_Couns_Out_Tot + "</td>" + "</tr>" + "<tr>" + ""
            + "<td>Inpatient</td>" + "<td  style=\"text-align:center;\" >" + DTCA_Couns_In_CF + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCA_Couns_In_CM + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCA_Couns_In_AF + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCA_Couns_In_AM + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCA_Couns_In_Tot + "</td>" + "</tr>" + "<tr>"
            + "<td rowspan=\"2\">2. No. tested</td><td>Outpatient</td>" + "<td  style=\"text-align:center;\">"
            + DTCB_Test_Out_CF + "</td>" + "<td  style=\"text-align:center;\">" + DTCB_Test_Out_CM + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCB_Test_Out_AF + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCB_Test_Out_AM + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCB_Test_Out_Tot + "</td>" + "</tr>" + "<tr>"
            + "<td>Inpatient</td>" + "<td  style=\"text-align:center;\">" + DTCB_Test_In_CF + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCB_Test_In_CM + "></td>"
            + "<td  style=\"text-align:center;\">" + DTCB_Test_In_AF + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCB_Test_In_AM + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCB_Test_In_Tot + "</td>" + "</tr>" + "<tr>"
            + "<td rowspan=\"2\">3. No. HIV+</td><td>Outpatient</td>" + "<td  style=\"text-align:center;\">"
            + DTCC_HIV_Out_CF + "</td>" + "<td  style=\"text-align:center;\">" + DTCC_HIV_Out_CM + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCC_HIV_Out_AF + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCC_HIV_Out_AM + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCC_HIV_Out_Tot + "</td>" + "</tr>" + "<tr>"
            + "<td>Inpatient</td>" + "<td  style=\"text-align:center;\">" + DTCC_HIV_In_CF + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCC_HIV_In_CM + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCC_HIV_In_AF + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCC_HIV_In_AM + "</td>"
            + "<td  style=\"text-align:center;\">" + DTCC_HIV_In_Tot + "</td>" + "</tr>"
            + "</table></fieldset>";

    DTC_TAB += dtc;

    //           DTCA_Couns_In_CM=DTCA_Couns_In_CF=DTCA_Couns_In_AM=DTCA_Couns_In_AF=DTCA_Couns_In_Tot=
    //DTCA_Couns_Out_CM=DTCA_Couns_Out_CF=DTCA_Couns_Out_AM=DTCA_Couns_Out_AF=DTCA_Couns_Out_Tot=
    // DTCB_Test_In_CM=DTCB_Test_In_CF
    //=DTCB_Test_In_AM=DTCB_Test_In_AF=DTCB_Test_In_Tot=DTCB_Test_Out_CM=DTCB_Test_Out_CF=DTCB_Test_Out_AM=DTCB_Test_Out_AF
    //  =DTCB_Test_Out_Tot=DTCC_HIV_In_CM=DTCC_HIV_In_CF=DTCC_HIV_In_AM
    //=DTCC_HIV_In_AF= DTCC_HIV_In_Tot=
    //  DTCC_HIV_Out_CM=DTCC_HIV_Out_CF=DTCC_HIV_Out_AM=DTCC_HIV_Out_AF=DTCC_HIV_Out_Tot=Userid="";

    FP_TAB += "</div></div></div>";
    MCH_TAB += "</div></div></div>";
    MATERNITY_TAB += "</div></div></div>";
    VCT_TAB += "</div></div></div>";
    DTC_TAB += "</div></div></div>";

    //           System.out.println("aaaaa"+FP_TAB);//}
    //System.out.println("aaaaa"+FP_TAB);

    try {
        Document document = new Document(PageSize.LETTER);
        PdfWriter.getInstance(document, new FileOutputStream("D://testpdf2.pdf"));
        document.open();
        document.addAuthor("Real Gagnon");
        document.addCreator("Real's HowTo");
        document.addSubject("Thanks for your support");
        document.addCreationDate();
        document.addTitle("Please read this");

        HTMLWorker htmlWorker = new HTMLWorker(document);
        String str = "<html><head></head><body>" + FP_TAB + "  " + MCH_TAB + "  " + MATERNITY_TAB + "  "
                + VCT_TAB + "   " + DTC_TAB + " </body></html>";

        htmlWorker.parse(new StringReader(str));
        document.close();
        System.out.println("Done");
    } catch (Exception e) {
        e.printStackTrace();
    }
    System.out.println("PDF Created!");

}