Example usage for com.itextpdf.text Anchor Anchor

List of usage examples for com.itextpdf.text Anchor Anchor

Introduction

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

Prototype

public Anchor(final Phrase phrase) 

Source Link

Document

Constructs an Anchor with a certain Phrase.

Usage

From source file:app.App.java

private void setLink(int pageId, PdfStamper stamper) throws ClassNotFoundException, IOException {
    // load the sqlite-JDBC driver using the current class loader
    Class.forName("org.sqlite.JDBC");

    Connection connection = null;
    try {//from   www .  j  a va 2  s . c o m
        // create a database connection
        connection = DriverManager.getConnection("jdbc:sqlite:" + DATABASE);
        Statement statement = connection.createStatement();
        statement.setQueryTimeout(30); // set timeout to 30 sec.

        ResultSet rs = statement.executeQuery(
                "select * from page_annotations " + "where annotation_type = 'goto' and page_id = " + pageId);
        float spendX = 0;
        float spendY = 0;
        float coordX = 0;
        float coordY = 0;
        int pageDest = 0;
        Rectangle rect;
        PdfAnnotation annotation;
        while (rs.next()) {
            spendX = rs.getFloat("pdf_width");
            spendY = rs.getFloat("pdf_height");
            coordX = rs.getFloat("pdf_x");// + rs.getFloat("pdf_width");
            coordY = rs.getFloat("pdf_y");
            pageDest = rs.getInt("annotation_target");

            Font font = FontFactory.getFont(FontFactory.COURIER, 10, Font.UNDERLINE);
            // Blue
            font.setColor(0, 0, 255);
            Chunk chunk = new Chunk("GOTO", font);
            Anchor anchor = new Anchor(chunk);
            ColumnText.showTextAligned(stamper.getUnderContent(pageId), Element.ALIGN_LEFT, anchor,
                    coordX + spendX, coordY, 0);

            rect = new Rectangle(coordX, coordY, spendX, spendY);
            annotation = PdfAnnotation.createLink(stamper.getWriter(), rect, PdfAnnotation.HIGHLIGHT_INVERT,
                    new PdfAction("#" + pageDest));
            stamper.addAnnotation(annotation, pageId);
        }
    } catch (SQLException e) {
        // if the error message is "out of memory", 
        // it probably means no database file is found
        System.err.println(e.getMessage());
    } finally {
        try {
            if (connection != null)
                connection.close();
        } catch (SQLException e) {
            // connection close failed.
            System.err.println(e);
        }
    }
}

From source file:br.unifor.mia.xmpsemantico.xmp.MetadataXmp.java

License:GNU General Public License

/**
 * create PDF document//from   w  w w .  j av a 2  s .  com
 * @param filename of new archive PDF
 * @throws DocumentException 
 * @throws IOException 
 */
public void createPdf() throws IOException {

    Document document = new Document();
    PdfWriter writer = null;
    try {
        writer = PdfWriter.getInstance(document, new FileOutputStream(pathPdf));

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        XmpWriter xmp = new XmpWriter(os);

        MiaSchema miaSchema = new MiaSchema();
        miaSchema.addDescription(this.descricao);
        miaSchema.setProperty(MiaSchema.DISCIPLINA, this.disciplina);
        miaSchema.setProperty(MiaSchema.PROFESSOR, this.professor);
        miaSchema.setProperty(MiaSchema.CARGA_HORARIA, this.cargaHoraria);
        miaSchema.setProperty(MiaSchema.CREDITOS, this.creditos);
        xmp.addRdfDescription(miaSchema);

        xmp.close();
        writer.setXmpMetadata(os.toByteArray());

        document.open();
        document.addAuthor("docsemantico");
        Paragraph paragraph = new Paragraph("Quick brown ");
        Anchor foxRefence = new Anchor("fox");
        foxRefence.setReference("#fox");
        paragraph.add(foxRefence);
        paragraph.add(" jumps over the lazy dog.");
        document.add(paragraph);
        document.newPage();
        Anchor foxName = new Anchor("This is the FOX");
        foxName.setName("fox");
        document.add(foxName);
        document.add(new Paragraph(this.texto));

        document.close();
    } catch (DocumentException e) {
        e.printStackTrace();
    }

    //teste commit
}

From source file:com.example.pdfcreate.MainActivity.java

private static void addContent(Document document) throws DocumentException {
    Anchor anchor = new Anchor("ESTIMATING APP");
    anchor.setName("ESTIMATING APP");

    // Second parameter is the number of the chapter
    Chapter catPart = new Chapter(new Paragraph(anchor), 1);

    Paragraph subPara = new Paragraph("Subcategory 1");
    Section subCatPart = catPart.addSection(subPara);
    subCatPart.add(new Paragraph("Hello This Is PDF yeeee"));

    subPara = new Paragraph("Subcategory 2");
    subCatPart = catPart.addSection(subPara);

    subCatPart.add(new Paragraph(str1));
    subCatPart.add(new Paragraph(str2));
    subCatPart.add(new Paragraph("Paragraph 3"));

    // Add a list
    createList(subCatPart);/*from w w  w.  java2 s.  c  om*/
    Paragraph paragraph = new Paragraph();
    addEmptyLine(paragraph, 5);
    subCatPart.add(paragraph);

    // Add a table
    createTable(subCatPart);

    // Now add all this to the document
    document.add(catPart);

    // Next section
    anchor = new Anchor("Second Chapter");
    anchor.setName("Second Chapter");

    // Second parameter is the number of the chapter
    catPart = new Chapter(new Paragraph(anchor), 1);

    subPara = new Paragraph("Subcategory");
    subCatPart = catPart.addSection(subPara);
    subCatPart.add(new Paragraph("This is a very important message"));

    // Now add all this to the document
    document.add(catPart);

}

From source file:com.horizzon.inventerium.ExportPdf.java

private static void addContent(Document document) throws DocumentException {
    Anchor anchor = new Anchor("First Chapter");
    anchor.setName("First Chapter");

    // Second parameter is the number of the chapter
    Chapter catPart = new Chapter(new Paragraph(anchor), 1);

    Paragraph subPara = new Paragraph("Subcategory 1");
    Section subCatPart = catPart.addSection(subPara);
    subCatPart.add(new Paragraph("Hello"));

    subPara = new Paragraph("Subcategory 2");
    subCatPart = catPart.addSection(subPara);
    subCatPart.add(new Paragraph("Paragraph 1"));
    subCatPart.add(new Paragraph("Paragraph 2"));
    subCatPart.add(new Paragraph("Paragraph 3"));

    // add a list
    createList(subCatPart);/*from  ww  w . j  a va2s.c om*/
    Paragraph paragraph = new Paragraph();
    addEmptyLine(paragraph, 5);
    subCatPart.add(paragraph);

    // add a table
    createTable(subCatPart);

    // now add all this to the document
    document.add(catPart);

    // Next section
    //    anchor = new Anchor("Second Chapter", catFont);
    //    anchor.setName("Second Chapter");

    // Second parameter is the number of the chapter
    //    catPart = new Chapter(new Paragraph(anchor), 1);

    //    subPara = new Paragraph("Subcategory", subFont);
    //    subCatPart = catPart.addSection(subPara);
    //    subCatPart.add(new Paragraph("This is a very important message"));

    // now add all this to the document
    //   document.add(catPart);

}

From source file:com.vectorprint.report.itext.DefaultElementProducer.java

License:Open Source License

/**
 * Create a Anchor, style it and add the data
 *
 * @param data//from w w w.j a  v  a 2  s  . c o  m
 * @param stylers
 * @return
 * @throws VectorPrintException
 */
public Anchor createAnchor(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
    return initTextElementArray(styleHelper.style(new Anchor(Float.NaN), data, stylers), data, stylers);
}

From source file:digilib.pdf.PDFTitlePage.java

License:Open Source License

/**
 * generate iText-PDF-Contents for the title page
 * // w  w  w. jav  a2s . c  o  m
 * @return
 */
public Element getPageContents() {
    Paragraph content = new Paragraph();
    content.setAlignment(Element.ALIGN_CENTER);

    // add vertical whitespace
    for (int i = 0; i < 8; i++) {
        content.add(Chunk.NEWLINE);
    }

    // add logo
    content.add(getLogo());
    content.add(Chunk.NEWLINE);
    content.add(Chunk.NEWLINE);

    // add title
    Anchor title = new Anchor(new Paragraph(getTitle(), FontFactory.getFont(FontFactory.HELVETICA, 16)));
    String burl = job_info.getImageJobInformation().getAsString("base.url");

    title.setReference(burl + "digilib.jsp?fn=" + job_info.getImageJobInformation().getAsString("fn"));
    content.add(title);
    content.add(Chunk.NEWLINE);

    // add author
    if (getDate() != " ")
        content.add(new Paragraph(getAuthor() + " (" + getDate() + ")",
                FontFactory.getFont(FontFactory.HELVETICA, 14)));
    else
        content.add(new Paragraph(getAuthor(), FontFactory.getFont(FontFactory.HELVETICA, 14)));

    content.add(Chunk.NEWLINE);

    // add page numbers
    content.add(new Paragraph(getPages(), FontFactory.getFont(FontFactory.HELVETICA, 12)));

    content.add(Chunk.NEWLINE);
    content.add(Chunk.NEWLINE);
    content.add(Chunk.NEWLINE);

    // add digilib version
    content.add(new Paragraph(getDigilibVersion(), FontFactory.getFont(FontFactory.HELVETICA, 10)));

    for (int i = 0; i < 8; i++) {
        content.add(Chunk.NEWLINE);
    }
    Anchor address = new Anchor(
            new Paragraph(burl + "digilib.jsp?fn=" + job_info.getImageJobInformation().getAsString("fn"),
                    FontFactory.getFont(FontFactory.COURIER, 9)));
    address.setReference(burl + "digilib.jsp?fn=" + job_info.getImageJobInformation().getAsString("fn"));

    content.add(address);

    return content;
}

From source file:eu.geopaparazzi.plugins.pdfexport.PdfExportDialogFragment.java

License:Open Source License

public void processNote(Document document, Note note, int count) throws Exception {
    String name = Utilities.makeXmlSafe(note.getName());
    String form = note.getForm();

    DaoImages daoImages = new DaoImages();
    if (form != null && form.length() > 0) {
        JSONObject sectionObject = new JSONObject(form);
        if (!sectionObject.has(FormUtilities.ATTR_SECTIONNAME)) {
            return;
        }//w  ww .  j  a v  a 2s  . c  o m
        String sectionName = sectionObject.getString(FormUtilities.ATTR_SECTIONNAME);
        Anchor anchor = new Anchor(sectionName);
        anchor.setName(sectionName);
        Chapter currentChapter = new Chapter(new Paragraph(anchor), count);
        addEmptyLine(currentChapter, 3);

        PdfPTable infoTable = new PdfPTable(2);
        infoTable.setHeaderRows(0);
        infoTable.setWidthPercentage(90);
        currentChapter.add(infoTable);

        addKeyValueToTableRow(infoTable, "Timestamp", new Date(note.getTimeStamp()).toString());
        addKeyValueToTableRow(infoTable, "Latitude", note.getLat() + "");
        addKeyValueToTableRow(infoTable, "Longitude", note.getLon() + "");

        addEmptyLine(currentChapter, 3);

        List<String> formsNames = TagsManager.getFormNames4Section(sectionObject);
        for (String formName : formsNames) {
            Paragraph section = new Paragraph(formName);
            currentChapter.addSection(section);
            addEmptyLine(currentChapter, 3);

            PdfPTable currentTable = new PdfPTable(2);
            currentTable.setHeaderRows(1);
            currentTable.setWidthPercentage(90);
            currentChapter.add(currentTable);

            JSONObject form4Name = TagsManager.getForm4Name(formName, sectionObject);
            JSONArray formItems = TagsManager.getFormItems(form4Name);
            for (int i = 0; i < formItems.length(); i++) {
                JSONObject formItem = formItems.getJSONObject(i);
                if (!formItem.has(FormUtilities.TAG_KEY)) {
                    continue;
                }

                String type = formItem.getString(FormUtilities.TAG_TYPE);
                String key = formItem.getString(FormUtilities.TAG_KEY);
                String value = formItem.getString(FormUtilities.TAG_VALUE);

                String label = key;
                if (formItem.has(FormUtilities.TAG_LABEL)) {
                    label = formItem.getString(FormUtilities.TAG_LABEL);
                }

                if (type.equals(FormUtilities.TYPE_PICTURES)) {
                    if (value.trim().length() == 0) {
                        continue;
                    }
                    String[] imageIdsSplit = value.split(Note.IMAGES_SEPARATOR);
                    for (String imageId : imageIdsSplit) {
                        Image image = daoImages.getImage(Long.parseLong(imageId));
                        String imgName = image.getName();
                        byte[] imageData = daoImages.getImageData(Long.parseLong(imageId));
                        com.itextpdf.text.Image itextImage = com.itextpdf.text.Image.getInstance(imageData);
                        Paragraph caption = new Paragraph(imgName);
                        caption.setAlignment(Element.ALIGN_CENTER);

                        PdfPCell keyCell = new PdfPCell(new Phrase(label));
                        keyCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        keyCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        keyCell.setPadding(10);
                        currentTable.addCell(keyCell);
                        PdfPCell valueCell = new PdfPCell();
                        valueCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        valueCell.setPadding(10);
                        valueCell.addElement(itextImage);
                        valueCell.addElement(caption);
                        currentTable.addCell(valueCell);
                    }
                } else if (type.equals(FormUtilities.TYPE_MAP)) {
                    if (value.trim().length() == 0) {
                        continue;
                    }
                    String imageId = value.trim();
                    Image image = daoImages.getImage(Long.parseLong(imageId));
                    String imgName = image.getName();
                    byte[] imageData = daoImages.getImageData(Long.parseLong(imageId));
                    com.itextpdf.text.Image itextImage = com.itextpdf.text.Image.getInstance(imageData);
                    Paragraph caption = new Paragraph(imgName);
                    caption.setAlignment(Element.ALIGN_CENTER);

                    PdfPCell keyCell = new PdfPCell(new Phrase(label));
                    keyCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    keyCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                    keyCell.setPadding(10);
                    currentTable.addCell(keyCell);
                    PdfPCell valueCell = new PdfPCell();
                    valueCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                    valueCell.setPadding(10);
                    valueCell.addElement(itextImage);
                    valueCell.addElement(caption);
                    currentTable.addCell(valueCell);
                } else if (type.equals(FormUtilities.TYPE_SKETCH)) {
                    if (value.trim().length() == 0) {
                        continue;
                    }
                    String[] imageIdsSplit = value.split(Note.IMAGES_SEPARATOR);
                    for (String imageId : imageIdsSplit) {
                        Image image = daoImages.getImage(Long.parseLong(imageId));
                        String imgName = image.getName();
                        byte[] imageData = daoImages.getImageData(Long.parseLong(imageId));
                        com.itextpdf.text.Image itextImage = com.itextpdf.text.Image.getInstance(imageData);
                        Paragraph caption = new Paragraph(imgName);
                        caption.setAlignment(Element.ALIGN_CENTER);

                        PdfPCell keyCell = new PdfPCell(new Phrase(label));
                        keyCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        keyCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        keyCell.setPadding(10);
                        currentTable.addCell(keyCell);
                        PdfPCell valueCell = new PdfPCell();
                        valueCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        valueCell.setPadding(10);
                        valueCell.addElement(itextImage);
                        valueCell.addElement(caption);
                        currentTable.addCell(valueCell);
                    }
                } else {
                    addKeyValueToTableRow(currentTable, label, value);
                }
            }
        }

        document.add(currentChapter);
        document.newPage();

    }

}

From source file:lk.score.androphsy.report.ReportPdf.java

License:Open Source License

private void addDevicePage(Document document) {
    Anchor anchor = new Anchor("Device Information");
    anchor.setName("Device Information");
    Chapter chap = new Chapter(new Paragraph(anchor), 1);

    Paragraph subpara = new Paragraph("Device Information", HeadingFont);
    subpara.setAlignment(Paragraph.ALIGN_CENTER);
    addEmptyLine(subpara, 1);//from  w w  w.  jav a2s.  co  m
    createTableRowFormat(subpara, "DeviceBasicInfo");

    try {
        document.add(subpara);
    } catch (DocumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:org.smap.sdal.managers.PDFSurveyManager.java

License:Open Source License

private void updateValueCell(Parser parser, String remoteUser, PdfPCell valueCell, DisplayItem di,
        boolean generateBlank, String basePath, String serverRoot, GlobalVariables gv, int oId)
        throws Exception {

    // Questions that append their values to this question
    ArrayList<String> deps = gv.addToList.get(di.fIdx + "_" + di.rec_number + "_" + di.name);

    if (di.type.startsWith("select")) {
        processSelect(parser, remoteUser, valueCell, di, generateBlank, gv, oId);
    } else if (di.type.equals("image")) {
        if (di.value != null && !di.value.trim().equals("") && !di.value.trim().equals("Unknown")) {
            if (di.isHyperlink) {
                Anchor anchor = new Anchor(serverRoot + di.value);
                anchor.setReference(serverRoot + di.value);

                valueCell.addElement(getPara("", di, gv, deps, anchor));
            } else {
                try {
                    Image img = Image.getInstance(basePath + "/" + di.value);
                    valueCell.addElement(img);
                } catch (Exception e) {
                    log.info("Error: image " + basePath + "/" + di.value + " not added: " + e.getMessage());
                    log.log(Level.SEVERE, "Adding image to pdf", e);
                }/* w w w.  j av  a  2 s  .  c  om*/
            }

        } else {
            // TODO add empty image
        }

    } else if (di.type.equals("video") || di.type.equals("audio")) {
        if (di.value != null && !di.value.trim().equals("") && !di.value.trim().equals("Unknown")) {
            Anchor anchor = new Anchor(serverRoot + di.value);
            anchor.setReference(serverRoot + di.value);

            valueCell.addElement(getPara("", di, gv, deps, anchor));

        } else {
            // TODO add empty image
        }

    } else if (di.type.equals("geopoint") || di.type.equals("geoshape") || di.type.equals("geotrace")
            || di.type.startsWith("geopolygon_") || di.type.startsWith("geolinestring_")) {

        Image img = PdfUtilities.getMapImage(sd, di.map, di.value, di.location, di.zoom, gv.mapbox_key,
                survey.id, user, di.markerColor);

        if (img != null) {
            valueCell.addElement(img);
        } else {
            valueCell.addElement(getPara(" ", di, gv, deps, null));
        }

    } else if (di.isBarcode) {
        BarcodeQRCode qrcode = new BarcodeQRCode(di.value.trim(), 1, 1, null);
        Image qrcodeImage = qrcode.getImage();
        qrcodeImage.setAbsolutePosition(10, 500);
        qrcodeImage.scalePercent(200);

        valueCell.addElement((qrcodeImage));

    } else {
        // Todo process other question types
        String value = null;

        if (di.value == null || di.value.trim().length() == 0) {
            value = " "; // Need a space to show a blank row
        } else {
            if (di.value != null && di.value.length() > 0) {
                if (GeneralUtilityMethods.isRtlLanguage(di.value)) {
                    valueCell.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
                }
            }

            if (di.type.equals("dateTime") || di.type.equals("timestamp")) { // Set date time to local time

                DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                df.setTimeZone(TimeZone.getTimeZone("UTC"));
                Date date = df.parse(di.value);
                df.setTimeZone(TimeZone.getTimeZone(tz));
                value = df.format(date);
                log.info("Convert date to local time: " + di.name + " : " + di.value + " : " + " : " + value
                        + " : " + di.type + " : " + tz);
            } else {
                value = di.value;
            }

        }
        valueCell.addElement(getPara(value, di, gv, deps, null));
    }
}

From source file:PDF.CrearPDF_Ficha.java

public void generarPDF(ServletOutputStream sops, DatosPDF datos, String url) {

    try {/*from   w  w  w  .j a  v  a 2s .  co  m*/

        Document documento = new Document();
        //            ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PdfWriter writer = PdfWriter.getInstance(documento, sops);
        documento.open();

        Image itt_logo;
        try {
            itt_logo = Image.getInstance(url);
            Image Logo_itt = Image.getInstance(itt_logo);
            Logo_itt.setAbsolutePosition(50f, 698f);
            Logo_itt.scaleAbsolute(90, 100);
            documento.add(Logo_itt);
        } catch (BadElementException | IOException ex) {
            Logger.getLogger(CrearPDF_Ficha.class.getName()).log(Level.SEVERE, null, ex);
        }

        PdfContentByte rectangulo_info = writer.getDirectContentUnder();
        drawRectangle(rectangulo_info, 430, 648, 90, 100);
        Paragraph leyendaFoto = new Paragraph("\nFOTO:\n", FontFactory.getFont("arial", 14, Font.BOLD));
        leyendaFoto.setIndentationLeft(200f);
        Paragraph titulo = new Paragraph("INSTITUTO TECNOLGICO DE TOLUCA", FontFactory.getFont("arial", 14));
        titulo.setAlignment(Element.ALIGN_CENTER);

        Paragraph asunto = new Paragraph("FICHA DE EXAMEN", FontFactory.getFont("arial", 12));
        asunto.setAlignment(Element.ALIGN_CENTER);

        Chunk folio1 = new Chunk("FICHA PARA EL EXAMEN DE ADMISIN: ", FontFactory.getFont("arial", 10));
        Chunk folio2 = new Chunk(datos.getFicha(), FontFactory.getFont("arial", 10, Font.BOLD));

        Phrase fol = new Phrase();
        fol.add(folio1);
        fol.add(folio2);

        Paragraph noFicha = new Paragraph(fol);
        noFicha.setAlignment(Element.ALIGN_LEFT);

        Chunk nombre1 = new Chunk("NOMBRE DEL SOLICITANTE: ", FontFactory.getFont("arial", 10));
        Chunk nombre2 = new Chunk(datos.getNombre(), FontFactory.getFont("arial", 10, Font.BOLD));

        Phrase nom = new Phrase();
        nom.add(nombre1);
        nom.add(nombre2);

        Paragraph nombre = new Paragraph(nom);
        nombre.setAlignment(Element.ALIGN_LEFT);

        Chunk in1 = new Chunk("PROCESO PARA EL REGISTRO DE ASPIRANTES EN EL PERIODO: ",
                FontFactory.getFont("arial", 10));
        Chunk in2 = new Chunk(datos.getPeriodoConcursa().toUpperCase(),
                FontFactory.getFont("arial", 10, Font.BOLD));

        Phrase in = new Phrase();
        in.add(in1);
        in.add(in2);

        Paragraph instrucciones = new Paragraph(in);
        instrucciones.setAlignment(Element.ALIGN_LEFT);

        Chunk folCen1 = new Chunk("1.- NMERO DE FOLIO CENEVAL: ", FontFactory.getFont("arial", 10));
        Chunk folCen2 = new Chunk(datos.getFolioCENEVAL(), FontFactory.getFont("arial", 10, Font.BOLD));

        Phrase folC = new Phrase();
        folC.add(folCen1);
        folC.add(folCen2);

        Paragraph folioCENEVAL = new Paragraph(folC);
        folioCENEVAL.setAlignment(Element.ALIGN_LEFT);

        Chunk fechas1 = new Chunk("2.- LOS EX?MENES DE ADMISIN SE APLICAR?N LOS D?AS: ",
                FontFactory.getFont("arial", 10));
        Chunk fechas2 = new Chunk(datos.getFechaExamenCeneval() + " (" + datos.getLugarExamenCeneval() + ")",
                FontFactory.getFont("arial", 10, Font.BOLD));
        Chunk fechas3 = new Chunk(" Y ", FontFactory.getFont("arial", 10));
        Chunk fechas4 = new Chunk(datos.getFechaExamenMate() + " (" + datos.getLugarExamenMate() + ")",
                FontFactory.getFont("arial", 10, Font.BOLD));

        Phrase fechas = new Phrase();
        fechas.add(fechas1);
        fechas.add(fechas2);
        fechas.add(fechas3);
        fechas.add(fechas4);

        Paragraph fechaExamenes = new Paragraph(fechas);
        fechaExamenes.setAlignment(Element.ALIGN_LEFT);

        Phrase lugar = new Phrase();

        Paragraph lugarYhora = new Paragraph(lugar);
        lugarYhora.setAlignment(Element.ALIGN_LEFT);

        Chunk paginaPub1 = new Chunk(
                "3.- LA PUBLICACIN DE LOS RESULTADOS SER? NICAMENTE EN LA P?GINA WEB: ",
                FontFactory.getFont("arial", 10));

        Anchor url_itt = new Anchor(datos.getPagResultados());
        url_itt.setReference(datos.getPagResultados());

        Phrase pag = new Phrase();
        pag.add(paginaPub1);
        pag.add(url_itt);

        Paragraph pagWeb = new Paragraph(pag);

        Chunk diaPub1 = new Chunk("EL D?A: ", FontFactory.getFont("arial", 10));
        Chunk diaPub2 = new Chunk(convertir(datos.getDiaPublicacion() + "-"),
                FontFactory.getFont("arial", 10, Font.BOLD));

        Phrase dia = new Phrase();
        dia.add(diaPub1);
        dia.add(diaPub2);

        Paragraph diaResultados = new Paragraph(dia);
        diaResultados.setAlignment(Element.ALIGN_LEFT);

        Chunk notas = new Chunk("\nNOTAS:\n", FontFactory.getFont("arial", 14, Font.BOLD));

        Chunk uno = new Chunk("1.- ", FontFactory.getFont("arial", 10, Font.BOLD));

        Chunk guias = new Chunk("Guas de estudio:\n   - (CENEVAL) \n", FontFactory.getFont("arial", 10));

        Anchor url_guia_cen = new Anchor("     " + datos.getEstudioCeneval());
        // url_guia_cen.setReference(datos.getEstudioCeneval());

        Chunk ceneval_inter = new Chunk("\n   - (CENEVAL INTERACTIVA) \n", FontFactory.getFont("arial", 10));

        Anchor url_guia_cen_inter = new Anchor("     " + datos.getEstudioCenevalInt());
        url_guia_cen_inter.setReference(datos.getEstudioCenevalInt());

        Chunk tem_mate_itt = new Chunk("\n   - Temario de Matemticas (TECNOLGICO DE TOLUCA)\n\n",
                FontFactory.getFont("arial", 10));
        Chunk dos = new Chunk("2.- ", FontFactory.getFont("arial", 10, Font.BOLD));
        Chunk veri = new Chunk("Verifique que el nmero de folio de Ceneval de esta ficha, coincida con el",
                FontFactory.getFont("arial", 10));
        Chunk fol_ceneval = new Chunk(" FOLIO CENEVAL ", FontFactory.getFont("arial", 10, Font.BOLD));
        Chunk capturado = new Chunk("capturado en la informacin proporcionada por el Tecnlogico.\n\n",
                FontFactory.getFont("arial", 10));
        Chunk tres = new Chunk("3.- ", FontFactory.getFont("arial", 10, Font.BOLD));
        Chunk dia_exam = new Chunk(
                "El da del examen deber presentarse con el presente documento, pase de ingreso al examen(Ceneval), una identificacin con fotografa reciente(credencial escolar, IMSS, ISSSTE, ISSEMYM, licencia, pasaporte), lpiz del nmero 2 y goma.\n\n",
                FontFactory.getFont("arial", 10));
        Chunk cuatro = new Chunk("4.- ", FontFactory.getFont("arial", 10, Font.BOLD));
        Chunk curso = new Chunk(
                "Si curs sus estudios de secundaria o bachillerato en el extranjero deber presentar revalidacin de estudios correspondientes al momento de la inscripcin.\n",
                FontFactory.getFont("arial", 10));
        Chunk cinco = new Chunk("\n5.- ", FontFactory.getFont("arial", 10, Font.BOLD));
        Chunk examenes = new Chunk(
                "Los exmenes que se evaluarn son:       1) ADMISIN Y DIAGNSTICO.     2) MATEM?TICAS.",
                FontFactory.getFont("arial", 10));

        Phrase ulti = new Phrase();
        ulti.add(notas);
        ulti.add(uno);
        ulti.add(guias);
        ulti.add(url_guia_cen);
        ulti.add(ceneval_inter);
        ulti.add(url_guia_cen_inter);
        ulti.add(tem_mate_itt);
        ulti.add(dos);
        ulti.add(veri);
        ulti.add(fol_ceneval);
        ulti.add(capturado);
        ulti.add(tres);
        ulti.add(dia_exam);
        ulti.add(cuatro);
        ulti.add(curso);
        ulti.add(cinco);
        ulti.add(examenes);

        Paragraph ultimo = new Paragraph(ulti);
        ultimo.setAlignment(Element.ALIGN_LEFT);

        documento.addTitle("Ficha de Examen");
        documento.addSubject("Instituto Tecnolgico de Toluca");
        documento.addKeywords("Instituto Tecnolgico de Toluca");
        documento.addAuthor("Departamento de Servicios escolares");
        documento.addCreator("Departamento de Servicios escolares");
        documento.add(titulo);
        documento.add(asunto);
        documento.add(new Paragraph(" "));
        documento.add(new Paragraph(" "));
        documento.add(new Paragraph(" "));
        documento.add(new Paragraph(" "));
        documento.add(new Paragraph(" "));

        documento.add(noFicha);
        documento.add(nombre);
        documento.add(new Paragraph(" "));
        documento.add(instrucciones);
        documento.add(new Paragraph(" "));
        documento.add(folioCENEVAL);
        documento.add(fechaExamenes);
        documento.add(lugarYhora);
        documento.add(pagWeb);
        documento.add(diaResultados);
        documento.add(new Paragraph(" "));
        documento.add(ultimo);

        documento.close();
    } catch (DocumentException ex) {
        Logger.getLogger(CrearPDF_Ficha.class.getName()).log(Level.SEVERE, null, ex);
    }

}