Example usage for com.itextpdf.text.pdf TextField getText

List of usage examples for com.itextpdf.text.pdf TextField getText

Introduction

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

Prototype

public String getText() 

Source Link

Document

Gets the text.

Usage

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  v  a 2 s . c o  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";

}

From source file:classes.utils.createPDF_NetPresent.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, "_");

    period = st.nextToken();/*from ww w  .ja v a 2s  .  c om*/
    principal = st.nextToken();
    interestRate = st.nextToken();
    tax = st.nextToken();
    salvageV = st.nextToken();
    periodSalvage = st.nextToken();
    data = st.nextToken();

    Document document = new Document(PageSize.LETTER, 80, 80, 50, 50);
    FileOutputStream salida = new FileOutputStream(project + "_NetPresentValue.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\nNET PRESENT VALUE");
    paragraph.setAlignment(Paragraph.ALIGN_CENTER);

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

    //image.scaleToFit(150, 150);

    Image image1 = Image.getInstance(project + "/" + project + "_NPV_CCF.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", 10, Font.BOLD, BaseColor.BLUE)));
    paragraph_5.add("\n\nP   OUTFLOW   INFLOW   NET CASH FLOW   CUMULATIVE CASH ");
    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: \nPeriods: " + period + "\n Principal: " + principal
            + " \n Interest Rate%: " + interestRate + " \n Tax Rate %: " + tax + "\n Salvage Value: " + salvageV
            + " \n Period SV: " + periodSalvage);
    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);
    document.add(image1);
    Image image2 = Image.getInstance(project + "/" + project + "_NPV_NCF.png");
    document.add(image2);
    document.add(paragraph_2);
    document.close();
    return null;

}

From source file:classes.utils.createPDF_PayBack.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, "_");

    period = st.nextToken();// w w  w  . jav a 2s. c o m
    principal = st.nextToken();
    interestRate = st.nextToken();
    data = st.nextToken();

    Document document = new Document(PageSize.LETTER, 80, 80, 50, 50);
    FileOutputStream salida = new FileOutputStream(project + "_PayBackPeriod.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\nPAYBACK PERIOD");
    paragraph.setAlignment(Paragraph.ALIGN_CENTER);
    // TODO: Change absolute to relative
    //Image image = Image.getInstance("/home/isaac/IdeaProjects/ProjectEvaluation/src/images/logo_report.png");

    //image.scaleToFit(150, 150);

    Image image1 = Image.getInstance(project + "/" + project + "_PBP_CCF.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", 10, Font.BOLD, BaseColor.BLUE)));
    paragraph_5.add("\n\nP   OUTFLOW  INFLOW  CUMMULATIVE CASH... ");
    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 Numero de Periodos: " + period
            + "\nInterest Rate %" + interestRate);
    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 + "_PBP_NCF.png");
    document.add(image1);
    document.add(image2);
    document.add(paragraph_2);
    document.close();
    return null;

}