Example usage for com.itextpdf.text Phrase Phrase

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

Introduction

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

Prototype

private Phrase(final boolean dummy) 

Source Link

Document

Constructs a Phrase that can be used in the static getInstance() method.

Usage

From source file:com.masscustsoft.service.ToPdf.java

License:Open Source License

/**
 * Adds a link to the current paragraph.
 * @since 5.0.6/*from w ww . jav  a 2s  . c  o m*/
 */
public void processLink() {
    if (currentParagraph == null) {
        currentParagraph = new Paragraph();
    }
    // The link provider allows you to do additional processing
    LinkProcessor i = (LinkProcessor) providers.get(HTMLWorker.LINK_PROVIDER);
    if (i == null || !i.process(currentParagraph, chain)) {
        // sets an Anchor for all the Chunks in the current paragraph
        String href = chain.getProperty(HtmlTags.HREF);
        if (href != null) {
            for (Chunk ck : currentParagraph.getChunks()) {
                ck.setAnchor(href);
            }
        }
    }
    // a link should be added to the current paragraph as a phrase
    if (stack.isEmpty()) {
        // no paragraph to add too, 'a' tag is first element
        Paragraph tmp = new Paragraph(new Phrase(currentParagraph));
        currentParagraph = tmp;
    } else {
        Paragraph tmp = (Paragraph) stack.pop();
        tmp.add(new Phrase(currentParagraph));
        currentParagraph = tmp;
    }
}

From source file:com.mobicage.rogerthat.enterprise.samples.hr.bizz.GenerateExpenseNote.java

License:Open Source License

public int handle(final User user, final User manager, final ExpenseNote en)
        throws MalformedURLException, IOException, DocumentException {

    log.info("Building list of expenses ...");
    List<Expense> expenses = Expense.list(en);
    log.info("Retrieved " + expenses.size() + " expenses from the datastore");

    log.info("Creating ExpenseNoteDocOutputStream");
    ExpenseNoteDocOutputStream stream = new ExpenseNoteDocOutputStream(en);

    Document document = new Document();
    PdfWriter.getInstance(document, stream);
    document.open();/*  w w  w .  ja v  a2  s . c  om*/

    document.addTitle("Expense note " + en.id + " of " + user.name);
    document.addSubject("Expense note generated by Rogerthat Enterprise!");
    document.addKeywords("expense note");
    document.addAuthor(user.name);
    document.addCreator("Rogerthat OneApp Enterprise Mobility");

    Paragraph preface = new Paragraph();

    preface.add(new Paragraph("TP Vision expense note", titleFont));
    preface.add(new Paragraph(" "));

    DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
    Date date = new Date();
    preface.add(new Paragraph("Date: " + dateFormat.format(date)));
    preface.add(new Paragraph("Requestor: " + user.name));
    preface.add(new Paragraph("Approver: " + manager.name));
    preface.add(new Paragraph(" "));

    PdfPTable table = new PdfPTable(7);
    table.setWidthPercentage(110);
    table.setWidths(new int[] { 5, 15, 15, 35, 10, 15, 10 });
    addHeader(table, "Id");
    addHeader(table, "Date");
    addHeader(table, "Nature");
    addHeader(table, "Description");
    addHeader(table, "Account");
    addHeader(table, "Amount");
    addHeader(table, "Voucher");
    table.setHeaderRows(1);

    Collections.sort(expenses, new Comparator<Expense>() {
        @Override
        public int compare(Expense e1, Expense e2) {
            return (int) (e1.date - e2.date);
        }
    });
    int i = 0;
    double total = 0;
    for (Expense expense : expenses) {
        PdfPCell c1 = new PdfPCell(new Phrase("" + ++i));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(c1);
        table.addCell(dateFormat.format(new Date(expense.date * 1000)));
        table.addCell(expense.nature);
        table.addCell(expense.description);
        table.addCell("" + expense.account);
        c1 = new PdfPCell(new Phrase(DECIMAL_FORMAT.format(expense.amount) + " " + expense.currency));
        c1.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(c1);
        table.addCell(expense.voucher);
        total += expense.amount;
    }

    preface.add(table);

    preface.add(new Paragraph(" "));
    preface.add(new Paragraph("Total: " + DECIMAL_FORMAT.format(total), titleFont));

    document.add(preface);

    i = 0;
    for (Expense expense : expenses) {
        i++;
        if (expense.receipt == null)
            continue;

        document.newPage();
        Paragraph receipt = new Paragraph();
        receipt.add(new Paragraph("Attachment " + i, titleFont));
        document.add(receipt);
        Image image = Image.getInstance(new URL(expense.receipt));
        image.setRotationDegrees(-90);
        float scaler = (document.getPageSize().getWidth() / image.getWidth()) * 100;

        image.scalePercent(scaler);
        document.add(image);
    }

    document.close();
    stream.close();

    return stream.getSize();

}

From source file:com.mobicage.rogerthat.enterprise.samples.hr.bizz.GenerateExpenseNote.java

License:Open Source License

private void addHeader(PdfPTable table, String title) {
    PdfPCell c1 = new PdfPCell(new Phrase(title));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);/*ww w.  j  av a 2  s . c  o m*/
}

From source file:com.mycompany.mavenproject2.VirtualkeyController.java

private static void createTable(/*Section subCatPart*/String tableName, Paragraph preface)
        throws BadElementException {
    try {//from  w  ww  .  j ava2  s.c  o m
        ArrayList<String> list = new ArrayList<String>();

        // t.setBorderColor(BaseColor.GRAY);
        // t.setPadding(4);
        // t.setSpacing(4);
        // t.setBorderWidth(1);
        int length = 0;
        java.sql.Connection conn = Connection.getConnect();
        Statement st = conn.createStatement();
        st = conn.createStatement();
        ResultSet rs = st.executeQuery("SELECT * FROM " + tableName);

        ResultSetMetaData rsMetaData = rs.getMetaData();

        int numberOfColumns = rsMetaData.getColumnCount();
        System.out.println("resultSet MetaData column Count=" + numberOfColumns);
        for (int i = 1; i <= numberOfColumns; i++) {
            length = i;
        }
        MongoClient client = new MongoClient();
        MongoDatabase db = client.getDatabase("FinalDemo");

        PdfPTable table = new PdfPTable(length);

        for (int i = 1; i <= numberOfColumns; i++) {
            // System.out.println("column MetaData ");
            //System.out.println("column number " + i);
            // get the column's name.
            System.out.println(rsMetaData.getColumnName(i));
            PdfPCell c1 = new PdfPCell(new Phrase(rsMetaData.getColumnName(i)));
            c1.setHorizontalAlignment(Element.ALIGN_CENTER);
            list.add(rsMetaData.getColumnName(i));
            table.addCell(c1);
        }
        while (rs.next()) {
            for (String col : list) {
                //System.out.println("Column name is "+col+"value is "+rs.getString(col));
                table.addCell(rs.getString(col));
            }
        }
        /*PdfPCell c1 = new PdfPCell(new Phrase("Table Header 1"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(c1);
                
        c1 = new PdfPCell(new Phrase("Table Header 2"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(c1);
                
        c1 = new PdfPCell(new Phrase("Table Header 3"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(c1);*/
        table.setHeaderRows(1);

        preface.add(table);
        //subCatPart.add(table);
    } catch (ClassNotFoundException ex) {
        Logger.getLogger(VirtualkeyController.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SQLException ex) {
        Logger.getLogger(VirtualkeyController.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.nerdcastle.nazmul.filetest.MainActivity.java

private static void createTable(Section subCatPart) throws BadElementException {
    ArrayList<String> a = new ArrayList<>();
    a.add("1");/*from w ww  .  j  a va  2  s  . com*/
    a.add("2");
    a.add("3");
    ArrayList<String> b = new ArrayList<>();
    b.add("4");
    b.add("5");
    b.add("6");
    ArrayList<String> c = new ArrayList<>();
    c.add("7");
    c.add("8");
    c.add("9");
    PdfPTable table = new PdfPTable(3);

    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);

    PdfPCell c1 = new PdfPCell(new Phrase("Table Header 1"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Table Header 2"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Table Header 3"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);
    table.setHeaderRows(1);
    for (int i = 0; i < a.size(); i++) {
        table.addCell(a.get(i));
        table.addCell(b.get(i));
        table.addCell(c.get(i));
    }

    /* table.addCell("1.0");
     table.addCell("1.1");
     table.addCell("1.2");
     table.addCell("2.1");
     table.addCell("2.2");
     table.addCell("2.3");*/

    subCatPart.add(table);

}

From source file:com.northcoders.controller.BookingReportsController.java

@FXML
private void generatePdf() throws Exception {
    BaseFont bf;//from w  w  w  .  j a  v  a2  s . c o m
    Font font;
    try {
        conditions = "Filtered by: Start Date:2017-03-15 End Date:2017-03-28";

        /* Step-2: Initialize PDF documents - logical objects */
        Document my_pdf_report = new Document(PageSize.LETTER.rotate());
        PdfWriter.getInstance(my_pdf_report, new FileOutputStream("pdf_booking_report.pdf"));
        my_pdf_report.open();
        //we have four columns in our table
        PdfPTable my_report_table = new PdfPTable(6);
        //create a cell object
        PdfPCell table_cell;

        bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED);
        font = new Font(bf, 16);
        my_pdf_report.add(new Paragraph("Administration Report", font));
        font = new Font(bf, 12);
        my_pdf_report.add(new Paragraph("Filter applied:" + conditions, font));
        my_pdf_report.add(new Paragraph(" "));

        table_cell = new PdfPCell(new Phrase("Customer"));
        my_report_table.addCell(table_cell);
        table_cell = new PdfPCell(new Phrase("Start Date"));
        my_report_table.addCell(table_cell);
        table_cell = new PdfPCell(new Phrase("End Date"));
        my_report_table.addCell(table_cell);
        table_cell = new PdfPCell(new Phrase("Room"));
        my_report_table.addCell(table_cell);
        table_cell = new PdfPCell(new Phrase("Amount"));
        my_report_table.addCell(table_cell);
        table_cell = new PdfPCell(new Phrase("Transactions"));
        my_report_table.addCell(table_cell);

        for (Booking item : bookings) {
            String customer_b = item.getCustomerId().getId() + " " + item.getCustomerId().getFirstName() + " "
                    + item.getCustomerId().getLastName();
            table_cell = new PdfPCell(new Phrase(customer_b));
            my_report_table.addCell(table_cell);

            String date_start_b = dateToStr(item.getStartDate());
            table_cell = new PdfPCell(new Phrase(date_start_b));
            my_report_table.addCell(table_cell);

            String date_end_b = dateToStr(item.getEndDate());
            table_cell = new PdfPCell(new Phrase(date_end_b));
            my_report_table.addCell(table_cell);

            String room_b = String.valueOf(item.getRoomId().getRoomNumber());
            table_cell = new PdfPCell(new Phrase(room_b));
            my_report_table.addCell(table_cell);

            String price_b = String.format("%1$,.2f", item.getTotalPrice());
            table_cell = new PdfPCell(new Phrase(price_b));
            my_report_table.addCell(table_cell);

            String transaction_b = "";
            for (PaymentTransaction trans : item.getPaymentTransactionList()) {
                transaction_b += String.format("%1$,.2f", trans.getAmount()) + " "
                        + trans.getPaymentTypeId().getDescription() + "\n";
            }
            table_cell = new PdfPCell(new Phrase(transaction_b));
            my_report_table.addCell(table_cell);
        }

        /* Attach report table to PDF */
        my_pdf_report.add(my_report_table);
        my_pdf_report.add(new Paragraph(" "));
        font = new Font(bf, 6);
        my_pdf_report.add(new Paragraph("Report Time:" + dateTimeToStr(new Date())));
        my_pdf_report.close();

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

}

From source file:com.pdf.GetPdf.java

public static void addXls(Document document, String url, String type) throws IOException, DocumentException {
    Iterator<Row> rowIterator;
    int colNo;//  ww w . jav  a  2s  .co m
    if (type.equals("xls")) {
        HSSFWorkbook excelWorkbook = new HSSFWorkbook(new URL(url).openStream());
        HSSFSheet my_worksheet = excelWorkbook.getSheetAt(0);
        rowIterator = my_worksheet.iterator();
        colNo = my_worksheet.getRow(0).getLastCellNum();
    } else {
        XSSFWorkbook excelWorkbook1 = new XSSFWorkbook(new URL(url).openStream());
        XSSFSheet my_worksheet = excelWorkbook1.getSheetAt(0);
        rowIterator = my_worksheet.iterator();
        colNo = my_worksheet.getRow(0).getLastCellNum();
    }
    PdfPTable my_table = new PdfPTable(colNo);
    PdfPCell table_cell = null;
    while (rowIterator.hasNext()) {
        Row row = rowIterator.next(); //Read Rows from Excel document       
        Iterator<Cell> cellIterator = row.cellIterator();//Read every column for every row that is READ
        while (cellIterator.hasNext()) {
            Cell cell = cellIterator.next(); //Fetch CELL
            if (cell.getCellType() == (Cell.CELL_TYPE_NUMERIC)) {
                table_cell = new PdfPCell(new Phrase(new Double(cell.getNumericCellValue()).toString()));
                System.out.println(cell.getNumericCellValue());
                my_table.addCell(table_cell);
            } else if (cell.getCellType() == (Cell.CELL_TYPE_STRING)) {
                table_cell = new PdfPCell(new Phrase(cell.getStringCellValue()));
                System.out.println(cell.getStringCellValue());
                my_table.addCell(table_cell);
            } else if (cell.getCellType() == (Cell.CELL_TYPE_FORMULA)) {
                table_cell = new PdfPCell(new Phrase(cell.getCellFormula()));
                my_table.addCell(table_cell);
            } else if (cell.getCellType() == (Cell.CELL_TYPE_BLANK)) {
                table_cell = new PdfPCell(new Phrase(""));
                my_table.addCell(table_cell);
            } else {
                table_cell = new PdfPCell(new Phrase(""));
                my_table.addCell(table_cell);
            }
        }
    }
    document.add(my_table);
}

From source file:com.pdfs.GeneradorVisitas.java

public void addCreditosExpress(DatosVisitaDomiciliaria credito) throws DocumentException {

    documento.add(foto);/*from w  w w .jav a2s  .co  m*/

    Paragraph p = new Paragraph("BUFETE DEL RIO, S.C.", tituloN1);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("La Firma Marca la Diferencia ", tituloN2);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("Balboa 1111, Portales Sur, 03300, Mxico, D.F.", tituloN3);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("(55) 5539 0104 con 10 Lneas         contacto@corporativodelrio.com", tituloN3);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    PdfPTable datos = new PdfPTable(2);
    datos.setWidthPercentage(90);

    Phrase pnombre = new Phrase(credito.getNombre());
    pnombre.setFont(cuerpo2);
    Phrase pcalle = new Phrase(credito.getCalle());
    pcalle.setFont(cuerpo2);
    Phrase pnumcredito = new Phrase(credito.getNumcredito());
    pnumcredito.setFont(cuerpo2);
    Phrase pcolonia = new Phrase(credito.getColonia());
    pcolonia.setFont(cuerpo2);
    Phrase pdelegacion = new Phrase(credito.getDelegacion());
    pdelegacion.setFont(cuerpo2);
    float sdo = credito.getSaldo();
    Phrase psaldo = new Paragraph(nf.format(sdo));
    psaldo.setFont(cuerpo2);
    Phrase pestadpCp = new Phrase(credito.getEstado() + "    " + credito.getCp());
    pestadpCp.setFont(cuerpo2);

    PdfPCell nombre = new PdfPCell(pnombre);
    PdfPCell titulocred = new PdfPCell(new Phrase("N Crdito"));
    PdfPCell calle = new PdfPCell(pcalle);
    PdfPCell numcredito = new PdfPCell(pnumcredito);
    PdfPCell colonia = new PdfPCell(pcolonia);
    PdfPCell titulosaldo = new PdfPCell(new Phrase("Saldo Vencido"));
    PdfPCell deleg = new PdfPCell(pdelegacion);
    PdfPCell saldo = new PdfPCell(psaldo);
    PdfPCell ciudadCP = new PdfPCell(pestadpCp);
    PdfPCell blanco = new PdfPCell(new Phrase(" "));

    nombre.setBorder(Rectangle.NO_BORDER);
    titulocred.setBorder(Rectangle.NO_BORDER);
    titulocred.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    calle.setBorder(Rectangle.NO_BORDER);
    numcredito.setBorder(Rectangle.NO_BORDER);
    numcredito.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    colonia.setBorder(Rectangle.NO_BORDER);
    titulosaldo.setBorder(Rectangle.NO_BORDER);
    titulosaldo.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    deleg.setBorder(Rectangle.NO_BORDER);
    saldo.setBorder(Rectangle.NO_BORDER);
    saldo.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    ciudadCP.setBorder(Rectangle.NO_BORDER);
    blanco.setBorder(Rectangle.NO_BORDER);

    datos.addCell(nombre);
    datos.addCell(titulocred);
    datos.addCell(calle);
    datos.addCell(numcredito);
    datos.addCell(colonia);
    datos.addCell(titulosaldo);
    datos.addCell(deleg);
    datos.addCell(saldo);
    datos.addCell(ciudadCP);
    datos.addCell(blanco);

    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));

    documento.add(datos);

    p = new Paragraph("Credito CT Express", tituloN2);
    p.setAlignment(Chunk.ALIGN_RIGHT);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Srvase  la  presente, como  requerimiento  de  pago a  favor  de  Inbursa  para  regularizar  su situacin de adeudo que  actualmente  presenta en la Linea de Crdito CT Express otorgada por Inbursa.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Recuerde que este Crdito se otorg con base en su excelente historial de pago y manejo de su cuenta  CT y ahora lo exhortamos a que  regularize esta situacin a la brevedad, evitando  as, situaciones inconvenientes y daando su buena imagen crediticia.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    p = new Paragraph(
            "Representamos a Inbursa para que recuperemos los pagos atrasados de la Lnea de Crdito que se otorg.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Invariablemente el pago de lo atrasado, deber hacerse nicamente en la Sucursal de Banco Inbursa de su eleccin, a las siguientes Cuentas:",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph("CUENTA CONCENTRADORA 50015025905 a nombre de Banco Inbursa Cobranza Express PYME \n"
            + "o mediante SPEI a la Cuenta 036180-50015025905-6\n" + "o bien en Bancomer:\n"
            + "Convenio CIE 386120 Referencia 50015025902", cuerpo);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("Y no olvide remitirnos el pago de su crdito va correo electrnico.",
            cuerpoNegritas);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Contamos con sus Pagos  y  con su  Comunicacin donde un asesor de este Corporativo le atender. EN  CASO DE QUE  REQUIERA PLAZO PARA PAGAR, CONTACTENOS.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph("A T E N T A M E N T E", cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph("BUFETE DEL RIO, S.C.", cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));
    p = new Paragraph(
            "BUFETE DEL RIO, S.C. una Divisin de CORPORATIVO DEL RIO Y ASOCIADOS S.C.\n"
                    + "AVISO DE PRIVACIDAD. Puede ser consultado en la pgina Web   www.corporativodelrio.com",
            cuerpoMini);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);
}

From source file:com.pdfs.GeneradorVisitas.java

public void addCreditosTelmex(DatosVisitaDomiciliaria credito) throws DocumentException {

    documento.add(foto);//from  w ww  .  j ava2s.  co m
    Paragraph p = new Paragraph("BUFETE DEL RIO, S.C.", tituloN1);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("La Firma Marca la Diferencia ", tituloN2);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("Balboa 1111, Portales Sur, 03300, Mxico, D.F.", tituloN3);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("(55) 5539 0104 con 10 Lneas         contacto@corporativodelrio.com", tituloN3);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    PdfPTable datos = new PdfPTable(2);
    datos.setWidthPercentage(90);

    Phrase pnombre = new Phrase(credito.getNombre());
    pnombre.setFont(cuerpo2);
    Phrase pcalle = new Phrase(credito.getCalle());
    pcalle.setFont(cuerpo2);
    Phrase pnumcredito = new Phrase(credito.getNumcredito());
    pnumcredito.setFont(cuerpo2);
    Phrase pcolonia = new Phrase(credito.getColonia());
    pcolonia.setFont(cuerpo2);
    Phrase pdelegacion = new Phrase(credito.getDelegacion());
    pdelegacion.setFont(cuerpo2);
    float sdo = credito.getSaldo();
    Phrase psaldo = new Paragraph(nf.format(sdo));
    psaldo.setFont(cuerpo2);
    Phrase pestadpCp = new Phrase(credito.getEstado() + "    " + credito.getCp());
    pestadpCp.setFont(cuerpo2);

    PdfPCell nombre = new PdfPCell(pnombre);
    PdfPCell titulocred = new PdfPCell(new Phrase("N Crdito"));
    PdfPCell calle = new PdfPCell(pcalle);
    PdfPCell numcredito = new PdfPCell(pnumcredito);
    PdfPCell colonia = new PdfPCell(pcolonia);
    PdfPCell titulosaldo = new PdfPCell(new Phrase("Saldo Vencido"));
    PdfPCell deleg = new PdfPCell(pdelegacion);
    PdfPCell saldo = new PdfPCell(psaldo);
    PdfPCell ciudadCP = new PdfPCell(pestadpCp);
    PdfPCell blanco = new PdfPCell(new Phrase(" "));

    nombre.setBorder(Rectangle.NO_BORDER);
    titulocred.setBorder(Rectangle.NO_BORDER);
    titulocred.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    calle.setBorder(Rectangle.NO_BORDER);
    numcredito.setBorder(Rectangle.NO_BORDER);
    numcredito.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    colonia.setBorder(Rectangle.NO_BORDER);
    titulosaldo.setBorder(Rectangle.NO_BORDER);
    titulosaldo.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    deleg.setBorder(Rectangle.NO_BORDER);
    saldo.setBorder(Rectangle.NO_BORDER);
    saldo.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    ciudadCP.setBorder(Rectangle.NO_BORDER);
    blanco.setBorder(Rectangle.NO_BORDER);

    datos.addCell(nombre);
    datos.addCell(titulocred);
    datos.addCell(calle);
    datos.addCell(numcredito);
    datos.addCell(colonia);
    datos.addCell(titulosaldo);
    datos.addCell(deleg);
    datos.addCell(saldo);
    datos.addCell(ciudadCP);
    datos.addCell(blanco);

    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));

    documento.add(datos);

    p = new Paragraph("Crdito TELMEX", tituloN2);
    p.setAlignment(Chunk.ALIGN_RIGHT);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Srvase la presente, como requerimiento de  pago a favor de  Inbursa para regularizar su situacin de adeudo que actualmente presenta en la Linea de Crdito Telmex otorgada por Inbursa.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Recuerde que este Crdito se otorg con base en su excelente historial de pago puntual de su Lnea Telmex y ahora lo exhortamos a que regularize esta situacin a la brevedad, evitando situaciones inconvenientes y daando su buena imagen crediticia.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    p = new Paragraph(
            "Representamos a Inbursa para que recuperemos los pagos atrasados de la Lnea de Crdito que se otorg.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Invariablemente el pago de lo atrasado, deber hacerse nicamente en la Sucursal de Banco Inbursa de su eleccin, a las siguientes Cuentas:",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph("CUENTA CONCENTRADORA 50015025745 a nombre de Banco Inbursa Cobranza Telmex\n"
            + "o mediante SPEI a la Cuenta 036180-50015025745-6\n" + "o bien en Bancomer:\n"
            + "Convenio CIE 386120 Referencia 50015025741", cuerpo);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("Y no olvide remitirnos el pago de su crdito va correo electrnico.",
            cuerpoNegritas);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Contamos con sus Pagos  y  con su  Comunicacin donde un asesor de este Corporativo le atender. EN  CASO DE QUE  REQUIERA PLAZO PARA PAGAR, CONTACTENOS.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph("A T E N T A M E N T E", cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph("BUFETE DEL RIO, S.C.", cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "BUFETE DEL RIO, S.C. una Divisin de CORPORATIVO DEL RIO Y ASOCIADOS S.C.\n"
                    + "AVISO DE PRIVACIDAD. Puede ser consultado en la pgina Web   www.corporativodelrio.com",
            cuerpoMini);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);
}

From source file:com.pdfs.GeneradorVisitas.java

public void addCreditosTelmexSOFOM(DatosVisitaDomiciliaria credito) throws DocumentException {

    documento.add(foto);/*from ww w . j  a  va 2s  .  c o m*/
    Paragraph p = new Paragraph("BUFETE DEL RIO, S.C.", tituloN1);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("La Firma Marca la Diferencia ", tituloN2);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("Balboa 1111, Portales Sur, 03300, Mxico, D.F.", tituloN3);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("(55) 5539 0104 con 10 Lneas         contacto@corporativodelrio.com", tituloN3);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    PdfPTable datos = new PdfPTable(2);
    datos.setWidthPercentage(90);

    Phrase pnombre = new Phrase(credito.getNombre());
    pnombre.setFont(cuerpo2);
    Phrase pcalle = new Phrase(credito.getCalle());
    pcalle.setFont(cuerpo2);
    Phrase pnumcredito = new Phrase(credito.getNumcredito());
    pnumcredito.setFont(cuerpo2);
    Phrase pcolonia = new Phrase(credito.getColonia());
    pcolonia.setFont(cuerpo2);
    Phrase pdelegacion = new Phrase(credito.getDelegacion());
    pdelegacion.setFont(cuerpo2);
    float sdo = credito.getSaldo();
    Phrase psaldo = new Paragraph(nf.format(sdo));
    psaldo.setFont(cuerpo2);
    Phrase pestadpCp = new Phrase(credito.getEstado() + "    " + credito.getCp());
    pestadpCp.setFont(cuerpo2);

    PdfPCell nombre = new PdfPCell(pnombre);
    PdfPCell titulocred = new PdfPCell(new Phrase("N Crdito"));
    PdfPCell calle = new PdfPCell(pcalle);
    PdfPCell numcredito = new PdfPCell(pnumcredito);
    PdfPCell colonia = new PdfPCell(pcolonia);
    PdfPCell titulosaldo = new PdfPCell(new Phrase("Saldo Vencido"));
    PdfPCell deleg = new PdfPCell(pdelegacion);
    PdfPCell saldo = new PdfPCell(psaldo);
    PdfPCell ciudadCP = new PdfPCell(pestadpCp);
    PdfPCell blanco = new PdfPCell(new Phrase(" "));

    nombre.setBorder(Rectangle.NO_BORDER);
    titulocred.setBorder(Rectangle.NO_BORDER);
    titulocred.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    calle.setBorder(Rectangle.NO_BORDER);
    numcredito.setBorder(Rectangle.NO_BORDER);
    numcredito.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    colonia.setBorder(Rectangle.NO_BORDER);
    titulosaldo.setBorder(Rectangle.NO_BORDER);
    titulosaldo.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    deleg.setBorder(Rectangle.NO_BORDER);
    saldo.setBorder(Rectangle.NO_BORDER);
    saldo.setHorizontalAlignment(Chunk.ALIGN_RIGHT);
    ciudadCP.setBorder(Rectangle.NO_BORDER);
    blanco.setBorder(Rectangle.NO_BORDER);

    datos.addCell(nombre);
    datos.addCell(titulocred);
    datos.addCell(calle);
    datos.addCell(numcredito);
    datos.addCell(colonia);
    datos.addCell(titulosaldo);
    datos.addCell(deleg);
    datos.addCell(saldo);
    datos.addCell(ciudadCP);
    datos.addCell(blanco);

    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));

    documento.add(datos);

    p = new Paragraph("Crdito TELMEX (Sofom)", tituloN2);
    p.setAlignment(Chunk.ALIGN_RIGHT);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Srvase la presente, como requerimiento de  pago a favor de  Inbursa para regularizar su situacin de adeudo que actualmente presenta en la Linea de Crdito Telmex otorgada por Inbursa.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Recuerde que este Crdito se otorg con base en su excelente historial de pago puntual de su Lnea Telmex y ahora lo exhortamos a que regularize esta situacin a la brevedad, evitando situaciones inconvenientes y daando su buena imagen crediticia.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    p = new Paragraph(
            "Representamos a Inbursa para que recuperemos los pagos atrasados de la Lnea de Crdito que se otorg.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Invariablemente el pago de lo atrasado, deber hacerse nicamente en la Sucursal de Banco Inbursa de su eleccin, a las siguientes Cuentas:",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph("CUENTA CONCENTRADORA 50010911552 a nombre de Sociedad Financiera Inbursa S.A. de C.V.\n"
            + "o mediante SPEI a la Cuenta 036180-50010911552-3\n" + "o bien en Bancomer:\n"
            + "Convenio CIE 386120 Referencia 50010911556", cuerpo);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    p = new Paragraph("Y no olvide remitirnos el pago de su crdito va correo electrnico.",
            cuerpoNegritas);
    p.setAlignment(Chunk.ALIGN_CENTER);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph(
            "Contamos con sus Pagos  y  con su  Comunicacin donde un asesor de este Corporativo le atender. EN  CASO DE QUE  REQUIERA PLAZO PARA PAGAR, CONTACTENOS.",
            cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph("A T E N T A M E N T E", cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));
    documento.add(new Paragraph(Chunk.NEWLINE));

    p = new Paragraph("BUFETE DEL RIO, S.C.", cuerpo);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);

    documento.add(new Paragraph(Chunk.NEWLINE));
    p = new Paragraph(
            "BUFETE DEL RIO, S.C. una Divisin de CORPORATIVO DEL RIO Y ASOCIADOS S.C.\n"
                    + "AVISO DE PRIVACIDAD. Puede ser consultado en la pgina Web   www.corporativodelrio.com",
            cuerpoMini);
    p.setAlignment(Chunk.ALIGN_JUSTIFIED);
    documento.add(p);
}