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

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

Introduction

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

Prototype

public PdfPTable(final PdfPTable table) 

Source Link

Document

Constructs a copy of a PdfPTable.

Usage

From source file:be.roots.taconic.pricingguide.service.PDFServiceImpl.java

License:Open Source License

private PdfPTable buildModelDetailSection(Model model, PdfWriter pdfWriter)
        throws IOException, BadElementException {

    final Phrase p = processHtmlCodes(model.getProductNameProcessed(), iTextUtil.getFontModelTitle(),
            iTextUtil.getFontModelSymbol());
    for (Chunk c : p.getChunks()) {
        c.setAction(new PdfAction(model.getUrl()));
    }//from  w w w. j  av  a  2 s .c o  m

    final StringBuilder strAppList = new StringBuilder();
    for (String application : model.getApplicationsSorted()) {
        if (strAppList.length() != 0) {
            strAppList.append(", ");
        }
        strAppList.append(application);
    }

    final PdfPTable table = new PdfPTable(1);

    table.addCell(cell(p));

    table.addCell(createRow("Model Number", model.getModelNumber(), null));
    table.addCell(createRow("Animal Type", model.getAnimalType(), null));
    table.addCell(createRow("Nomenclature", model.getNomenclatureParsed(), null));
    table.addCell(createRow("Application(s)", strAppList.toString(), null));
    table.addCell(createRow("Health Report", model.getHealthReport(), model.getHealthReport()));
    table.addCell(createRow("Species", model.getSpecies(), null));

    table.addCell(cell(createOrderButton(model)));

    return table;

}

From source file:be.roots.taconic.pricingguide.service.PDFServiceImpl.java

License:Open Source License

private PdfPTable createOrderButton(Model model) throws IOException, BadElementException {

    final Chunk chunk = new Chunk("Order on taconic.com", iTextUtil.getFontButton());
    chunk.setAction(//from ww  w  . j  a  va2 s.c  o m
            new PdfAction("http://www.taconic.com/start-an-order?modelNumber=" + model.getModelNumber()));

    final PdfPCell cell = cell(new Phrase(chunk));
    cell.setBackgroundColor(iTextUtil.getTaconicRed());
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setPaddingTop(5);
    cell.setPaddingBottom(8);

    final PdfPTable button = new PdfPTable(new float[] { 80f, 20f });
    button.addCell(cell(new Phrase(" "), 2));
    button.addCell(cell);
    button.addCell(cell(new Phrase(" ")));
    button.addCell(cell(new Phrase(" "), 2));

    return button;
}

From source file:be.thomasmore.controller.PdfController.java

public void createPdfKlas() {

    Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext()
            .getRequestParameterMap();/*  w  w w  .  jav a2s  .  c  om*/
    String KlasId = params.get("klasId");
    int id = Integer.parseInt(KlasId);
    Document document = new Document();
    Klas klas = service.getKlas(id);
    List<Klastest> klastesten = klas.getKlastestList();
    List<Test> testen = new ArrayList<Test>();

    HttpServletResponse res = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext()
            .getResponse();
    res.setHeader("Content-Disposition", "attachement; filename=" + klas.getNummer() + "-resultaten.pdf");
    res.setContentType("application/pdf");

    try {
        PdfWriter.getInstance(document, res.getOutputStream());

        document.open();

        Font font = FontFactory.getFont("Calibri");
        Font fontbold = FontFactory.getFont("Calibri", Font.BOLD);

        PdfPTable table = new PdfPTable(3); // 3 columns.

        PdfPCell cell1 = new PdfPCell(new Paragraph("Vak", font));
        PdfPCell cell2 = new PdfPCell(new Paragraph("Student", font));
        PdfPCell cell3 = new PdfPCell(new Paragraph("Behaald", font));

        table.addCell(cell1);
        table.addCell(cell2);
        table.addCell(cell3);

        for (Klastest klastest : klastesten) {
            Test test = klastest.getTestId();
            testen.add(service.getTest(test.getId()));
        }

        for (Test test : testen) {
            List<Score> scores = test.getScoreList();
            Vak vak = test.getVakId();
            for (Score score : scores) {
                Student student = score.getStudentId();
                PdfPCell cellVak = new PdfPCell(new Paragraph(vak.getNaam(), font));
                PdfPCell cellStudent = new PdfPCell(new Paragraph(student.getVoornaam(), font));
                PdfPCell cellScore = new PdfPCell(new Paragraph(score.getScore().toString(), font));

                table.addCell(cellVak);
                table.addCell(cellStudent);
                table.addCell(cellScore);
            }
        }

        document.add(new Phrase("Klas: ", font));
        document.add(new Phrase(klas.getNummer(), font));
        document.add(table);

        document.close();
    } catch (Exception e) {

    }

}

From source file:be.thomasmore.controller.PdfController.java

public void createPdfTest() {
    Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext()
            .getRequestParameterMap();/*  w  ww  . j ava2s .co m*/
    String KlasId = params.get("klasId3");
    String TestId = params.get("testId");
    int klasId = Integer.parseInt(KlasId);
    int id = Integer.parseInt(TestId);
    Document document = new Document();
    Test test = service.getTest(id);
    List<Score> scores = test.getScoreList();
    Klas klas = service.getKlas(klasId);
    Vak vak = test.getVakId();

    HttpServletResponse res = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext()
            .getResponse();
    res.setHeader("Content-Disposition", "attachement; filename=" + test.getBeschrijving() + "-resultaten.pdf");
    res.setContentType("application/pdf");

    try {
        PdfWriter.getInstance(document, res.getOutputStream());

        document.open();

        Font font = FontFactory.getFont("Calibri");
        Font fontbold = FontFactory.getFont("Calibri", Font.BOLD);

        PdfPTable table = new PdfPTable(3); // 3 columns.

        PdfPCell cell1 = new PdfPCell(new Paragraph("Test", font));
        PdfPCell cell2 = new PdfPCell(new Paragraph("Student", font));
        PdfPCell cell3 = new PdfPCell(new Paragraph("Score", font));

        table.addCell(cell1);
        table.addCell(cell2);
        table.addCell(cell3);

        for (Score score : scores) {
            Student student = score.getStudentId();
            PdfPCell cellTest = new PdfPCell(new Paragraph(test.getBeschrijving(), font));
            PdfPCell cellStudent = new PdfPCell(new Paragraph(student.getVoornaam(), font));
            PdfPCell cellScore = new PdfPCell(new Paragraph(score.getScore().toString()));

            table.addCell(cellTest);
            table.addCell(cellStudent);
            table.addCell(cellScore);
        }

        document.add(new Phrase("Klas: ", font));
        document.add(new Phrase(klas.getNummer(), font));
        document.add(new Phrase("  Vak: ", font));
        document.add(new Phrase(vak.getNaam(), font));
        document.add(table);

        document.close();
    } catch (Exception e) {

    }

}

From source file:be.thomasmore.controller.PdfController.java

public void createPdfVak() {
    Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext()
            .getRequestParameterMap();//from www.  j av  a 2 s  . c  o m
    String KlasId = params.get("klasId2");
    String VakId = params.get("vakId");
    int klasId = Integer.parseInt(KlasId);
    int id = Integer.parseInt(VakId);
    Document document = new Document();
    Vak vak = service.getVak(id);
    List<Test> testen = vak.getTestList();
    Klas klas = service.getKlas(klasId);

    HttpServletResponse res = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext()
            .getResponse();
    res.setHeader("Content-Disposition", "attachement; filename=" + vak.getNaam() + "-resultaten.pdf");
    res.setContentType("application/pdf");

    try {
        PdfWriter.getInstance(document, res.getOutputStream());

        document.open();

        Font font = FontFactory.getFont("Calibri");
        Font fontbold = FontFactory.getFont("Calibri", Font.BOLD);

        PdfPTable table = new PdfPTable(3); // 3 columns.

        PdfPCell cell1 = new PdfPCell(new Paragraph("Test", font));
        PdfPCell cell2 = new PdfPCell(new Paragraph("Student", font));
        PdfPCell cell3 = new PdfPCell(new Paragraph("Score", font));

        table.addCell(cell1);
        table.addCell(cell2);
        table.addCell(cell3);

        for (Test test : testen) {
            List<Score> scores = test.getScoreList();
            for (Score score : scores) {
                Student student = score.getStudentId();
                PdfPCell cellTest = new PdfPCell(new Paragraph(test.getBeschrijving(), font));
                PdfPCell cellStudent = new PdfPCell(new Paragraph(student.getVoornaam(), font));
                PdfPCell cellScore = new PdfPCell(new Paragraph(score.getScore().toString()));

                table.addCell(cellTest);
                table.addCell(cellStudent);
                table.addCell(cellScore);
            }
        }

        document.add(new Phrase("Klas: ", font));
        document.add(new Phrase(klas.getNummer(), font));
        document.add(new Phrase("  Vak: ", font));
        document.add(new Phrase(vak.getNaam(), font));
        document.add(table);

        document.close();
    } catch (Exception e) {

    }
}

From source file:be.thomasmore.controller.PdfController.java

public void createPdfStudent() {
    Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext()
            .getRequestParameterMap();/*from w  w w  .java  2 s .  c o  m*/
    String StudentId = params.get("studentId");
    int id = Integer.parseInt(StudentId);
    Document document = new Document();
    Student student = service.getStudent(id);
    List<Score> scores = student.getScoreList();
    Klas klas = student.getKlasId();

    HttpServletResponse res = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext()
            .getResponse();
    res.setHeader("Content-Disposition",
            "attachement; filename=" + student.getNaam() + student.getVoornaam() + "-resultaten.pdf");
    res.setContentType("application/pdf");

    try {
        PdfWriter.getInstance(document, res.getOutputStream());

        document.open();

        Font font = FontFactory.getFont("Calibri");

        PdfPTable table = new PdfPTable(3); // 3 columns.

        PdfPCell cell1 = new PdfPCell(new Paragraph("Vak", font));
        PdfPCell cell2 = new PdfPCell(new Paragraph("Test", font));
        PdfPCell cell3 = new PdfPCell(new Paragraph("Score", font));

        table.addCell(cell1);
        table.addCell(cell2);
        table.addCell(cell3);

        for (Score score : scores) {
            Test test = score.getTestId();
            PdfPCell cellVak = new PdfPCell(new Paragraph(test.getVakId().getNaam(), font));
            PdfPCell cellTest = new PdfPCell(new Paragraph(test.getBeschrijving(), font));
            PdfPCell cellScore = new PdfPCell(new Paragraph(score.getScore().toString()));

            table.addCell(cellVak);
            table.addCell(cellTest);
            table.addCell(cellScore);
        }

        document.add(new Phrase("Student: ", font));
        document.add(new Phrase((student.getNaam() + " " + student.getVoornaam()), font));
        document.add(new Phrase("Klas: ", font));
        document.add(new Phrase(klas.getNummer(), font));
        document.add(table);

        document.close();
    } catch (Exception e) {

    }

}

From source file:be.thomasmore.service.CreatePDFServiceImp.java

@Override
public void createPDF(List<Score> scores) {
    try {/*from   ww  w .ja  v a2s.  co m*/
        OutputStream file = new FileOutputStream(new File("D:\\Desktop\\Scores.pdf"));

        Document document = new Document();
        PdfWriter.getInstance(document, file);

        document.open();
        document.add(new Paragraph("Scores"));
        document.add(new Paragraph(new Date().toString()));

        document.addAuthor("Projectgroep 4");
        document.addCreator("Projectgroep 4");
        document.addTitle("ScoreTracker");

        //Create Paragraph
        Paragraph paragraph = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD));

        //New line
        paragraph.add(new Paragraph(" "));
        paragraph.add("Scores");
        paragraph.add(new Paragraph(" "));
        document.add(paragraph);

        //Create a table in PDF
        PdfPTable pdftabel = new PdfPTable(4);
        PdfPCell cell1 = new PdfPCell(new Phrase("Student"));
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdftabel.addCell(cell1);

        cell1 = new PdfPCell(new Phrase("Vak"));
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdftabel.addCell(cell1);

        cell1 = new PdfPCell(new Phrase("Test"));
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdftabel.addCell(cell1);

        cell1 = new PdfPCell(new Phrase("Score"));
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdftabel.addCell(cell1);

        pdftabel.setHeaderRows(1);

        for (Score score : scores) {
            pdftabel.addCell(score.getStudent().getNaam());
            pdftabel.addCell(score.getTest().getVak().getNaam());
            pdftabel.addCell(score.getTest().getNaam());
            int resultaat = score.getScore();
            pdftabel.addCell(resultaat + " / " + score.getTest().getTotaal());
        }

        document.add(pdftabel);
        document.addCreationDate();
        document.close();
        file.close();

    } catch (Exception e) {

        e.printStackTrace();
    }
}

From source file:be.thomasmore.service.CreatePDFServiceImp.java

@Override
public void createPDFVoorStudent(ArrayList<ArrayList<Score>> puntenlijst, List<Double> gemiddeldelijst,
        Double totaalGemiddelde) {
    try {// w w w.  j  a va  2s  .c  om
        OutputStream file = new FileOutputStream(new File("D:\\Desktop\\Scores.pdf"));

        Document document = new Document();
        PdfWriter.getInstance(document, file);

        document.open();
        document.add(new Paragraph("Scores"));
        document.add(new Paragraph(puntenlijst.get(0).get(0).getStudent().getNaam()));
        document.add(new Paragraph(new Date().toString()));

        document.addAuthor("Projectgroep 4");
        document.addCreator("Projectgroep 4");
        document.addTitle("ScoreTracker");

        //Create Paragraph
        Paragraph paragraph = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD));

        //New line
        paragraph.add(new Paragraph(" "));
        paragraph.add("Scores");
        paragraph.add(new Paragraph(" "));
        document.add(paragraph);

        for (int i = 0; i < puntenlijst.size(); i++) {
            //Create a table in PDF
            PdfPTable pdftabel = new PdfPTable(2);
            //vak invullen
            paragraph = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD));
            paragraph.add(new Paragraph(puntenlijst.get(i).get(0).getTest().getVak().getNaam()));
            document.add(paragraph);

            PdfPCell cell1 = new PdfPCell(new Phrase("Test"));
            cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
            pdftabel.addCell(cell1);

            cell1 = new PdfPCell(new Phrase("Score"));
            cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
            pdftabel.addCell(cell1);

            pdftabel.setHeaderRows(1);

            for (Score score : puntenlijst.get(i)) {
                pdftabel.addCell(score.getTest().getNaam());
                int resultaat = score.getScore();
                pdftabel.addCell(resultaat + " / " + score.getTest().getTotaal());
            }

            document.add(pdftabel);

            //gemmidelde per vak invoeren
            paragraph = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD));
            paragraph.add(new Paragraph("Gemiddelde: " + gemiddeldelijst.get(i).toString()));
            document.add(paragraph);
        }
        paragraph = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD));
        paragraph.add(new Paragraph("Algemeen gemiddelde: " + totaalGemiddelde));
        document.add(paragraph);
        document.addCreationDate();
        document.close();
        file.close();

    } catch (Exception e) {

        e.printStackTrace();
    }
}

From source file:be.zenodotus.creatie.GeneratePDF.java

License:Open Source License

public String vakantieAfdruk(Context context, String name, int jaar) {
    this.context = context;
    PdfWriter w = null;/*from   w  ww. j  a  v a 2  s.  co m*/
    Document d = new Document(PageSize.A4.rotate(), 5, 5, 10, 10);
    d.setPageCount(3);
    String fileName = name;
    String file = name;
    GregorianCalendar datum = new GregorianCalendar();
    datum.set(GregorianCalendar.YEAR, jaar);

    String[] maanden = { "Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus",
            "September", "Oktober", "November", "December" };
    int[] dagen = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    VerlofDao dao = new VerlofDao(context);
    FeestdagDao feestdagDao = new FeestdagDao(context);
    WerkdagDao werkdagDao = new WerkdagDao(context);
    File folder = new File(context.getFilesDir(), "pdfs");
    folder.mkdirs();
    if (datum.isLeapYear(jaar)) {
        dagen[1] = 29;
    }
    File temp = null;
    temp = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),
            "Jacqueline" + jaar + ".pdf");
    fileName = temp.toString();
    try {
        dao.open();
        ArrayList<Verlof> verloflijst = dao.getAlleVerlovenPerJaar(jaar);
        w = PdfWriter.getInstance(d, new FileOutputStream(temp));
        d.open();
        d.addAuthor("Jacqueline Vandenbroecke");
        d.addCreationDate();
        d.addCreator("Verlofplanner");
        d.addTitle("Vakantie " + jaar + " van Jacqueline Vandenbroecke");
        Font standaard = FontFactory.getFont(FontFactory.HELVETICA, 8);
        Font standaardBold = FontFactory.getFont(FontFactory.HELVETICA, 8, Font.BOLD);
        Paragraph gegeven = new Paragraph("Jacqueline Vandenbroecke Verlof " + jaar + "\n", standaardBold);
        gegeven.setAlignment(Paragraph.ALIGN_CENTER);
        d.add(gegeven);

        for (int paginas = 0; paginas < 2; paginas++) {
            int aantal = 0;
            if (paginas == 1) {
                d.newPage();
                aantal = 6;
            }
            PdfPTable table = new PdfPTable(6);
            for (int i = aantal; i < (aantal + 6); i++) {
                PdfPCell cell = new PdfPCell(new Paragraph(maanden[i], standaardBold));
                cell.setBorder(1);
                table.addCell(cell);
            }
            int dag = 1;
            int k = aantal;
            for (int i = aantal; i < (aantal + 6); i++) {
                for (int j = 0; j < 32; j++) {
                    if (k > ((aantal + 6) - 1)) {
                        k = aantal;
                        dag++;
                    }
                    if (dag > dagen[k]) {
                        PdfPCell cell = new PdfPCell(new Paragraph("", standaard));
                        table.addCell(cell);
                        k++;
                    } else {
                        SimpleDateFormat formatterDag = new SimpleDateFormat("dd");
                        SimpleDateFormat formatterWeek = new SimpleDateFormat("EEE");
                        datum.set(jaar, k, dag);
                        PdfPTable dagTabel = new PdfPTable(4);
                        PdfPCell cellDag = new PdfPCell(
                                new Paragraph(formatterDag.format(datum.getTime()), standaard));
                        PdfPCell cellWeek = new PdfPCell(
                                new Paragraph(formatterWeek.format(datum.getTime()), standaard));
                        ArrayList<Verlof> verlof = new ArrayList<Verlof>();
                        for (int z = 0; z < verloflijst.size(); z++) {
                            if (((verloflijst.get(z).getDag() + 1) == dag)
                                    && (verloflijst.get(z).getMaand() == k)) {
                                verlof.add(verloflijst.get(z));

                            }
                        }
                        feestdagDao.open();
                        Feestdag feestdag = feestdagDao.getFeestdag(jaar, datum.get(GregorianCalendar.MONTH),
                                datum.get(GregorianCalendar.DATE));
                        feestdagDao.close();
                        werkdagDao.open();
                        java.util.List<Werkdag> weekend = werkdagDao.getWeekend();
                        werkdagDao.close();
                        String Verlof = "";
                        String uur = "";
                        if (verlof.size() > 0) {
                            if (verlof.size() > 1) {
                                Verlof = verlof.get(0).getVerlofsoort() + "\n" + verlof.get(1).getVerlofsoort();
                                uur = verlof.get(0).getUrental() + "\n" + verlof.get(1).getUrental();
                            } else {
                                Verlof = verlof.get(0).getVerlofsoort();
                                uur = verlof.get(0).getUrental();
                            }

                        }
                        PdfPCell cellVerlof = new PdfPCell(new Paragraph(Verlof, standaard));
                        PdfPCell uren = new PdfPCell(new Paragraph(uur, standaard));
                        if (verlof.size() > 0) {
                            BaseColor kleur = new BaseColor(Color.GRAY);
                            cellVerlof.setBackgroundColor(kleur);
                            uren.setBackgroundColor(kleur);
                            cellDag.setBackgroundColor(kleur);
                            cellWeek.setBackgroundColor(kleur);
                        }
                        for (int z = 0; z < weekend.size(); z++) {
                            if ((formatterWeek.format(datum.getTime())).equals(weekend.get(z).getDag())) {
                                BaseColor kleur = new BaseColor(Color.LTGRAY);
                                cellVerlof.setBackgroundColor(kleur);
                                uren.setBackgroundColor(kleur);
                                cellDag.setBackgroundColor(kleur);
                                cellWeek.setBackgroundColor(kleur);
                            }
                        }
                        if (feestdag != null) {
                            BaseColor kleur = new BaseColor(Color.GREEN);
                            uren.setBackgroundColor(kleur);
                            cellVerlof.setBackgroundColor(kleur);
                            uren.setBackgroundColor(kleur);
                            cellDag.setBackgroundColor(kleur);
                            cellWeek.setBackgroundColor(kleur);
                        }
                        dagTabel.addCell(cellDag);
                        dagTabel.addCell(cellWeek);
                        dagTabel.addCell(cellVerlof);
                        dagTabel.addCell(uren);
                        table.addCell(dagTabel);
                        k++;
                    }
                }

            }
            d.add(table);
            dao.close();
        }
    } catch (Exception ex) {

        ex.printStackTrace();

    } finally {
        d.close();
        w.close();
    }
    return fileName;
}

From source file:Beans.ArchAssistantBean.java

public void GenerarReporteQAW(Proyecto pro) throws FileNotFoundException, DocumentException, IOException {

    Rationaleqaw ratq, ratq4;//w w  w  .  ja v  a2 s  . c  om
    String paso = pro.getProAvance();
    Paragraph parrafo;
    int anexo = 1;
    GuardarArchivo arch = new GuardarArchivo();
    List<File> archivos = null;
    FileOutputStream archivo = new FileOutputStream(System.getProperty("user.home") + File.separator
            + "Downloads" + File.separator + "InformeQAW" + pro.getProNombre() + ".pdf");
    String razonamiento;
    Document documento = new Document();
    PdfWriter.getInstance(documento, archivo);
    List<Atributocalidad> listaAtributos = ListarAtr();
    List<Atributocalidad> atrEscogidos;

    documento.open();
    documento.addHeader("ArchAssistant", "ArchAssistant");
    //documento.setMargins(2, 2, 4, 4);
    parrafo = new Paragraph("INFORME QAW ", chapterFont);
    parrafo.setAlignment(1);
    documento.add(parrafo);
    parrafo = new Paragraph("Proyecto " + pro.getProNombre(), chapterFont);
    parrafo.setAlignment(1);
    documento.add(parrafo);
    parrafo = new Paragraph("ArchAssistant\n\n", blueFontArchAssistant);
    parrafo.setAlignment(1);
    documento.add(parrafo);
    documento.add(new Paragraph("\n\n" + pro.getProDescripcion(), paragraphFont));
    parrafo = new Paragraph("Autor: " + pro.getTblUsuarioidUsuario().getUsuNombre(), blueFont);
    parrafo.setAlignment(2);
    documento.add(parrafo);
    for (int i = 1; i <= 8; i++) {
        ratq = obtenerRationaleQAW(pro.getProID(), "qaw" + String.valueOf(i));
        ratq4 = obtenerRationaleQAW(pro.getProID(), "qaw4");

        documento.add(new Paragraph("QAW paso " + i + "\n", categoryFont));
        if (ratq != null) {
            archivos = arch.listarArchivos(ratq.getRatQawArchivo());
            razonamiento = ratq.getRatQawDescripcion();
            if (razonamiento != null) {
                if (ratq.getRatQawPaso().equals("qaw4")) {
                    ratq4 = ratq;
                    atrEscogidos = ObtenerAtributosEscogidos(ratq);
                    documento.add(new Paragraph("Atributos de Calidad:\n", subcategoryFont));
                    for (Atributocalidad atr : listaAtributos) {
                        for (Atributocalidad atrEsc : atrEscogidos) {
                            if (atr.getAcID() == atrEsc.getAcID()) {
                                documento.add(new Paragraph(atr.getAcNombre(), blueFont));
                            }
                        }
                    }
                    int indiceAtribs = 0;
                    if (razonamiento != null || razonamiento != "") {
                        indiceAtribs = razonamiento.indexOf("~|~|") + 4;
                    }
                    documento.add(new Paragraph("Justificacin de las decisiones", smallBold));
                    documento.add(new Paragraph(razonamiento.substring(indiceAtribs) + "\n", paragraphFont));
                } else {
                    if (ratq.getRatQawPaso().equals("qaw5")) {
                        documento.add(new Paragraph("Escenarios generados en la lluvia de ideas:\n",
                                subcategoryFont));
                        atrEscogidos = ObtenerAtributosEscogidos(ratq4);
                        for (Atributocalidad atr : atrEscogidos) {
                            documento.add(new Paragraph("\n" + atr.getAcNombre() + "\n\n", smallBold));
                            PdfPTable tabla = new PdfPTable(4);

                            tabla.addCell("Nombre");
                            tabla.addCell("Estimulo");
                            tabla.addCell("Ambiente");
                            tabla.addCell("Respuesta");

                            List<Escenario> listaEsc = ListEscenarios(pro);

                            for (Escenario esce : listaEsc) {
                                if (esce.getTblAtributoCalidadacID().getAcID() == atr.getAcID()) {
                                    tabla.addCell(esce.getEscNombre());
                                    tabla.addCell(esce.getEscEstimulo());
                                    tabla.addCell(esce.getEscAmbiente());
                                    tabla.addCell(esce.getEscRespuesta());
                                }
                            }
                            documento.add(tabla);
                        }
                    }
                    if (ratq.getRatQawPaso().equals("qaw6")) {
                        documento.add(new Paragraph("Escenarios consolodados:\n", subcategoryFont));
                        atrEscogidos = ObtenerAtributosEscogidos(ratq4);
                        for (Atributocalidad atr : atrEscogidos) {
                            documento.add(new Paragraph("\n" + atr.getAcNombre() + "\n\n", smallBold));
                            PdfPTable tabla = new PdfPTable(4);
                            tabla.addCell("Nombre");
                            tabla.addCell("Estimulo");
                            tabla.addCell("Ambiente");
                            tabla.addCell("Respuesta");

                            List<Escenario> listaEsc = ListEscenarios(pro);

                            for (Escenario esce : listaEsc) {
                                if (esce.getTblAtributoCalidadacID().getAcID() == atr.getAcID()) {
                                    tabla.addCell(esce.getEscNombre());
                                    tabla.addCell(esce.getEscEstimulo());
                                    tabla.addCell(esce.getEscAmbiente());
                                    tabla.addCell(esce.getEscRespuesta());
                                }
                            }
                            documento.add(tabla);
                        }
                    }
                    if (ratq.getRatQawPaso().equals("qaw7")) {
                        documento.add(new Paragraph("Escenarios priorizados:\n\n", subcategoryFont));

                        PdfPTable tabla = new PdfPTable(6);
                        tabla.addCell("Nombre");
                        tabla.addCell("Estimulo");
                        tabla.addCell("Ambiente");
                        tabla.addCell("Respuesta");
                        tabla.addCell("Atributo");
                        tabla.addCell("Voto");

                        List<Escenario> listaEsc = ListEscenarios(pro);

                        Collections.sort(listaEsc, new Comparator() {
                            @Override
                            public int compare(Object o1, Object o2) {
                                Escenario esc1, esc2;
                                esc1 = (Escenario) o1;
                                esc2 = (Escenario) o2;
                                return new Integer(esc1.getEscPrioridad())
                                        .compareTo(new Integer(esc2.getEscPrioridad()));

                            }
                        });

                        for (Escenario esce : listaEsc) {
                            tabla.addCell(esce.getEscNombre());
                            tabla.addCell(esce.getEscEstimulo());
                            tabla.addCell(esce.getEscAmbiente());
                            tabla.addCell(esce.getEscRespuesta());
                            tabla.addCell(esce.getTblAtributoCalidadacID().getAcNombre());
                            tabla.addCell(String.valueOf(esce.getEscPrioridad()));

                        }
                        documento.add(tabla);
                    }
                    if (ratq.getRatQawPaso().equals("qaw8")) {
                        documento.add(new Paragraph("Escenarios Refinados:\n\n", subcategoryFont));

                        PdfPTable tabla = new PdfPTable(9);
                        tabla.addCell("Nombre");
                        tabla.addCell("Estimulo");
                        tabla.addCell("Fuente");
                        tabla.addCell("Ambiente");
                        tabla.addCell("Artefacto");
                        tabla.addCell("Respuesta");
                        tabla.addCell("Medida");
                        tabla.addCell("Atributo");
                        tabla.addCell("Prioridad");

                        List<Escenario> listaEsc = ListEscenarios(pro);

                        Collections.sort(listaEsc, new Comparator() {
                            @Override
                            public int compare(Object o1, Object o2) {
                                Escenario esc1, esc2;
                                esc1 = (Escenario) o1;
                                esc2 = (Escenario) o2;
                                return new Integer(esc1.getEscPrioridad())
                                        .compareTo(new Integer(esc2.getEscPrioridad()));

                            }
                        });

                        for (Escenario esce : listaEsc) {
                            tabla.addCell(esce.getEscNombre());
                            tabla.addCell(esce.getEscEstimulo());
                            tabla.addCell(esce.getEscFuente());
                            tabla.addCell(esce.getEscAmbiente());
                            tabla.addCell(esce.getEscArtefacto());
                            tabla.addCell(esce.getEscRespuesta());
                            tabla.addCell(esce.getEscMedidaRespuesta());
                            tabla.addCell(esce.getTblAtributoCalidadacID().getAcNombre());
                            tabla.addCell(String.valueOf(esce.getEscPrioridad()));

                        }
                        documento.add(tabla);
                    }
                    documento.add(new Paragraph("Justificacin de las decisiones", smallBold));
                    documento.add(new Paragraph(razonamiento + "\n", paragraphFont));
                }
            }
            if (archivos != null) {
                documento.add(new Paragraph("Archivos anexos:\n", smallBold));
                for (File archi : archivos) {
                    documento.add(new Paragraph("Anexo" + anexo + ": " + archi.getName(), blueFont));
                    anexo++;
                }
            }
        } else {
            documento.add(new Paragraph("No se registr informacin para este paso\n\n", paragraphFont));
        }
    }
    documento.close();
    archivo.close();

}