Example usage for com.itextpdf.text Document add

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

Introduction

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

Prototype


public boolean add(Element element) throws DocumentException 

Source Link

Document

Adds an Element to the Document.

Usage

From source file:Clases.NuevoPdf.java

private static void tableDatosEncabezado(Paragraph[] arregloParrafos, Document document)
        throws BadElementException, IOException {
    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(99);/*w ww  .jav  a 2s . c  om*/

    PdfPCell c1 = new PdfPCell(new Phrase());
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    c1.setBorder(0);
    addLogo(c1, "LOGO.png");
    table.addCell(c1);

    PdfPCell c2 = new PdfPCell();
    for (int i = 0; i < arregloParrafos.length; i++) {
        c2.addElement(arregloParrafos[i]);
    }
    c2.setHorizontalAlignment(Element.ALIGN_CENTER);
    c2.setBorder(0);
    table.addCell(c2);
    float[] columnWidths = new float[] { 25f, 75f };
    try {
        table.setWidths(columnWidths);
    } catch (Exception ex) {
        System.out.println(ex.getMessage());
    }

    Paragraph p = new Paragraph();
    p.add(table);
    try {
        document.add(p);
    } catch (Exception ex) {
        System.out.println(ex.getMessage());
    }
}

From source file:Clases.NuevoPdf.java

private static void addTableClienteYFactura(Document doc) throws DocumentException {
    PdfPTable encabezados = new PdfPTable(2);
    encabezados.setWidthPercentage(99);/* ww  w.  jav  a 2  s.  co m*/

    PdfPCell c1 = new PdfPCell(new Phrase("CLIENTE", normalWhite));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    c1.setBackgroundColor(BaseColor.RED);
    c1.setBorder(0);
    encabezados.addCell(c1);

    PdfPCell c2 = new PdfPCell(new Phrase("FOLIO FISCAL", normalWhite));
    c2.setHorizontalAlignment(Element.ALIGN_CENTER);
    c2.setBackgroundColor(BaseColor.RED);
    c2.setBorder(0);
    encabezados.addCell(c2);

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

    Paragraph rfc = new Paragraph("N de Folio: " + Variables.idFactura, medium);
    Paragraph rfc2 = new Paragraph(Variables.RFC, medium);
    Paragraph nombre = new Paragraph(Variables.NombreCliente, medium);
    Paragraph direccion = new Paragraph(Variables.delegacion, medium);
    Paragraph ciudad = new Paragraph(Variables.municipio + " " + Variables.Estado + " MEXICO", medium);
    Paragraph cp = new Paragraph("CP: " + Variables.codpostal, medium);

    Paragraph[] datosCliente = { rfc, rfc2, nombre, direccion, ciudad, cp };

    PdfPCell c3 = new PdfPCell();
    for (int i = 0; i < datosCliente.length; i++) {
        c3.addElement(datosCliente[i]);
    }
    datos.addCell(c3);

    float[] columnWidths = new float[] { 60f, 40f };
    try {
        encabezados.setWidths(columnWidths);
        datos.setWidths(columnWidths);
    } catch (Exception ex) {
        System.out.println(ex.getMessage());
    }

    Paragraph folioFactura = new Paragraph("CS434-BYOR3343-GVLR03-034", smallBold);
    Paragraph csd = new Paragraph("No de serie del certificado CSD", smallBold);
    Paragraph codigo = new Paragraph("03490941023923", smallBold);
    Paragraph fecha = new Paragraph("Fecha y hora de emisin", smallBold);
    Paragraph datosfecha = new Paragraph(Variables.FechaSistema, smallBold);
    folioFactura.setAlignment(Element.ALIGN_CENTER);
    csd.setAlignment(Element.ALIGN_CENTER);
    codigo.setAlignment(Element.ALIGN_CENTER);
    fecha.setAlignment(Element.ALIGN_CENTER);
    datosfecha.setAlignment(Element.ALIGN_CENTER);

    Paragraph[] datosFactura = { folioFactura, csd, codigo, fecha, datosfecha };
    PdfPCell c4 = new PdfPCell();
    for (int i = 0; i < datosFactura.length; i++) {
        c4.addElement(datosFactura[i]);
    }
    datos.addCell(c4);

    Paragraph p = new Paragraph();
    p.add(encabezados);
    p.add(datos);
    doc.add(p);

}

From source file:Clases.NuevoPdf.java

private static void addTableProducts(Document doc) throws DocumentException {
    PdfPTable table = new PdfPTable(6);
    table.setWidthPercentage(99);/*  w  ww .  j ava 2  s .c  om*/

    PdfPCell c1 = new PdfPCell(new Phrase("CLAVE", normalWhite));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    c1.setBackgroundColor(BaseColor.RED);
    c1.setBorder(0);
    table.addCell(c1);

    PdfPCell c2 = new PdfPCell(new Phrase("CANTIDAD", normalWhite));
    c2.setHorizontalAlignment(Element.ALIGN_CENTER);
    c2.setBackgroundColor(BaseColor.RED);
    c2.setBorder(0);
    table.addCell(c2);

    PdfPCell c3 = new PdfPCell(new Phrase("UM", normalWhite));
    c3.setHorizontalAlignment(Element.ALIGN_CENTER);
    c3.setBackgroundColor(BaseColor.RED);
    c3.setBorder(0);
    table.addCell(c3);

    PdfPCell c4 = new PdfPCell(new Phrase("DESCRIPCION", normalWhite));
    c4.setHorizontalAlignment(Element.ALIGN_CENTER);
    c4.setBackgroundColor(BaseColor.RED);
    c4.setBorder(0);
    table.addCell(c4);

    PdfPCell c5 = new PdfPCell(new Phrase("PRECIO UNITARIO", normalWhite));
    c5.setHorizontalAlignment(Element.ALIGN_CENTER);
    c5.setBackgroundColor(BaseColor.RED);
    c5.setBorder(0);
    table.addCell(c5);

    PdfPCell c6 = new PdfPCell(new Phrase("IMPORTE", normalWhite));
    c6.setHorizontalAlignment(Element.ALIGN_CENTER);
    c6.setBackgroundColor(BaseColor.RED);
    c6.setBorder(0);
    table.addCell(c6);

    float[] columnWidths = new float[] { 15f, 15f, 10f, 30f, 15f, 15f };
    try {
        table.setWidths(columnWidths);
    } catch (Exception ex) {
        System.out.println(ex.getMessage());
    }

    for (int i = 0; i < Variables.claves.size(); i++) {
        table.addCell(new Phrase(String.valueOf(Variables.claves.get(i)), normal));
        table.addCell(new Phrase(String.valueOf(Variables.cantidades.get(i)), normal));
        table.addCell(new Phrase(String.valueOf(Variables.ums.get(i)), normal));
        table.addCell(new Phrase(String.valueOf(Variables.descripciones.get(i)), normal));
        table.addCell(new Phrase(String.valueOf(Variables.preciosunitarios.get(i)), normal));
        table.addCell(new Phrase(String.valueOf(Variables.importes.get(i)), normal));

    }

    /*table.addCell(new Phrase("R0-510055-TIM",normal));
    table.addCell(new Phrase("2.0",normal));
    table.addCell(new Phrase("PIEZAS",normal));
    table.addCell(new Phrase("BALERO DOBLE",normal));
    table.addCell(new Phrase("$336.47",normal));
    table.addCell(new Phrase("$672.94",normal));*/

    Paragraph p = new Paragraph();
    p.add(table);
    doc.add(p);

}

From source file:Clases.NuevoPdf.java

private static void addTableTotales(Document doc) throws DocumentException, IOException {
    Paragraph totalEnLetras = new Paragraph("SON : SEISCIENTOS SETENTA Y TRES PESOS 52/100 M.N");
    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(99);//from  w w  w  .  jav  a 2s .  co  m

    PdfPCell c1 = new PdfPCell();
    Paragraph comentariotitulo = new Paragraph("Comentario", smallBold);
    Paragraph comentario = new Paragraph(Variables.Comentario, small);
    Paragraph cv = new Paragraph("Condicion de venta: CONTADO", smallBold);
    Paragraph fp = new Paragraph("Forma de pago: UNA SOLA EXHIBICION", smallBold);
    Paragraph mp = new Paragraph("Metodo de pago: EFECTIVO", smallBold);
    Paragraph[] formasPago = { comentariotitulo, comentario, cv, fp, mp };
    for (int i = 0; i < formasPago.length; i++) {
        c1.addElement(formasPago[i]);
    }
    c1.setBorder(0);
    table.addCell(c1);

    PdfPCell c2 = new PdfPCell();
    Paragraph s = new Paragraph("Suma:", small);
    Paragraph d = new Paragraph("Descuento:", small);
    Paragraph st = new Paragraph("Subtotal:", small);
    Paragraph iv = new Paragraph("IVA: 16%:", small);
    Paragraph t = new Paragraph("Total:", smallBold);

    Paragraph[] tags = { s, d, st, iv, t };
    for (int i = 0; i < tags.length; i++) {
        c2.addElement(tags[i]);
    }
    c2.setBorder(0);
    table.addCell(c2);

    PdfPCell c3 = new PdfPCell();
    Paragraph ns = new Paragraph("$" + String.valueOf(Variables.suma), small);
    Paragraph nd = new Paragraph("$" + String.valueOf(Variables.descuento), small);
    Paragraph nst = new Paragraph("$" + String.valueOf(Variables.subtotal), small);
    Paragraph niv = new Paragraph("$" + String.valueOf(Variables.iva), small);
    Paragraph nt = new Paragraph("$" + String.valueOf(Variables.total), smallBold);

    Paragraph[] totales = { ns, nd, nst, niv, nt };
    for (int i = 0; i < totales.length; i++) {
        c3.addElement(totales[i]);
    }
    c3.setBorder(0);
    table.addCell(c3);

    float[] columnWidths = new float[] { 66f, 17f, 17f };
    try {
        table.setWidths(columnWidths);

    } catch (Exception ex) {
        System.out.println(ex.getMessage());
    }

    Paragraph p = new Paragraph();
    Paragraph espaciador = new Paragraph("");
    Paragraph sellodigital1 = new Paragraph("Sello digital del CFDI", smallBold);
    Paragraph sellodigital2 = new Paragraph(
            "fk0fok0f94kf09fk049fk340fk42f034kf04fk340fi43kf034fk340fk34f034kf034fk340fk340fk34f0o34kf034ofk340fo3k4f03kg35ihjlofkajflakjfl4kfj3l2kfj2f03jgoerkgjsfvns,vmernv034fv349fi2jf034ijf20gfijdqdkqejfoej",
            small);

    Paragraph sellodigital3 = new Paragraph("Sello del SAT", smallBold);
    Paragraph sellodigital4 = new Paragraph(
            "cmdvkdovewwdqwCWEFRWRVIW3903r930frvDGHERGWRBRVEGRWGWRddkfjdkfrjgkwvnsdlkcmasx,sqpsqlkcwproigkrofik24203940e2932d,swlsk qms12dikd39kdw0oc,wrjbnwepobvkjqevo24f0rwkvwri0bj35ob iwemvlw,amsc,meovkjw0bn0234or0fj",
            small);

    Paragraph sellodigital5 = new Paragraph("No de serie del complemento de  certificacion del SAT:",
            smallBold);
    Paragraph sellodigital6 = new Paragraph("00000100000002133560001", smallBold);

    Paragraph sellodigital7 = new Paragraph("Fecha y hora de certificacion:", smallBold);
    Paragraph sellodigital8 = new Paragraph(Variables.FechaFactura, small);

    Paragraph sellodigital9 = new Paragraph("Expedido en:", smallBold);
    Paragraph sellodigital10 = new Paragraph("CANCUN, QUINTANA ROO", small);
    Paragraph sellodigital11 = new Paragraph("ESTE DOCUMENTO ES UNA REPRESENTACION IMPRESA DE UN CFDI ",
            smallBold);

    Paragraph[] parrafosSellos = { sellodigital1, sellodigital2, sellodigital3, sellodigital4 };

    PdfPTable datosSAT = new PdfPTable(2);
    datosSAT.setWidthPercentage(99);

    PdfPCell cS1 = new PdfPCell(new Phrase());
    cS1.setHorizontalAlignment(Element.ALIGN_CENTER);
    cS1.setBorder(0);
    addLogo(cS1, "qr.jpg");
    datosSAT.addCell(cS1);

    PdfPCell cS2 = new PdfPCell();
    for (int i = 0; i < parrafosSellos.length; i++) {
        cS2.addElement(parrafosSellos[i]);
    }
    cS2.setBorder(0);
    datosSAT.addCell(cS2);
    float[] columnWidths2 = new float[] { 20f, 80f };
    try {
        datosSAT.setWidths(columnWidths2);
    } catch (Exception ex) {
        System.out.println(ex.getMessage());
    }

    p.add(table);
    p.add(espaciador);
    p.add(espaciador);
    p.add(datosSAT);
    p.add(sellodigital5);
    p.add(sellodigital6);
    p.add(sellodigital7);
    p.add(sellodigital8);
    p.add(sellodigital9);
    p.add(sellodigital10);
    p.add(sellodigital11);

    doc.add(p);

}

From source file:Clases.PDF.java

public void crearPDF(String filename, String nombre, String objetosComprados)
        throws DocumentException, IOException {
    // step 1/*from www.  jav  a 2  s.co m*/
    Document document = new Document();
    // step 2
    PdfWriter.getInstance(document, new FileOutputStream(filename));
    // step 3
    document.open();
    // step 4

    /*   Image image1 = Image.getInstance("/Users/davfer29/NetBeansProjects/DiarioFacilWeb/build/web/images/client.png");
      document.add(image1);     
     image1.scaleAbsolute(150f, 150f);*/ //esto se usa para adjuntar imagenes al pdf y centrarlas  

    document.addTitle("Bienvenido a DiarioFacil");
    document.add(new Paragraph("Su compra de los articulos " + objetosComprados + " ha sido exitosa"));
    document.add(new Paragraph("Gracias! Agradecemos que haya elegido nuestra pagina " + nombre));
    // step 5
    document.close();
}

From source file:Classes.GerarPdf.java

public static void main(String arg[]) throws Exception {

    File arquivo = new File("odontograma.pdf");

    System.out.print(arquivo.getAbsolutePath());

    File file = new File(arquivo.getAbsolutePath());
    file.delete();//from  w w w.  j a  va  2  s.com

    Document document = new Document();
    PdfWriter.getInstance(document, new FileOutputStream("odontograma.pdf"));
    document.open();
    document.add(new Paragraph("ODONTOGRAMA"));
    document.add(new Paragraph("\nCodigo Paciente: " + arg[0]));
    document.add(new Paragraph("Nome Paciente: " + arg[1]));
    document.add(new Paragraph("Codigo Procedimento: " + arg[2]));
    document.add(new Paragraph("Procedimento: " + arg[3]));
    document.add(new Paragraph("\nDetalhes : " + arg[4]));
    document.add(new Paragraph("\nValor : " + arg[5]));

    document.close();

}

From source file:classes.PdfFiles.java

public static void addTitlePage(Document document) throws DocumentException {
    Paragraph title = new Paragraph("Paragon", catFont);
    title.setAlignment(Element.ALIGN_CENTER);
    document.add(title);
    Paragraph preface = new Paragraph();
    addEmptyLine(preface, 1);//from w  w w.j a  v  a2  s. c  o m
    preface.add(new Paragraph("Wygenerowano: " + new Date(), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            smallBold));
    addEmptyLine(preface, 5);
    document.add(preface);
}

From source file:classes.PdfFiles.java

private static void createTable(Document document, java.util.List<Product> selling_list) {

    /*Create table*/
    PdfPTable table = new PdfPTable(4);

    /*Create price*/
    Double price = 0.0;/*from  w w  w.  j  a  v a  2 s .  c o m*/

    /*Add cells*/
    PdfPCell c1 = new PdfPCell(new Phrase("Nazwa"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Cena"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("VAT"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Ilosc"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    /*Add cells for each product*/
    for (Product p : selling_list) {
        table.addCell(p.getName());
        table.addCell(Double.toString(p.getRetail_price()));
        table.addCell(Double.toString(p.getVat()));
        table.addCell(Integer.toString(p.getQuantity()));
    }

    Function f = new Function();

    /*Get price*/
    price = f.getPriceFromProductList(selling_list);
    try {
        /*Add table*/
        Paragraph p = new Paragraph();
        p.add(table);
        addEmptyLine(p, 2);
        Paragraph p2 = new Paragraph(Double.toString(price) + " PLN");
        p2.setAlignment(Element.ALIGN_RIGHT);
        p.add(p2);
        document.add(p);
    } catch (DocumentException ex) {
        JOptionPane.showMessageDialog(null, "Error genrating Invoice");
        Logger.getLogger(PdfFiles.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:classes.utils.crearPDF_Depreciacion.java

public String writePDF(String datos, Scene scene)
        throws FileNotFoundException, DocumentException, BadElementException, IOException {

    javafx.scene.control.TextField projectName = (TextField) scene.lookup(CNodeID.TEXTFIELD_PROJECT_NAME);
    String project = projectName.getText();

    StringTokenizer st = new StringTokenizer(datos, "_");

    principal = st.nextToken();/*w  ww .  j a  v a 2s .  c  o  m*/
    salvageV = st.nextToken();
    period = st.nextToken();
    tax = st.nextToken();
    periodSalvage = st.nextToken();
    category = st.nextToken();
    data = st.nextToken();

    Document document = new Document(PageSize.LETTER, 80, 80, 50, 50);
    FileOutputStream salida = new FileOutputStream(project + "_depreciation.pdf");
    PdfWriter writer = PdfWriter.getInstance(document, salida);
    writer.setInitialLeading(0);

    Paragraph paragraph = new Paragraph();
    paragraph.setFont(new Font(FontFactory.getFont("Courier", 20, Font.BOLDITALIC, BaseColor.RED)));
    paragraph.add("\n\n\nDEPRECIACION");
    paragraph.setAlignment(Paragraph.ALIGN_CENTER);

    //System.out.println(getClass().getResource("images/logo_report.png"));
    //Image image = Image.getInstance("/home/isaac/IdeaProjects/ProjectEvaluation/src/images/logo_report.png");

    //image.scaleToFit(150, 150);

    Image image1 = Image.getInstance(project + "/" + project + "_DEP_TY.png");

    image1.scaleToFit(300, 300);

    //image.setAlignment(Chunk.ALIGN_RIGHT);
    image1.setAlignment(Chunk.ALIGN_CENTER);

    Paragraph paragraph_2 = new Paragraph();
    paragraph_2.setFont(new Font(FontFactory.getFont("Courier", 12, Font.BOLD, BaseColor.BLUE)));
    paragraph_2.add(
            "\n\n\n\n\n\n\n\n\n\n\nADMINISTRACION Y EVALUACION DE PROYECTOS\n\n SERGIO VALDES TORRES A01365520\n ERIK MARTIN A01365096\nISAAC SECUNDINO A01361162\n IVAN CABRER A01184937");
    paragraph_2.setAlignment(Paragraph.ALIGN_RIGHT);

    Paragraph paragraph_3 = new Paragraph();
    paragraph_3.setFont(new Font(FontFactory.getFont("Courier", 11, Font.BOLD, BaseColor.BLACK)));
    paragraph_3.add("\n " + data);
    paragraph_3.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_5 = new Paragraph();
    paragraph_5.setFont(new Font(FontFactory.getFont("Courier", 6, Font.BOLD, BaseColor.BLUE)));
    paragraph_5.add("\n\nP   DEPRECIATON RATE  ANNUAL DEPRECIATON  CUMMULATIVE DEPRECIATON  VALUE IN LEDGERS ");
    paragraph_5.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_4 = new Paragraph();
    paragraph_4.setFont(new Font(FontFactory.getFont("Courier", 9, Font.BOLD, BaseColor.BLACK)));
    paragraph_4.add("Nombre del Evaluador: \n Principal: " + principal + " \n Salvag Value: " + salvageV
            + " \n Numero de Periodos: " + period + "\n Tax: " + tax + " \n Salvage Period: " + periodSalvage
            + "\n Categoria: " + category);
    paragraph_4.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_6 = new Paragraph();
    paragraph_6.setFont(new Font(FontFactory.getFont("Courier", 15, Font.BOLD, BaseColor.GRAY)));
    paragraph_6.add("\n GRAFICAS\n");
    paragraph_6.setAlignment(Paragraph.ALIGN_CENTER);

    document.open();
    //document.add(image);

    document.add(paragraph);

    document.add(paragraph_4);
    document.add(paragraph_5);
    document.add(paragraph_3);
    document.add(paragraph_6);
    Image image2 = Image.getInstance(project + "/" + project + "_DEP_DR.png");
    Image image3 = Image.getInstance(project + "/" + project + "_DEP_AD.png");
    Image image4 = Image.getInstance(project + "/" + project + "_DEP_ACD.png");
    Image image5 = Image.getInstance(project + "/" + project + "_DEP_LV.png");
    document.add(image2);
    document.add(image3);
    document.add(image4);
    document.add(image5);
    document.add(image1);
    document.add(paragraph_2);
    document.close();
    return null;

}

From source file:classes.utils.createPDF_checkList.java

public String writePDF(Scene scene, String datos)
        throws FileNotFoundException, DocumentException, BadElementException, IOException {

    javafx.scene.control.TextField projectName = (javafx.scene.control.TextField) scene
            .lookup(CNodeID.TEXTFIELD_PROJECT_NAME);
    String project = projectName.getText();
    StringTokenizer st = new StringTokenizer(datos, "*");

    dato1 = st.nextToken();/*from  w w  w  .j  a  va2 s . co m*/
    dato2 = st.nextToken();
    dato3 = st.nextToken();
    dato4 = st.nextToken();
    dato5 = st.nextToken();
    dato6 = st.nextToken();
    dato7 = st.nextToken();
    dato8 = st.nextToken();
    dato9 = st.nextToken();
    dato10 = st.nextToken();
    dato11 = st.nextToken();
    dato12 = st.nextToken();
    dato13 = st.nextToken();
    dato14 = st.nextToken();
    dato15 = st.nextToken();
    dato16 = st.nextToken();
    dato17 = st.nextToken();

    Document document = new Document(PageSize.LETTER, 80, 80, 50, 50);
    FileOutputStream salida = new FileOutputStream(project + "_CheckList.pdf");
    PdfWriter writer = PdfWriter.getInstance(document, salida);
    writer.setInitialLeading(0);

    Paragraph paragraph = new Paragraph();
    paragraph.setFont(new Font(FontFactory.getFont("Courier", 20, Font.BOLDITALIC, BaseColor.RED)));
    paragraph.add("\n\n\nCHECK LIST");
    paragraph.setAlignment(Paragraph.ALIGN_CENTER);

    //Image image = Image.getInstance("/home/isaac/IdeaProjects/ProjectEvaluation/src/images/logo_report.png");

    //image.scaleToFit(150, 150);

    //image.setAlignment(Chunk.ALIGN_RIGHT);

    Paragraph paragraph_2 = new Paragraph();
    paragraph_2.setFont(new Font(FontFactory.getFont("Courier", 12, Font.BOLD, BaseColor.BLUE)));
    paragraph_2.add(
            "\n\n\n\n\n\n\nADMINISTRACION Y EVALUACION DE PROYECTOS\n\n SERGIO VALDES TORRES A01365520\n ERIK MARTIN A01365096\nISAAC SECUNDINO A01361162\n IVAN CABRER A01184937");
    paragraph_2.setAlignment(Paragraph.ALIGN_RIGHT);

    Paragraph paragraph_4 = new Paragraph();
    paragraph_4.setFont(new Font(FontFactory.getFont("Courier", 6, Font.BOLD, BaseColor.BLACK)));
    paragraph_4.add("Strategy---Alignment What specific organization strategy does this project align with?"
            + "     " + dato1 + "\n" + "Driver---What business problem does the project solve?" + "     "
            + dato2 + "\n" + "Success Metrics---How will measure success?" + "     " + dato3 + "\n"
            + "Sponsorship---Who is the project sponsor?" + "     " + dato4 + "\n"
            + "Risk---What is the impact of not doing this project?" + "     " + dato5 + "\n"
            + "Risk---What is the project risk to our organization?" + "     " + dato6 + "\n"
            + "Risk---Where does the proposed project fit in our risk profile?" + "     " + dato7 + "\n"
            + "Benefits, value---What is the value of the project organization?" + "     " + dato8 + "\n"
            + "Benefits, value---When will the project shows results?" + "     " + dato9 + "\n"
            + "Objectives---What are the project objectives?" + "     " + dato10 + "\n"
            + "Organization Culture---Is our organization culture right for this type of project?" + "     "
            + dato11 + "\n" + "Resources---Will internal resources be available for this project?" + "     "
            + dato12 + "\n" + "Approach---Will we build or buy?" + "     " + dato13 + "\n"
            + "Schedule---How long will this project take?" + "     " + dato14 + "\n"
            + "Schedule---Is the timeline realistic?" + "     " + dato15 + "\n"
            + "Training/Resources---Will staff training be required?" + "     " + dato16 + "\n"
            + "Finance/Portfolio---What is the estimated cost of the project?" + "     " + dato17 + "\n");
    /*+ "Portfolio---Is this a new initiative or path of an existing initiative?"+"     "+dato18+"\n"
    + "Portfolio---How does this project interact with current projects?"+"     "+dato19+"\n"
    + "Technology---Is the technology available or new?"+"     "+dato20+"");
    */

    paragraph_4.setAlignment(Paragraph.ALIGN_LEFT);

    document.open();
    //document.add(image);

    document.add(paragraph);

    document.add(paragraph_4);

    document.add(paragraph_2);
    document.close();
    return "pdf Creado";

}