Example usage for com.lowagie.text Paragraph setAlignment

List of usage examples for com.lowagie.text Paragraph setAlignment

Introduction

In this page you can find the example usage for com.lowagie.text Paragraph setAlignment.

Prototype

public void setAlignment(String alignment) 

Source Link

Document

Sets the alignment of this paragraph.

Usage

From source file:io.vertigo.quarto.plugins.export.rtf.RTFExporter.java

License:Apache License

/** {@inheritDoc} */
@Override// w  w w.  j  ava 2s.  c  o m
protected void createWriter(final Document document, final OutputStream out) {
    RtfWriter2.getInstance(document, out);

    // advanced page numbers : x/y
    final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL);
    //-----
    final Paragraph footerParagraph = new Paragraph();
    footerParagraph.add(new RtfPageNumber(font));
    footerParagraph.add(new Phrase(" / ", font));
    footerParagraph.add(new RtfTotalPageNumber(font));
    footerParagraph.setAlignment(Element.ALIGN_CENTER);
    //-----
    final HeaderFooter footer = new RtfHeaderFooter(footerParagraph);
    footer.setBorder(Rectangle.TOP);
    document.setFooter(footer);
}

From source file:ispyb.client.mx.results.ExportAutoProcAction.java

License:Open Source License

private void setAutoProcInfo(Document document) throws Exception {
    // header/*from www  .j a  v a 2  s.  c o m*/
    Table headerTable = new Table(1);
    headerTable.getDefaultCell().setBorderWidth(0);
    headerTable.setBorderWidth(0);
    headerTable.setCellsFitPage(true);
    headerTable.setAlignment(Element.ALIGN_LEFT);
    headerTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    headerTable.getDefaultCell().setBackgroundColor(PdfRtfExporter.LIGHT_YELLOW_COLOR);
    headerTable.getDefaultCell().setLeading(3);
    headerTable.setWidth(100); // percentage
    headerTable
            .addCell(new Paragraph("Crystal data and data-collection statistics", PdfRtfExporter.FONT_DOC_11));
    headerTable.addCell(new Paragraph("Values in parentheses are for the highest resolution shell.",
            PdfRtfExporter.FONT_DOC_11));
    document.add(headerTable);
    document.add(new Paragraph(" ", PdfRtfExporter.VERY_SMALL_FONT));
    // auto proc table
    Table autoProcTable = new Table(2);
    autoProcTable.getDefaultCell().setBorderWidth(0);
    autoProcTable.setBorderWidth(0);
    autoProcTable.setCellsFitPage(true);
    autoProcTable.setAlignment(Element.ALIGN_LEFT);
    autoProcTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    // autoProcTable.getDefaultCell().setLeading(3);
    autoProcTable.setPadding(2);
    autoProcTable.setWidth(100); // percentage
    // data
    String spaceGroup = autoProc == null ? "" : autoProc.getSpaceGroup();
    String unitCell_a = autoProc == null ? "" : autoProc.getRefinedCellA().toString();
    String unitCell_b = autoProc == null ? "" : autoProc.getRefinedCellB().toString();
    String unitCell_c = autoProc == null ? "" : autoProc.getRefinedCellC().toString();
    String unitCell_alpha = autoProc == null ? "" : autoProc.getRefinedCellAlpha().toString();
    String unitCell_beta = autoProc == null ? "" : autoProc.getRefinedCellBeta().toString();
    String unitCell_gamma = autoProc == null ? "" : autoProc.getRefinedCellGamma().toString();
    String resolutionRange = "";
    String nTotalObservations = "";
    String nTotalUniqueReflections = "";
    String completeness = "";
    String multiplicity = "";
    String isigma = "";
    String rmerge = "";
    if (autoProcStatisticsOverall != null) {
        resolutionRange = autoProcStatisticsOverall.getResolutionLimitLow() + " - "
                + autoProcStatisticsOverall.getResolutionLimitHigh();
        nTotalObservations = "" + autoProcStatisticsOverall.getnTotalObservations();
        nTotalUniqueReflections = "" + (autoProcStatisticsOverall.getnTotalUniqueObservations() == null ? ""
                : autoProcStatisticsOverall.getnTotalUniqueObservations());
        completeness = "" + autoProcStatisticsOverall.getCompleteness();
        multiplicity = "" + autoProcStatisticsOverall.getMultiplicity();
        isigma = "" + autoProcStatisticsOverall.getMeanIoverSigI();
        rmerge = ""
                + (autoProcStatisticsOverall.getRmerge() == null ? "" : autoProcStatisticsOverall.getRmerge());
    }
    if (autoProcStatisticsOuter != null) {
        resolutionRange += " (" + autoProcStatisticsOuter.getResolutionLimitLow() + " - "
                + autoProcStatisticsOuter.getResolutionLimitHigh() + ")";
        nTotalObservations += " (" + autoProcStatisticsOuter.getnTotalObservations() + ")";
        nTotalUniqueReflections += autoProcStatisticsOuter.getnTotalUniqueObservations() == null ? ""
                : (" (" + autoProcStatisticsOuter.getnTotalUniqueObservations() + ")");
        completeness += " (" + autoProcStatisticsOuter.getCompleteness() + ")";
        multiplicity += " (" + autoProcStatisticsOuter.getMultiplicity() + ")";
        isigma += " (" + autoProcStatisticsOuter.getMeanIoverSigI() + ")";
        rmerge += " ("
                + (autoProcStatisticsOuter.getRmerge() == null ? "" : autoProcStatisticsOuter.getRmerge())
                + ")";
    }
    // space group
    autoProcTable.addCell(new Paragraph("Space Group", PdfRtfExporter.FONT_DOC_11));
    autoProcTable.addCell(new Paragraph(spaceGroup, PdfRtfExporter.FONT_DOC_11));
    // unit cell parameters
    autoProcTable.addCell(
            new Paragraph("Unit-cell parameters (" + Constants.ANGSTROM + ")", PdfRtfExporter.FONT_DOC_11));
    autoProcTable.addCell(new Paragraph("", PdfRtfExporter.FONT_DOC_11));
    Paragraph pa = new Paragraph("\t a", PdfRtfExporter.FONT_DOC_11);
    pa.setAlignment(Element.ALIGN_JUSTIFIED);
    pa.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT);
    autoProcTable.addCell(pa);
    autoProcTable.addCell(new Paragraph(unitCell_a, PdfRtfExporter.FONT_DOC_11));
    Paragraph pb = new Paragraph("\t b", PdfRtfExporter.FONT_DOC_11);
    pb.setAlignment(Element.ALIGN_JUSTIFIED);
    pb.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT);
    autoProcTable.addCell(pb);
    autoProcTable.addCell(new Paragraph(unitCell_b, PdfRtfExporter.FONT_DOC_11));
    Paragraph pc = new Paragraph("\t c", PdfRtfExporter.FONT_DOC_11);
    pc.setAlignment(Element.ALIGN_JUSTIFIED);
    pc.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT);
    autoProcTable.addCell(pc);
    autoProcTable.addCell(new Paragraph(unitCell_c, PdfRtfExporter.FONT_DOC_11));
    // Issue 1733: cell angles info added
    Paragraph palpha = new Paragraph("\t alpha", PdfRtfExporter.FONT_DOC_11);
    palpha.setAlignment(Element.ALIGN_JUSTIFIED);
    palpha.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT);
    autoProcTable.addCell(palpha);
    autoProcTable.addCell(new Paragraph(unitCell_alpha, PdfRtfExporter.FONT_DOC_11));
    Paragraph pbeta = new Paragraph("\t beta", PdfRtfExporter.FONT_DOC_11);
    pbeta.setAlignment(Element.ALIGN_JUSTIFIED);
    pbeta.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT);
    autoProcTable.addCell(pbeta);
    autoProcTable.addCell(new Paragraph(unitCell_beta, PdfRtfExporter.FONT_DOC_11));
    Paragraph pgamma = new Paragraph("\t gamma", PdfRtfExporter.FONT_DOC_11);
    pgamma.setAlignment(Element.ALIGN_JUSTIFIED);
    pgamma.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT);
    autoProcTable.addCell(pgamma);
    autoProcTable.addCell(new Paragraph(unitCell_gamma, PdfRtfExporter.FONT_DOC_11));
    // resolution range
    autoProcTable.addCell(
            new Paragraph("Resolution range (" + Constants.ANGSTROM + ")", PdfRtfExporter.FONT_DOC_11));
    autoProcTable.addCell(new Paragraph(resolutionRange, PdfRtfExporter.FONT_DOC_11));
    // Observed reflections
    autoProcTable.addCell(new Paragraph("Observed reflections", PdfRtfExporter.FONT_DOC_11));
    autoProcTable.addCell(new Paragraph(nTotalObservations, PdfRtfExporter.FONT_DOC_11));
    // No. of unique reflections
    autoProcTable.addCell(new Paragraph("No. of unique reflections", PdfRtfExporter.FONT_DOC_11));
    autoProcTable.addCell(new Paragraph(nTotalUniqueReflections, PdfRtfExporter.FONT_DOC_11));
    // Completeness
    autoProcTable.addCell(new Paragraph("Completeness (%)", PdfRtfExporter.FONT_DOC_11));
    autoProcTable.addCell(new Paragraph(completeness, PdfRtfExporter.FONT_DOC_11));
    // multiplicity
    autoProcTable.addCell(new Paragraph("Multiplicity", PdfRtfExporter.FONT_DOC_11));
    autoProcTable.addCell(new Paragraph(multiplicity, PdfRtfExporter.FONT_DOC_11));
    new Phrase();
    // I/(I)
    Phrase p = Phrase.getInstance("<I/" + (char) 963 + "(I)>");
    p.setFont(PdfRtfExporter.FONT_DOC_11);
    autoProcTable.addCell(p);
    autoProcTable.addCell(new Paragraph(isigma, PdfRtfExporter.FONT_DOC_11));
    // Rmerge
    Chunk c1 = new Chunk("R", PdfRtfExporter.FONT_DOC_11);
    Chunk c2 = new Chunk("merge", PdfRtfExporter.FONT_DOC_EXPONENT);
    c2.setTextRise(PdfRtfExporter.TEXT_RISE_SUB);
    Chunk c3 = new Chunk("(%)", PdfRtfExporter.FONT_DOC_11);
    Chunk c4 = new Chunk("#", PdfRtfExporter.FONT_DOC_EXPONENT_BLUE);
    c4.setTextRise(PdfRtfExporter.TEXT_RISE_EXP);
    Paragraph rMergeParagraph = new Paragraph();
    rMergeParagraph.add(c1);
    rMergeParagraph.add(c2);
    rMergeParagraph.add(c3);
    rMergeParagraph.add(c4);
    autoProcTable.addCell(rMergeParagraph);
    autoProcTable.addCell(new Paragraph(rmerge, PdfRtfExporter.FONT_DOC_11));
    document.add(autoProcTable);
    document.add(new Paragraph(" ", PdfRtfExporter.FONT_DOC_11));
    // nota bene info
    Paragraph nbParagraph = new Paragraph();
    nbParagraph.add(c4);
    nbParagraph.add(c1);
    nbParagraph.add(c2);
    Chunk cesp = new Chunk(" ", PdfRtfExporter.FONT_DOC_11);
    Chunk c5 = new Chunk(" = ", PdfRtfExporter.FONT_DOC_11);
    nbParagraph.add(c5);
    Phrase pSigma = Phrase.getInstance("" + (char) 931);
    pSigma.setFont(PdfRtfExporter.FONT_DOC_11);
    nbParagraph.add(pSigma);
    Chunk chkl = new Chunk("hkl", PdfRtfExporter.FONT_DOC_EXPONENT);
    chkl.setTextRise(PdfRtfExporter.TEXT_RISE_SUB);
    nbParagraph.add(chkl);
    nbParagraph.add(cesp);
    nbParagraph.add(pSigma);
    Chunk ci = new Chunk("i", PdfRtfExporter.FONT_DOC_EXPONENT);
    ci.setTextRise(PdfRtfExporter.TEXT_RISE_SUB);
    nbParagraph.add(ci);
    Chunk c8 = new Chunk(" |I", PdfRtfExporter.FONT_DOC_11);
    nbParagraph.add(c8);
    nbParagraph.add(ci);
    Chunk c9 = new Chunk("(hkl) - (I(hkl))| / ", PdfRtfExporter.FONT_DOC_11);
    nbParagraph.add(c9);
    nbParagraph.add(pSigma);
    nbParagraph.add(chkl);
    nbParagraph.add(cesp);
    nbParagraph.add(pSigma);
    nbParagraph.add(ci);
    nbParagraph.add(cesp);
    Chunk c10 = new Chunk("I", PdfRtfExporter.FONT_DOC_11);
    nbParagraph.add(c10);
    nbParagraph.add(ci);
    Chunk c11 = new Chunk("(hkl), where ", PdfRtfExporter.FONT_DOC_11);
    nbParagraph.add(c11);
    Chunk c12 = new Chunk("I", PdfRtfExporter.FONT_DOC_11_ITALIC);
    nbParagraph.add(c12);
    Chunk cii = new Chunk("i", PdfRtfExporter.FONT_DOC_EXPONENT_ITALIC);
    cii.setTextRise(PdfRtfExporter.TEXT_RISE_SUB);
    nbParagraph.add(cii);
    Chunk c13 = new Chunk("(hkl)", PdfRtfExporter.FONT_DOC_11_ITALIC);
    nbParagraph.add(c13);
    Chunk c14 = new Chunk(" is the ", PdfRtfExporter.FONT_DOC_11);
    nbParagraph.add(c14);
    Chunk c15 = new Chunk("i", PdfRtfExporter.FONT_DOC_11_ITALIC);
    nbParagraph.add(c15);
    Chunk c16 = new Chunk("th observation of reflection ", PdfRtfExporter.FONT_DOC_11);
    nbParagraph.add(c16);
    Chunk chklI = new Chunk("hkl", PdfRtfExporter.FONT_DOC_11_ITALIC);
    nbParagraph.add(chklI);
    Chunk c17 = new Chunk(" and ", PdfRtfExporter.FONT_DOC_11);
    nbParagraph.add(c17);
    Chunk c18 = new Chunk("<I(hkl)> ", PdfRtfExporter.FONT_DOC_11_ITALIC);
    nbParagraph.add(c18);
    Chunk c19 = new Chunk(" is the weighted average intensity for all observations of reflection ",
            PdfRtfExporter.FONT_DOC_11);
    nbParagraph.add(c19);
    nbParagraph.add(chklI);
    Chunk c20 = new Chunk(".", PdfRtfExporter.FONT_DOC_11);
    nbParagraph.add(c20);
    document.add(nbParagraph);
    document.add(new Paragraph(" ", PdfRtfExporter.FONT_DOC_11));
}

From source file:it.prato.comune.tolomeo.web.TolomeoPrintPDFServlet.java

License:Open Source License

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    LogInterface logger = getLogger(request);

    String titolo = request.getParameter("titolo");
    String descrizione = request.getParameter("descrizione");
    String scala = request.getParameter("scala");
    String mapx = request.getParameter("mapx");
    String mapy = request.getParameter("mapy");
    //creo URL alla mappa
    URL urlMappa = new URL(URLDecoder.decode(request.getParameter("urlMappa"), "UTF-8"));
    URI uriMappa = null;/*ww w .  ja v a  2 s  . c  o m*/
    try {
        uriMappa = new URI(urlMappa.getProtocol(), null, urlMappa.getHost(), urlMappa.getPort(),
                urlMappa.getPath(), urlMappa.getQuery() + "&mode=map&scale=" + scala + "&mapxy=" + mapx + "+"
                        + mapy + "&map_size=500 500",
                null);
        logger.info("URI di stampa mappa: " + uriMappa);
    } catch (URISyntaxException e) {
        logger.error("URI errore di sintassi", e);
    }

    Font BOLD15 = new Font(Font.HELVETICA, 15, Font.BOLD);
    Font FONT12 = new Font(Font.HELVETICA, 12, Font.NORMAL);
    Font FONT10 = new Font(Font.HELVETICA, 10, Font.NORMAL);

    Document doc = new Document();
    ;
    PdfWriter pdf = null;
    Paragraph par = new Paragraph();

    try {

        //creo il PDF
        response.setContentType("application/pdf");
        pdf = PdfWriter.getInstance(doc, response.getOutputStream());

        //attributi file
        doc.addTitle("Mappa di Prato");
        doc.addAuthor("Comune di Prato");
        doc.open();

        //intestazione
        par.setAlignment(Paragraph.ALIGN_CENTER);
        print("Comune di Prato", BOLD15, par, doc);
        print(titolo, FONT10, par, doc);
        print("", FONT10, par, doc);

        //mappa
        Image mappa = Image.getInstance(uriMappa.toURL());
        mappa.setAlignment(Image.MIDDLE);
        mappa.setBorder(Rectangle.BOX);
        mappa.setBorderWidth(1f);
        doc.add(mappa);

    } catch (Exception e) {
        logger.error("Errore durante la creazione del PDF", e);
        printErr(doc);
    } finally {
        doc.close();
        pdf.close();
        response.getOutputStream().close();
    }
}

From source file:it.prato.comune.tolomeo.web.TolomeoPrintPDFServlet.java

License:Open Source License

private void printErr(Document doc) {
    try {//  w  w w  . j av  a2 s .  c o  m
        Paragraph par = new Paragraph();
        par.setAlignment(Paragraph.ALIGN_CENTER);
        par.add("\n\n");
        par.add("Errore di stampa!");
        par.add("\n");
        par.add("Contattare sit@comune.prato.it");

        doc.add(par);
    } catch (Exception e) {
    }
}

From source file:jm.web.Addons.java

License:GNU General Public License

public static Paragraph setParrafoPDF(String texto, int tipo, int tamanio, int estilo, int alineacion) {
    Paragraph parrafo = new Paragraph(texto, new Font(tipo, tamanio, estilo));
    parrafo.setAlignment(alineacion);
    return parrafo;
}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

public byte[] writePage() throws Exception {
    ByteArrayOutputStream bout = new ByteArrayOutputStream();

    try {//from w  w w .  j  ava 2s .  c  om
        logo = Image.getInstance(root.getAbsolutePath() + "/logo.gif");
        logo.setAlignment(Image.ALIGN_LEFT);
    } catch (Exception exc) {
        exc.printStackTrace();
    }

    baseArial = BaseFont.createFont(root.getAbsolutePath() + "/objects/arial.ttf", BaseFont.CP1257,
            BaseFont.EMBEDDED);

    Document doc = new Document(PageSize.A4, 56.5354331f, 22.6771654f, 28.3464567f, 25.0f);
    PdfWriter.getInstance(doc, bout);

    doc.open();

    logo.setAbsolutePosition(28.3464567f, doc.getPageSize().height() - logo.height() - 25.0f);
    doc.add(logo);
    Paragraph pg = new Paragraph(sdf.format(new Date()), new Font(baseArial, 10));
    pg.setAlignment(Element.ALIGN_RIGHT);
    doc.add(pg);
    doc.add(new Phrase("\n\n\n"));

    writeClientInfo(doc);
    writeTicketInfo(doc);
    writeJobInfo(doc);
    writeWorkerInfo(doc);

    doc.close();

    return bout.toByteArray();
}

From source file:managedbean.afos.FlightDutyBacking.java

public void preProcessPDF(Object document) throws IOException, BadElementException, DocumentException {
    Document pdf = (Document) document;
    pdf.open();/* w w  w  . jav a 2  s  . c o m*/
    pdf.setPageSize(PageSize.A4);
    ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext()
            .getContext();
    String logo = servletContext.getRealPath("") + File.separator + "resources" + File.separator + "images"
            + File.separator + "logo.png";
    Image logoImg = Image.getInstance(logo);
    logoImg.scalePercent(20f);
    SimpleDateFormat sdf = new SimpleDateFormat("E, dd/MM/yyyy 'at' hh:mm:ss a");

    Font titleFont = new Font();
    Font subtitleFont = new Font();
    titleFont.setSize(16);
    titleFont.setStyle(Font.BOLD);
    subtitleFont.setSize(12);
    subtitleFont.setStyle(Font.BOLD);

    Paragraph title = new Paragraph(flightReport.getType() + " Duty Report", titleFont);
    title.setAlignment(Element.ALIGN_CENTER);
    title.setSpacingAfter(12f);

    Paragraph subTitle1 = new Paragraph("Flight Information:", subtitleFont);
    subTitle1.setSpacingAfter(8f);

    Paragraph subTitle2 = new Paragraph(flightReport.getType() + " Checklist:", subtitleFont);
    subTitle2.setSpacingBefore(12f);
    subTitle2.setSpacingAfter(12f);

    com.lowagie.text.List list = new com.lowagie.text.List(true, 15);
    list.setLettered(true);
    list.add("Flight: " + selectedFlightSchedule.getFlight().getFlightNo());
    list.add("Return Flight: " + selectedFlightSchedule.getFlight().getReturnedFlight().getFlightNo());
    Airport departure, arrival;
    departure = selectedFlightSchedule.getLeg().getDepartAirport();
    arrival = selectedFlightSchedule.getLeg().getArrivalAirport();
    sdf.setTimeZone(TimeZone.getTimeZone(getTimeZone(departure)));
    list.add("Departure Time: " + sdf.format(selectedFlightSchedule.getDepartDate()) + " ("
            + departure.getCity().getCityName() + " Time)");
    sdf.setTimeZone(TimeZone.getTimeZone(getTimeZone(arrival)));
    list.add("Arrival Time: " + sdf.format(selectedFlightSchedule.getArrivalDate()) + " ("
            + arrival.getCity().getCityName() + " Time)");
    list.add("Origin: " + departure.getCity().getCityName() + " (" + departure.getAirportName() + ")");
    list.add("Destination: " + arrival.getCity().getCityName() + " (" + arrival.getAirportName() + ")");

    pdf.add(logoImg);
    pdf.add(new Paragraph(" "));
    pdf.add(title);
    pdf.add(subTitle1);
    pdf.add(list);
    pdf.add(subTitle2);
    pdf.setMargins(72, 72, 72, 72);
    pdf.addAuthor("Merlion Airline");
    pdf.addCreationDate();
    sdf.applyPattern("dd/MM/yyyy_hh:mm:ss");
    pdf.addTitle("Post-Flight Duty Report_" + selectedFlightSchedule.getFlight().getFlightNo() + "_"
            + sdf.format(selectedFlightSchedule.getDepartDate()));
}

From source file:mx.avanti.siract.ui.RACTBeanUI.java

public void postProcessPDF(Object document) throws IOException, DocumentException {
    final Document pdf = (Document) document;
    TreeNode[] selectedNodesPDF = selectedNodes;

    if (selectedNodes != null) {
        for (TreeNode nodo : selectedNodes) {
            System.out.println("*********************" + ((NodoMultiClass) nodo.getData()).getNombre());
        }/*w  w w . ja va 2 s  .  c  om*/
    }
    pdf.setPageSize(PageSize.A4.rotate());
    pdf.open();
    String nombrep = profesor.getPronombre() + " " + profesor.getProapellidoPaterno() + " "
            + profesor.getProapellidoMaterno();
    String numEmpPro = Integer.toString(profesor.getPronumeroEmpleado());
    String porAv = Float.toString(porcentajeAvance);
    SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");

    //Obtener el nombre del programa educativo seleccionado
    String nombreProgEdu = "";
    int programaEducativoSeleccionado2 = Integer.parseInt(programaEducativoSeleccionado);
    for (int x = 0; x < programasEducativos.size(); x++) {
        if (programasEducativos.get(x).getPedid() == programaEducativoSeleccionado2) {
            nombreProgEdu = programasEducativos.get(x).getPednombre();
        }
    }
    //----------------------------------------------------------------------------------

    //Obtener el nombre de la unidad de aprendizaje y clave seleccionada
    String nombreUniApr = "";
    String nombreclave = "";
    int uniAprselec2 = Integer.parseInt(unidadAprendizajeSeleccionada);
    for (int x = 0; x < unidadesaprendisaje.size(); x++) {
        if (unidadesaprendisaje.get(x).getUapclave() == uniAprselec2) {
            nombreUniApr = unidadesaprendisaje.get(x).getUapnombre();
            nombreclave = Integer.toString(unidadesaprendisaje.get(x).getUapclave());
        }
    }
    //----------------------------------------------------------------------

    // rutaImagen es la ruta para acceder a la imagen guardada en el folder resources del proyecto
    try {
        //            Image imagenLogo = Image.getInstance("C:\\Users\\Y\\Desktop\\RACT 22-01-2015\\RACT\\build\\web\\resources\\imagenes\\logo.jpg");
        Image imagenLogo = Image.getInstance(RACTBeanUI.class.getResource("imagenes/logo.jpg"));

        //Posicion de imagen (Horizontal, Vertiacal)
        imagenLogo.setAbsolutePosition(120f, 460f);

        //Tamao de imagen (Ancho, largo)
        imagenLogo.scaleAbsolute(90, 120);
        //imagenLogo.scaleAbsoluteWidth(100f);
        //imagenLogo.scaleAbsoluteHeight(150f);
        //imagenLogo.scaleToFit(100f, 120f); Esta es la buena
        //Image imagenLogo = Image.getInstance("http://ed.uabc.mx/sed/images/logo.jpg");
        //imagenLogo.scaleAbsolute(70f, 90f);
        pdf.add(imagenLogo);
    } catch (Exception exception) {
        System.out.println("****NO SE ENCONTRO LA RUTA DE IMAGEN ESPECIFICADA");
    }
    //Tabla con UABC y Nombre del profesor(a)
    PdfPTable pdfTabletitulo = new PdfPTable(2);
    pdfTabletitulo.getDefaultCell().setBorder(PdfPCell.NO_BORDER);
    PdfPTable pdfTabletitulo2 = new PdfPTable(2);
    pdfTabletitulo2.getDefaultCell().setBorder(PdfPCell.NO_BORDER);

    Paragraph UABC = new Paragraph("Universidad Autnoma de Baja California",
            FontFactory.getFont(FontFactory.TIMES, 22, Font.BOLD, new Color(0, 113, 65)));
    UABC.setAlignment(Element.ALIGN_CENTER);
    Paragraph esp = new Paragraph(" ");
    pdf.add(UABC);
    pdf.add(esp);
    pdf.add(esp);
    pdf.add(esp);
    pdf.add(esp);
    pdfTabletitulo.addCell(new Paragraph(""));
    pdfTabletitulo.addCell(new Paragraph(""));
    pdfTabletitulo.addCell(new Paragraph(""));
    pdfTabletitulo.addCell(new Paragraph(""));
    pdfTabletitulo.addCell(new Paragraph(""));
    pdfTabletitulo.addCell(new Paragraph(""));
    pdfTabletitulo.addCell(new Paragraph(""));
    pdfTabletitulo.addCell(new Paragraph(""));
    pdfTabletitulo.addCell(new Paragraph(""));
    pdfTabletitulo.addCell(new Paragraph(""));

    pdfTabletitulo.addCell(new Paragraph("Profesor(a): ",
            FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, new Color(0, 0, 0))));
    pdfTabletitulo.addCell(new Paragraph(nombrep));

    pdfTabletitulo2.addCell(new Paragraph("Num. de Empleado: ",
            FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, new Color(0, 0, 0))));
    pdfTabletitulo2.addCell(new Paragraph(numEmpPro));

    pdfTabletitulo.setHorizontalAlignment(25);
    //pdfTabletitulo.setHorizontalAlignment(Element.ALIGN_CENTER);
    //document.add(table);
    float[] columnWidthsss = new float[] { 4f, 28 };
    pdfTabletitulo.setWidths(columnWidthsss);
    pdf.add(pdfTabletitulo);

    float[] columnWidthss = new float[] { 10f, 38 };
    pdfTabletitulo2.setWidths(columnWidthss);
    pdf.add(pdfTabletitulo2);

    pdf.add(new Phrase(" "));

    //----------------------------------------------------------------------
    //Tabla Cabezera
    PdfPTable pdftablecabezera = new PdfPTable(4);
    pdftablecabezera.getDefaultCell().setBorder(PdfPCell.NO_BORDER);
    PdfPTable pdftablecabezera2 = new PdfPTable(5);
    pdftablecabezera2.getDefaultCell().setBorder(PdfPCell.NO_BORDER);

    pdftablecabezera.addCell(new Paragraph("Programa educativo: ",
            FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, new Color(0, 0, 0))));
    pdftablecabezera.addCell(new Paragraph("Fecha: ",
            FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, new Color(0, 0, 0))));
    pdftablecabezera.addCell(new Paragraph("Ciclo Escolar: ",
            FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, new Color(0, 0, 0))));
    pdftablecabezera.addCell(new Paragraph("Avance Global: ",
            FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, new Color(0, 0, 0))));
    pdftablecabezera.addCell(new Paragraph(nombreProgEdu));
    pdftablecabezera.addCell(new Paragraph(formato.format(new Date())));
    pdftablecabezera.addCell(new Paragraph("        " + cicloEscolar));
    pdftablecabezera.addCell(new Paragraph("        " + porAv));

    pdftablecabezera.addCell(new Paragraph(" "));
    pdftablecabezera.addCell(new Paragraph(" "));
    pdftablecabezera.addCell(new Paragraph(" "));
    pdftablecabezera.addCell(new Paragraph(" "));

    pdftablecabezera2.addCell(new Paragraph("Unidad de Aprendizaje: ",
            FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, new Color(0, 0, 0))));
    pdftablecabezera2.addCell(new Paragraph("Clave: ",
            FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, new Color(0, 0, 0))));
    pdftablecabezera2.addCell(new Paragraph("Grupo: ",
            FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, new Color(0, 0, 0))));
    pdftablecabezera2.addCell(new Paragraph("Subgrupo: ",
            FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, new Color(0, 0, 0))));
    pdftablecabezera2.addCell(new Paragraph("Tipo Grupo: ",
            FontFactory.getFont(FontFactory.TIMES, 14, Font.BOLD, new Color(0, 0, 0))));
    pdftablecabezera2.addCell(new Paragraph(nombreUnidadSeleccionado));
    pdftablecabezera2.addCell(new Paragraph(claveUnidadAprendizajeSeleccionada));
    pdftablecabezera2.addCell(new Paragraph("   " + grupo));
    pdftablecabezera2.addCell(new Paragraph("       " + subGrupo));
    String tipoGrupo = "";
    switch (this.tipoUnidadAprendizaje) {
    case "C":
        tipoGrupo = "Clase";
        break;
    case "L":
        tipoGrupo = "Laboratorio";
        break;
    case "T":
        tipoGrupo = "Taller";
        break;
    case "P":
        tipoGrupo = "Practica";
        break;
    case "CL":
        tipoGrupo = "Practicas Clinica";
        break;
    }
    pdftablecabezera2.addCell(new Paragraph("       " + tipoGrupo));
    pdftablecabezera2.addCell(new Paragraph(" "));

    pdftablecabezera.setHorizontalAlignment(25);
    float[] columnWidths = new float[] { 38f, 10f, 14f, 18f };
    pdftablecabezera.setWidths(columnWidths);
    pdf.add(pdftablecabezera);

    pdftablecabezera2.setHorizontalAlignment(25);
    float[] columnWidthss2 = new float[] { 38f, 10f, 8f, 11f, 14f };
    pdftablecabezera2.setWidths(columnWidthss2);
    pdf.add(pdftablecabezera2);

    pdf.add(new Phrase(" "));

    //----------------------------------------------------------------------
    Paragraph numrep = new Paragraph("Reporte # " + numeroReporte,
            FontFactory.getFont(FontFactory.TIMES, 16, Font.BOLD, new Color(0, 0, 0)));
    numrep.setAlignment(Element.ALIGN_CENTER);
    pdf.add(numrep);
    pdf.add(new Paragraph(" "));
    //Tabla con Datos 
    PdfPTable pdfTable = new PdfPTable(3);
    pdfTable.addCell(new Phrase("Nombre",
            FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(0, 0, 0))));
    pdfTable.addCell(new Phrase("Porcentaje",
            FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(0, 0, 0))));
    pdfTable.addCell(new Phrase("Observaciones",
            FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(0, 0, 0))));

    //Evitar Null pointer exception por no tener nodoes en selectedNodes
    //Se utiliza un auxiliar de selectedNodes por que hay posibilidad de que selectedNodes se modifique durante el proceso de generacion del PDF
    if (selectedNodesPDF != null && selectedNodesPDF.length > 0) {

        //Regresar a lo basicoString
        int nns = selectedNodesPDF.length;
        String[] ns = new String[nns];
        for (int x = 0; x < selectedNodesPDF.length; x++) {
            ns[x] = ((NodoMultiClass) selectedNodesPDF[x].getData()).getNumero() + "--"
                    + ((NodoMultiClass) selectedNodes[x].getData()).getNombre() + "--"
                    + ((NodoMultiClass) selectedNodes[x].getData()).getPorcentajeAvance() + "--"
                    + ((NodoMultiClass) selectedNodes[x].getData()).getObservaciones() + " -- ";
        }
        String[] filas = new String[4];
        String[] nstr = new String[3];

        String[] filas2 = new String[4];
        String[] nstr2 = new String[3];

        for (int x = 1; x < ns.length; x++) {
            for (int y = 0; y < ns.length - x; y++) {
                //Obtengo los valores para hacer las comparaciones
                int[] n = new int[3];
                int[] n2 = new int[3];
                filas = ns[y].split("--");
                nstr = filas[0].split("\\.");
                for (int z = 0; z < nstr.length; z++) {
                    if (nstr == null) {
                        n[z] = 0;
                    } else {
                        n[z] = Integer.parseInt(nstr[z]);
                    }
                }
                filas2 = ns[y + 1].split("--");
                nstr2 = filas2[0].split("\\.");
                for (int z = 0; z < nstr2.length; z++) {
                    if (nstr2 == null) {
                        n2[z] = 0;
                    } else {
                        n2[z] = Integer.parseInt(nstr2[z]);
                    }
                }
                //-------------------------------------------------comparacion
                if (n[0] == n2[0]) {
                    if (n[1] == n2[1]) {
                        if (n[2] > n2[2]) {
                            String aux = ns[y];
                            ns[y] = ns[y + 1];
                            ns[y + 1] = aux;
                        }
                    } else {
                        if (n[1] > n2[1]) {
                            String aux = ns[y];
                            ns[y] = ns[y + 1];
                            ns[y + 1] = aux;
                        }
                    }
                } else {
                    if (n[0] > n2[0]) {
                        String aux = ns[y];
                        ns[y] = ns[y + 1];
                        ns[y + 1] = aux;
                    }
                }
                //-------------------------------------------------------------
            }
        }

        String[] auxNum = new String[4];
        for (int x = 0; x < ns.length; x++) {

            filas = ns[x].split("--");
            num = filas[0].split("\\.");

            //Auxiliar para agregar padre de tema/subtema
            int auxMargen = 1;
            //Agregar unidad a la que pertenece el tema/subtema

            String[] auxNum2 = auxNum;
            int tamanoArbol = root.getChildCount();
            //AGREGAR A TEMA
            if (Integer.parseInt(num[0]) > tamanoArbol) {
                auxMargen = Integer.parseInt(num[0]) - tamanoArbol;
            }
            if (num.length >= 2 && auxNum2[0] != null && !auxNum2[0].equals(num[0])) {
                if (!num[1].equals("0")) {
                    while (!num[0].equals(auxNum2[0]) && auxMargen > 0) {
                        System.out.println("XXXXXXIteracion  para encontrar padre XXXXXXX 0" + auxMargen);
                        auxNum2 = (((NodoMultiClass) root.getChildren()
                                .get(Integer.parseInt(num[0]) - auxMargen).getData()).getNumero()).split("\\.");
                        //if(auxNum[0]!=null&&Integer.parseInt(num[0])>Integer.parseInt(auxNum[0])){
                        if (num[0].equals(auxNum2[0])) {

                        } else {
                            auxMargen--;
                        }

                    }
                    System.out.println("***Unidad Padre" + ((NodoMultiClass) root.getChildren()
                            .get(Integer.parseInt(num[0]) - auxMargen).getData()).getNombre());
                    NodoMultiClass auxNodo = ((NodoMultiClass) root.getChildren()
                            .get(Integer.parseInt(num[0]) - auxMargen).getData());
                    //UTIL PARA PONER TEXTO TACHADO
                    //                     Chunk strikethrough = new Chunk("Strikethrough.");
                    //                      strikethrough.setUnderline(0.1f, 3f); //0.1 thick, 2 y-location
                    //                     document.add(strikethrough);
                    pdfTable.addCell(new Phrase(auxNodo.getNumero() + ".- " + auxNodo.getNombre(), FontFactory
                            .getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(154, 151, 151))));
                    pdfTable.addCell(new Phrase(auxNodo.getPorcentajeAvance(), FontFactory
                            .getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(154, 151, 151))));
                    pdfTable.addCell(auxNodo.getObservaciones());

                }
            } else {
                if (auxNum2[0] == null && num.length >= 2) {
                    auxNum2 = (((NodoMultiClass) root.getChildren().get(Integer.parseInt(num[0]) - auxMargen)
                            .getData()).getNumero()).split("\\.");
                    while (!num[0].equals(auxNum2[0]) && auxMargen > 0) {
                        System.out.println("XXXXXXIteracion  para encontrar padre XXXXXXX 0" + auxMargen);
                        auxNum2 = (((NodoMultiClass) root.getChildren()
                                .get(Integer.parseInt(num[0]) - auxMargen).getData()).getNumero()).split("\\.");
                        //if(auxNum[0]!=null&&Integer.parseInt(num[0])>Integer.parseInt(auxNum[0])){
                        if (num[0].equals(auxNum2[0])) {

                        } else {
                            auxMargen--;
                        }
                    }
                    System.out.println("***Unidad Padre" + ((NodoMultiClass) root.getChildren()
                            .get(Integer.parseInt(num[0]) - auxMargen).getData()).getNombre());
                    NodoMultiClass auxNodo = ((NodoMultiClass) root.getChildren()
                            .get(Integer.parseInt(num[0]) - auxMargen).getData());
                    //UTIL PARA PONER TEXTO TACHADO
                    //                     Chunk strikethrough = new Chunk("Strikethrough.");
                    //                      strikethrough.setUnderline(0.1f, 3f); //0.1 thick, 2 y-location
                    //                     document.add(strikethrough);
                    pdfTable.addCell(new Phrase(auxNodo.getNumero() + ".- " + auxNodo.getNombre(), FontFactory
                            .getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(154, 151, 151))));
                    pdfTable.addCell(new Phrase(auxNodo.getPorcentajeAvance(), FontFactory
                            .getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(154, 151, 151))));
                    pdfTable.addCell(auxNodo.getObservaciones());

                }
            }

            //AGREGAR A SUBTEMA
            String[] auxNumeroUnidad = new String[4];
            int auxMargen2 = 1;
            if (num.length == 3 && auxNum[1] != null && !auxNum[1].equals(num[1])) {
                if (!num[2].equals("0")) {
                    while (!num[0].equals(auxNum[0]) && auxMargen >= 0) {
                        NodoMultiClass auxNodoUnidad = ((NodoMultiClass) root.getChildren()
                                .get(Integer.parseInt(num[0]) - auxMargen).getData());
                        auxNumeroUnidad = auxNodoUnidad.getNumero().split("\\.");
                        tamanoArbol = root.getChildren().get(Integer.parseInt(num[0])).getChildCount();
                        if (Integer.parseInt(num[1]) > tamanoArbol) {
                            auxMargen2 = Integer.parseInt(num[1]) - tamanoArbol;
                        }

                        while (auxNumeroUnidad[0].equals(num[0]) && !num[1].equals(auxNum[1])
                                && auxMargen > 0) {
                            System.out.println("XXXXXXIteracion  para encontrar padre XXXXXXX 0" + auxMargen);
                            auxNum = (((NodoMultiClass) root.getChildren()
                                    .get(Integer.parseInt(num[0]) - auxMargen).getChildren()
                                    .get(Integer.parseInt(num[1]) - auxMargen2).getData()).getNumero())
                                            .split("\\.");
                            //if(auxNum[0]!=null&&Integer.parseInt(num[0])>Integer.parseInt(auxNum[0])){
                            if (num[1].equals(auxNum[1])) {

                            } else {
                                auxMargen2--;
                            }

                        }
                        //                            auxNum = (((NodoMultiClass) root.getChildren().get(Integer.parseInt(num[1]) - auxMargen).getData()).getNumero()).split("\\.");
                        if (num[0].equals(auxNum[0])) {
                        } else {
                            auxMargen--;
                        }
                    }

                    System.out.println("*****Unidad Padre(SUBTEMA)"
                            + ((NodoMultiClass) root.getChildren().get(Integer.parseInt(num[0]) - auxMargen)
                                    .getChildren().get(Integer.parseInt(num[1]) - auxMargen2).getData())
                                            .getNombre());
                    NodoMultiClass auxNodo = ((NodoMultiClass) root.getChildren()
                            .get(Integer.parseInt(num[0]) - auxMargen).getChildren()
                            .get(Integer.parseInt(num[1]) - auxMargen2).getData());
                    //UTIL PARA PONER TEXTO TACHADO
                    //                     Chunk strikethrough = new Chunk("Strikethrough.");
                    //                      strikethrough.setUnderline(0.1f, 3f); //0.1 thick, 2 y-location
                    //                     document.add(strikethrough);
                    pdfTable.addCell(
                            new Phrase("   " + auxNodo.getNumero() + ".- " + auxNodo.getNombre(), FontFactory
                                    .getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(154, 151, 151))));
                    pdfTable.addCell(new Phrase(auxNodo.getPorcentajeAvance(), FontFactory
                            .getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(154, 151, 151))));
                    pdfTable.addCell(auxNodo.getObservaciones());

                }
            } else {
                if (auxNum[0] == null && num.length == 3) {
                    auxNum = (((NodoMultiClass) root.getChildren().get(Integer.parseInt(num[0]) - auxMargen)
                            .getData()).getNumero()).split("\\.");
                    while (!num[0].equals(auxNum[0]) && auxMargen > 0) {
                        NodoMultiClass auxNodoUnidad = ((NodoMultiClass) root.getChildren()
                                .get(Integer.parseInt(num[0]) - auxMargen).getData());
                        auxNumeroUnidad = auxNodoUnidad.getNumero().split("\\.");
                        tamanoArbol = root.getChildren().get(Integer.parseInt(num[0])).getChildCount();
                        if (Integer.parseInt(num[1]) > tamanoArbol) {
                            auxMargen2 = Integer.parseInt(num[1]) - tamanoArbol;
                        }
                        while (auxNumeroUnidad[0].equals(num[0]) && !num[1].equals(auxNum[1])
                                && auxMargen > 0) {
                            System.out.println("Iteracion  para encontrar padre XXXXXXX 0" + auxMargen);
                            auxNum = (((NodoMultiClass) root.getChildren()
                                    .get(Integer.parseInt(num[0]) - auxMargen).getChildren()
                                    .get(Integer.parseInt(num[1]) - auxMargen2).getData()).getNumero())
                                            .split("\\.");
                            //if(auxNum[0]!=null&&Integer.parseInt(num[0])>Integer.parseInt(auxNum[0])){
                            if (num[1].equals(auxNum[1])) {

                            } else {
                                auxMargen2--;
                            }
                        }
                        //                            auxNum = (((NodoMultiClass) root.getChildren().get(Integer.parseInt(num[1]) - auxMargen).getData()).getNumero()).split("\\.");
                        if (num[0].equals(auxNum[0])) {
                        } else {
                            auxMargen--;
                        }
                    }

                    System.out.println("***Unidad Padre(SUBTEMA)"
                            + ((NodoMultiClass) root.getChildren().get(Integer.parseInt(num[0]) - auxMargen)
                                    .getChildren().get(Integer.parseInt(num[1]) - auxMargen2).getData())
                                            .getNombre());
                    NodoMultiClass auxNodo = ((NodoMultiClass) root.getChildren()
                            .get(Integer.parseInt(num[0]) - auxMargen).getChildren()
                            .get(Integer.parseInt(num[1]) - auxMargen2).getData());
                    //UTIL PARA PONER TEXTO TACHADO
                    //                     Chunk strikethrough = new Chunk("Strikethrough.");
                    //                      strikethrough.setUnderline(0.1f, 3f); //0.1 thick, 2 y-location
                    //                     document.add(strikethrough);
                    pdfTable.addCell(
                            new Phrase("   " + auxNodo.getNumero() + ".- " + auxNodo.getNombre(), FontFactory
                                    .getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(154, 151, 151))));
                    pdfTable.addCell(new Phrase(auxNodo.getPorcentajeAvance(), FontFactory
                            .getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(154, 151, 151))));
                    pdfTable.addCell(auxNodo.getObservaciones());

                }
            }

            auxNum = num;
            //FIN AGREGAR PADRE DE TEMA/SUBTEMA 
            boolean banpor = true;
            if (num.length == 1) {
                pdfTable.addCell(new Phrase(filas[0] + ".- " + filas[1],
                        FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(0, 0, 0))));
                pdfTable.addCell(new Phrase(String.valueOf(dosDecimales(Float.parseFloat(filas[2]))),
                        FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, new Color(0, 0, 0))));
                banpor = false;
            }
            if (num.length == 2) {
                pdfTable.addCell(new Phrase("   " + filas[0] + ".- " + filas[1]));
            }
            if (num.length == 3) {
                pdfTable.addCell(new Phrase("       " + filas[0] + ".- " + filas[1],
                        FontFactory.getFont(FontFactory.TIMES_ITALIC, 12)));
                pdfTable.addCell(new Phrase(String.valueOf(dosDecimales(Float.parseFloat(filas[2]))),
                        FontFactory.getFont(FontFactory.TIMES_ITALIC, 12)));
                banpor = false;
            }
            if (banpor) {
                pdfTable.addCell(String.valueOf(dosDecimales(Float.parseFloat(filas[2]))));
                pdfTable.addCell(filas[3]);
            } else {
                pdfTable.addCell(filas[3]);
            }
        }

    } else {
        pdfTable.addCell("No hay nada seleccionado");
        pdfTable.addCell("");
        pdfTable.addCell("");
    }

    pdfTable.setHorizontalAlignment(15);
    float[] columnWidths2 = new float[] { 32f, 8f, 14f };
    pdfTable.setWidths(columnWidths2);
    pdf.add(pdfTable);
    //----------------------------------------------------------------------
}

From source file:net.bull.javamelody.internal.web.pdf.PdfCacheInformationsReport.java

License:Apache License

@Override
void toPdf() throws DocumentException {
    writeHeader();/*  w  ww .  j  a  v  a2s . c om*/

    for (final CacheInformations cacheInformations : cacheInformationsList) {
        nextRow();
        writeCacheInformations(cacheInformations);
    }
    addTableToDocument();
    if (!hitsRatioEnabled) {
        final Paragraph statisticsEnabledParagraph = new Paragraph(getString("caches_statistics_enable"),
                cellFont);
        statisticsEnabledParagraph.setAlignment(Element.ALIGN_RIGHT);
        addToDocument(statisticsEnabledParagraph);
    }
    addConfigurationReference();
}

From source file:net.bull.javamelody.internal.web.pdf.PdfCacheInformationsReport.java

License:Apache License

private void addConfigurationReference() throws DocumentException {
    final Anchor ehcacheAnchor = new Anchor("Configuration reference", PdfFonts.BLUE.getFont());
    ehcacheAnchor.setName("Ehcache configuration reference");
    ehcacheAnchor.setReference(//  w  w w.ja  v a2  s . co m
            "http://ehcache.sourceforge.net/apidocs/net/sf/ehcache/config/CacheConfiguration.html#field_summary");
    ehcacheAnchor.setFont(PdfFonts.BLUE.getFont());
    final Paragraph ehcacheParagraph = new Paragraph();
    ehcacheParagraph.add(ehcacheAnchor);
    ehcacheParagraph.setAlignment(Element.ALIGN_RIGHT);
    addToDocument(ehcacheParagraph);
}